Error "attempt to set an attribute on NULL" when calling getSymbols() for dates with no data #405
Open
Description
Description
When I call getSymbols() for a date for which there is no data, it throws an error.
Expected behavior
Should return an empty data frame.
Minimal, reproducible example
> library(quantmod)
>
> ## trying to get saturday and sunday data
> a = getSymbols(
'AAPL',
src='yahoo',
from='2023-11-04', # saturday (inclusive)
to='2023-11-06', # monday (exclusive)
auto.assign=FALSE
)
Error in getSymbols.yahoo(Symbols = "AAPL", env = <environment>, verbose = FALSE, :
Unable to import “AAPL”.
attempt to set an attribute on NULL
Session Info
R version 4.3.1 (2023-06-16)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.5
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/Los_Angeles
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dotenv_1.0.3 RPostgres_1.4.6 glue_1.6.2 lubridate_1.9.3 forcats_1.0.0 stringr_1.5.0 dplyr_1.1.3 purrr_1.0.2 readr_2.1.4
[10] tidyr_1.3.0 tibble_3.2.1 ggplot2_3.4.4 tidyverse_2.0.0 quantmod_0.4.25 TTR_0.24.3 xts_0.13.1 zoo_1.8-12
loaded via a namespace (and not attached):
[1] bit_4.0.5 jsonlite_1.8.7 gtable_0.3.4 crayon_1.5.2 compiler_4.3.1 tidyselect_1.2.0 blob_1.2.4 scales_1.2.1
[9] lattice_0.21-8 R6_2.5.1 generics_0.1.3 curl_5.1.0 munsell_0.5.0 DBI_1.1.3 pillar_1.9.0 tzdb_0.4.0
[17] rlang_1.1.1 utf8_1.2.4 stringi_1.7.12 bit64_4.0.5 timechange_0.2.0 cli_3.6.1 withr_2.5.1 magrittr_2.0.3
[25] grid_4.3.1 rstudioapi_0.15.0 hms_1.1.3 lifecycle_1.0.3 vctrs_0.6.4 fansi_1.0.5 colorspace_2.1-0 tools_4.3.1
[33] pkgconfig_2.0.3
Metadata
Assignees
Labels
No labels