joshuaulrich / quantmod

Quantitative Financial Modelling Framework
http://www.quantmod.com/
GNU General Public License v3.0
813 stars 224 forks source link

from = "YYYY-MM-DD", to = "YYYY-MM-DD" in getSymbols() does not work with FRED data #368

Closed doganmehmet closed 1 year ago

doganmehmet commented 1 year ago

Description

getSymbols("DGS2", src = "FRED", start = "2023-01-01") sources data from 1976-06-01 (default). But it works correctly for data sourced from yahoo.

Expected behavior

I expected it will get data from 2023-01-01

Minimal, reproducible example

library(quantmod)
getSymbols("DGS2", src = "FRED", from = "2023-01-05")
first(DGS2)

#                 DGS2
# 1976-06-01      7.26

Session Info

> sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

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

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

other attached packages:
[1] quantmod_0.4.20 TTR_0.24.2      xts_0.12.1      zoo_1.8-9      

loaded via a namespace (and not attached):
 [1] rstudioapi_0.13  magrittr_2.0.1   hms_1.1.2        tidyselect_1.1.1 munsell_0.5.0   
 [6] lattice_0.20-44  colorspace_2.0-2 R6_2.5.0         rlang_1.0.6      fansi_0.5.0     
[11] dplyr_1.0.10     tools_4.1.1      grid_4.1.1       gtable_0.3.0     utf8_1.2.2      
[16] cli_3.5.0        DBI_1.1.3        ellipsis_0.3.2   assertthat_0.2.1 tibble_3.1.8    
[21] lifecycle_1.0.3  tzdb_0.3.0       purrr_0.3.4      readr_2.1.3      ggplot2_3.3.5   
[26] vctrs_0.5.1      curl_4.3.2       glue_1.4.2       compiler_4.1.1   pillar_1.8.1    
[31] generics_0.1.0   scales_1.1.1     pkgconfig_2.0.3 
joshuaulrich commented 1 year ago

Thanks for the report! I'll fix this and it will be in the next release.