[R-SIG-Finance] Change getSymbols to get most recent data
Vivek Rao
vivekrao4 at yahoo.com
Fri Jul 14 04:53:52 CEST 2017
My previous message was formatted as HTML and became garbled, so here it is as plain text,
which I hope will work.
In the R package quantmod, using getSymbols in the evening used to get prices up to the latest
close, but since Yahoo Finance changed their data service, it only gets data through yesterday.
I suggest that getSymbols make a call to getQuote to see if more recent data can be appended
to the end of the data returned. The script below explains what the problem is. Yahoo Finance
"knows" the OHLCV data of today, but getSymbols does not return it.
At 10:30 PM EST 2017-07-13 the output of
options(warn=-1)
suppressMessages(library("quantmod"))
options("getSymbols.yahoo.warning"=FALSE)
options("getSymbols.warning4.0"=FALSE)
sym <- "SPY"
xx <- getSymbols(sym,auto.assign=FALSE,from="1990-01-01")
print(tail(xx))
last <- getQuote(sym)
print(last)
is
SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted
2017-07-05 242.63 243.01 241.70 242.77 54427600 242.77
2017-07-06 241.89 242.03 240.34 240.55 65400800 240.55
2017-07-07 241.21 242.28 240.56 242.11 57972300 242.11
2017-07-10 242.11 242.80 241.76 242.37 36663300 242.37
2017-07-11 242.37 242.55 240.85 242.19 50354600 242.19
2017-07-12 243.30 244.20 243.30 244.01 59610400 244.01
Trade Time Last Change % Change Open High Low Volume
SPY 2017-07-13 04:00:00 244.42 0.41 +0.17% 244.02 244.55 243.76 39471637
Vivek Rao
Boston, MA
________________________________
From: Vivek Rao via R-SIG-Finance <r-sig-finance at r-project.org>
To: Rsig <r-sig-finance at r-project.org>
Sent: Thursday, July 13, 2017 10:46 PM
Subject: [R-SIG-Finance] Change getSymbols to get most recent data
In the R package quantmod, using getSymbols in the evening used to get prices up to the latestclose, but since Yahoo Finance changed their data service, it only gets data through yesterday.I suggest that getSymbols make a call to getQuote to see if more recent data can be appendedto the end of the data returned. The script below explains what the problem is. Yahoo Finance"knows" the OHLCV data of today, but getSymbols does not return it.
At 10:30 PM EST 2017-07-13 the output of
options(warn=-1)suppressMessages(library("quantmod"))options("getSymbols.yahoo.warning"=FALSE)options("getSymbols.warning4.0"=FALSE)sym <- "SPY"xx <- getSymbols(sym,auto.assign=FALSE,from="1990-01-01")print(tail(xx))last <- getQuote(sym)print(last)
is
SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted2017-07-05 242.63 243.01 241.70 242.77 54427600 242.772017-07-06 241.89 242.03 240.34 240.55 65400800 240.552017-07-07 241.21 242.28 240.56 242.11 57972300 242.112017-07-10 242.11 242.80 241.76 242.37 36663300 242.372017-07-11 242.37 242.55 240.85 242.19 50354600 242.192017-07-12 243.30 244.20 243.30 244.01 59610400 244.01 Trade Time Last Change % Change Open High Low VolumeSPY 2017-07-13 04:00:00 244.42 0.41 +0.17% 244.02 244.55 243.76 39471637
Vivek RaoBoston, MA
[[alternative HTML version deleted]]
_______________________________________________
R-SIG-Finance at 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