Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getDividends - issues with connections and handles #314

Closed
mcfsalla opened this issue Oct 15, 2020 · 3 comments
Closed

getDividends - issues with connections and handles #314

mcfsalla opened this issue Oct 15, 2020 · 3 comments
Labels

Comments

@mcfsalla
Copy link

Description

getDividends keep producing error messages like "Error in open.connection...: Handle is already in use elsewhere."

Expected behavior

A time series of dividends

Minimal, reproducible example

getDividends("AAPL")

Session Info

R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=Portuguese_Brazil.1252  LC_CTYPE=Portuguese_Brazil.1252   
[3] LC_MONETARY=Portuguese_Brazil.1252 LC_NUMERIC=C                      
[5] LC_TIME=Portuguese_Brazil.1252    

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] ggrepel_0.8.2              forcats_0.5.0              stringr_1.4.0             
 [4] dplyr_1.0.1                purrr_0.3.4                readr_1.3.1               
 [7] tidyr_1.1.1                tibble_3.0.3               ggplot2_3.3.2             
[10] tidyverse_1.3.0            PerformanceAnalytics_2.0.4 skimr_2.1.2               
[13] quantmod_0.4.17.1          TTR_0.24.0                 xts_0.12-0                
[16] zoo_1.8-8                  lubridate_1.7.9            fPortfolio_3042.83.1      
[19] fAssets_3042.84            fOptions_3042.86           fBasics_3042.89.1         
[22] timeSeries_3062.100        timeDate_3043.102          rugarch_1.4-4             

loaded via a namespace (and not attached):
 [1] fs_1.5.0                    bitops_1.0-6                spd_2.0-1                  
 [4] httr_1.4.2                  repr_1.1.0                  numDeriv_2016.8-1.1        
 [7] tools_4.0.2                 backports_1.1.7             R6_2.4.1                   
[10] KernSmooth_2.23-17          DBI_1.1.0                   colorspace_1.4-1           
[13] sn_1.6-2                    withr_2.2.0                 tidyselect_1.1.0           
[16] mnormt_2.0.1                fCopulae_3042.82.1          curl_4.3                   
[19] compiler_4.0.2              ecodist_2.0.5               cli_2.0.2                  
[22] rvest_0.3.6                 xml2_1.3.2                  slam_0.1-47                
[25] scales_1.1.1                DEoptimR_1.0-8              mvtnorm_1.1-1              
[28] robustbase_0.93-6           quadprog_1.5-8              spatial_7.3-12             
[31] digest_0.6.25               base64enc_0.1-3             pkgconfig_2.0.3            
[34] htmltools_0.5.0             dbplyr_1.4.4                readxl_1.3.1               
[37] rlang_0.4.7                 rstudioapi_0.11             generics_0.0.2             
[40] energy_1.7-7                jsonlite_1.7.0              mclust_5.4.6               
[43] RCurl_1.98-1.2              magrittr_1.5                Matrix_1.2-18              
[46] fansi_0.4.1                 Rcpp_1.0.5                  munsell_0.5.0              
[49] lifecycle_0.2.0             stringi_1.4.6               Rglpk_0.6-4                
[52] MASS_7.3-51.6               grid_4.0.2                  blob_1.2.1                 
[55] crayon_1.3.4                lattice_0.20-41             SkewHyperbolic_0.4-0       
[58] haven_2.3.1                 hms_0.5.3                   tmvnsim_1.0-2              
[61] knitr_1.29                  pillar_1.4.6                boot_1.3-25                
[64] rneos_0.4-0                 mvnormtest_0.1-9            stats4_4.0.2               
[67] reprex_0.3.0                XML_3.99-0.5                glue_1.4.1                 
[70] DistributionUtils_0.6-0     modelr_0.1.8                vctrs_0.3.2                
[73] nloptr_1.2.2.2              cellranger_1.1.0            gtable_0.3.0               
[76] fMultivar_3042.80.1         kernlab_0.9-29              assertthat_0.2.1           
[79] ks_1.11.7                   xfun_0.16                   broom_0.7.0                
[82] GeneralizedHyperbolic_0.8-4 Rsolnp_1.16                 truncnorm_1.0-8            
[85] ellipsis_0.3.1 
@joshuaulrich
Copy link
Owner

I can replicate this if I interrupt a getDividends() call. All calls after that throw the error.

Use this code to remove the handle manually until there's a fix:

rm("_handle_", envir = quantmod:::.quantmodEnv)

@mcfsalla
Copy link
Author

Tried that and got this: "Error in curl::curl_fetch_memory(query.srv, handle = h$ch) :
Timeout was reached: [query2.finance.yahoo.com] Operation timed out after 10001 milliseconds with 0 out of 0 bytes received"

@joshuaulrich
Copy link
Owner

joshuaulrich commented Oct 26, 2020

I spent some time investigating this morning. This is similar to #307. The fix is similar. I'll refactor the code so getSymbols(), getDividends(), and getSplits() use the same code to retry the download.

@joshuaulrich joshuaulrich added this to the Release 0.4.18 milestone Nov 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants