[R-SIG-Finance] Error with getSymbols('SP500', from = "2020-01-01", to = "2021-06-30", src='FRED') SP500<-na.locf(SP500, na.rm = TRUE)
Frank
|r@nkm60606 @end|ng |rom gm@||@com
Mon Nov 7 22:20:00 CET 2022
I run the program from a batch file with this command:
"C:\Program Files\R\R-4.2.2\bin\x64\R.exe" CMD BATCH "C:\Users\Frank\Documents\R\Projects\S&P_500_FRED\S&P_500.txt" "C:\Users\Frank\Documents\R\Projects\S&P_500_FRED\S&P_500.out"
The session info is:
R version 4.2.2 (2022-10-31 ucrt) -- "Innocent and Trusting"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
[Previously saved workspace restored]
> library(quantmod)
Loading required package: xts
Loading required package: zoo
Attaching package: 'zoo'
The following objects are masked from 'package:base':
as.Date, as.Date.numeric
Loading required package: TTR
Registered S3 method overwritten by 'quantmod':
method from
as.zoo.data.frame zoo
> library(chron)
> sessionInfo()
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] 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] chron_2.3-58 quantmod_0.4.20 TTR_0.24.3 xts_0.12.2
[5] zoo_1.8-11
loaded via a namespace (and not attached):
[1] compiler_4.2.2 curl_4.3.3 grid_4.2.2 lattice_0.20-45
>
>
-----Original Message-----
From: Frank
Sent: Monday, November 07, 2022 12:19 PM
To: 'Daniel Cegiełka' <daniel.cegielka using gmail.com>; 'Joshua Ulrich' <josh.m.ulrich using gmail.com>
Cc: 'r-sig-finance using r-project.org' <r-sig-finance using r-project.org>
Subject: RE: [R-SIG-Finance] Error with getSymbols('SP500', from = "2020-01-01", to = "2021-06-30", src='FRED') SP500<-na.locf(SP500, na.rm = TRUE)
I upgraded to R 4.2.2. I also installed quantmod, TTR, chron and a few other packages. I'm getting the same
Error in getSymbols.FRED(Symbols = "SP500", env = <environment>, verbose = FALSE, :
Unable to import "SP500".
schannel: next InitializeSecurityContext failed: SEC_E_ILLEGAL_MESSAGE (0x80090326) - This error usually occurs when a fatal SSL/TLS alert is received (e.g. handshake failed).
Calls: getSymbols -> do.call -> getSymbols.FRED Execution halted
Error message. I was running code last week that had been upgraded for the switch from http: to https: on FRED. Probably r 4.0.5.
Thanks,
Frank
Chicago
-----Original Message-----
From: Daniel Cegiełka
Sent: Monday, November 07, 2022 10:45 AM
To: Joshua Ulrich <josh.m.ulrich using gmail.com>
Cc: Frank <frankm60606 using gmail.com>; r-sig-finance using r-project.org
Subject: Re: [R-SIG-Finance] Error with getSymbols('SP500', from = "2020-01-01", to = "2021-06-30", src='FRED') SP500<-na.locf(SP500, na.rm = TRUE)
Hi Josh,
schannel: next InitializeSecurityContext failed: SEC_E_ILLEGAL_MESSAGE
(0x80090326) - This error usually occurs when a fatal SSL/TLS alert is received (e.g. handshake failed).
This looks like a problem (not a bug in getSymbols) with the TLS cipher suites. Try direct curl/libcurl. I think you will get the same error.
Best,
Daniel
pon., 7 lis 2022 o 17:33 Joshua Ulrich <josh.m.ulrich using gmail.com> napisał(a):
>
> Hi Frank,
>
> These both work for me in R-4.2.1 and quantmod 0.4.20. It looks like
> you're using quantmod <= 0.4.18.
>
> What R version are you using? At minimum, you should reinstall the
> packages that were built in R-3.5.3 in March-2019.
>
> Best,
> Josh
>
> On Mon, Nov 7, 2022 at 10:26 AM Frank <frankm60606 using gmail.com> wrote:
> >
> > In running:
> >
> >
> > ##
> > ## Get S&P_500 from FRED
> > ##
> >
> > getSymbols('SP500', from = "2020-01-01", to =
> > "2021-06-30",src='FRED') SP500<-na.locf(SP500,na.rm = TRUE)
> > tail(SP500)
> > file_name <- "SP500.csv"
> > write.zoo(SP500, file = file_name, append = FALSE, quote = TRUE, sep
> > = ",")
> > quit()
> >
> > I get:
> >
> > > library(quantmod)
> > Loading required package: xts
> > Loading required package: zoo
> >
> > Attaching package: 'zoo'
> >
> > The following objects are masked from 'package:base':
> >
> > as.Date, as.Date.numeric
> >
> > Loading required package: TTR
> > Warning messages:
> > 1: package 'xts' was built under R version 3.5.3
> > 2: package 'zoo' was built under R version 3.5.3
> > 3: package 'TTR' was built under R version 3.5.3
> > > library(chron)
> > NOTE: The default cutoff when expanding a 2-digit year to a 4-digit
> > year will change from 30 to 69 by Aug 2020 (as for Date and POSIXct
> > in base R.) Warning message:
> > package 'chron' was built under R version 3.5.3
> > >
> > >
> > > ##
> > > ## Get S&P_500 from FRED
> > > ##
> > >
> > > getSymbols('SP500', from = "2020-01-01", to =
> > > "2021-06-30",src='FRED')
> > 'getSymbols' currently uses auto.assign=TRUE by default, but will
> > use auto.assign=FALSE in 0.5-0. You will still be able to use
> > 'loadSymbols' to automatically load data.
> > getOption("getSymbols.env") and
> > getOption("getSymbols.auto.assign") will still be checked for
> > alternate defaults.
> >
> > This message is shown once per session and may be disabled by
> > setting options("getSymbols.warning4.0"=FALSE). See ?getSymbols for details.
> >
> > Error in getSymbols.FRED(Symbols = "SP500", env = <environment>,
> > verbose = FALSE, :
> > Unable to import "SP500".
> > schannel: next InitializeSecurityContext failed:
> > SEC_E_ILLEGAL_MESSAGE
> > (0x80090326) - This error usually occurs when a fatal SSL/TLS alert
> > is received (e.g. handshake failed).
> > Calls: getSymbols -> do.call -> getSymbols.FRED Execution halted
> >
> > I got correct data as recently as
> >
> > 11/2/2022 44867 3759.69 3759.69 3759.69 3759.69 3759.69 3759.69
> >
> > Similar thing with getSymbols('DGS3MO',src='FRED').
> >
> > They both download correctly directly from FRED.
> >
> > Thanks,
> >
> > Frank
> > Chicago
> >
> > _______________________________________________
> > R-SIG-Finance using r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> > -- Subscriber-posting only. If you want to post, subscribe first.
> > -- Also note that this is not the r-help list where general R questions should go.
>
>
>
> --
> Joshua Ulrich | about.me/joshuaulrich FOSS Trading |
> www.fosstrading.com
>
> _______________________________________________
> R-SIG-Finance using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
More information about the R-SIG-Finance
mailing list