为什么使用 quantmod 获取开仓交易价格会有延迟
Why is there a delay in getting opening trade price using quantmod
我正在使用 quantmod 软件包进行交易,但在过去的几天里,当我 运行 我的代码在市场开放时间 9:30 美国东部时间上午。大约 10 分钟后,一切正常,我得到了数字,但我怎样才能绕过这个延迟呢?是因为我的代码还是其他原因?
我使用 quantmod 版本 0.4-4.
# rm(list = ls()) # generally considered as bad manner in an MWE
require(quantmod)
options(scipen=999)
spy <- getSymbols(("SPY") , src = 'yahoo', from = '2007-01-01', auto.assign = T)
Warning message:
In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, :
downloaded length 168806 != reported length 200
spy<-cbind(SPY)
q <- getQuote("SPY") # adds the current trade row
qCols <- c("Open","High","Low","Last","Volume","Last")
qx <- xts(q[,qCols], as.Date(q[,"Trade Time"]))
SPY <- rbind(SPY, qx)
Warning messages:
1: In rbind(deparse.level, ...) :
mismatched types: converting objects to numeric
2: In rbind(deparse.level, ...) : NAs introduced by coercion
我正在使用 quantmod 软件包进行交易,但在过去的几天里,当我 运行 我的代码在市场开放时间 9:30 美国东部时间上午。大约 10 分钟后,一切正常,我得到了数字,但我怎样才能绕过这个延迟呢?是因为我的代码还是其他原因? 我使用 quantmod 版本 0.4-4.
# rm(list = ls()) # generally considered as bad manner in an MWE
require(quantmod)
options(scipen=999)
spy <- getSymbols(("SPY") , src = 'yahoo', from = '2007-01-01', auto.assign = T)
Warning message:
In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, :
downloaded length 168806 != reported length 200
spy<-cbind(SPY)
q <- getQuote("SPY") # adds the current trade row
qCols <- c("Open","High","Low","Last","Volume","Last")
qx <- xts(q[,qCols], as.Date(q[,"Trade Time"]))
SPY <- rbind(SPY, qx)
Warning messages:
1: In rbind(deparse.level, ...) :
mismatched types: converting objects to numeric
2: In rbind(deparse.level, ...) : NAs introduced by coercion