Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 正确使用lappy_R_Lapply_Ibrokers_Tws - Fatal编程技术网

R 正确使用lappy

R 正确使用lappy,r,lapply,ibrokers,tws,R,Lapply,Ibrokers,Tws,我正在使用TWS API,但它不适合我。我让它接近我想做的事情,但我一直在努力找出如何正确使用lappy函数 以下是我目前要做的工作: library("IBrokers") tws <- twsConnect() tickers <- c("AAPL","YHOO") reqMktData(tws, lapply(tickers, twsSTK), tickGenerics="", snapshot=T) twsDisconnect(tws) library(“IBrokers”

我正在使用TWS API,但它不适合我。我让它接近我想做的事情,但我一直在努力找出如何正确使用lappy函数

以下是我目前要做的工作:

library("IBrokers")
tws <- twsConnect()
tickers <- c("AAPL","YHOO")
reqMktData(tws, lapply(tickers, twsSTK), tickGenerics="", snapshot=T)
twsDisconnect(tws)
library(“IBrokers”)

tws我错误地阅读了Lappy上的文档。有关我的解决方案,请参阅附件

library("IBrokers")
tws <- twsConnect()
tickers <- c("AAPL","YHOO","MSFT","GLD")
reqMktData(tws, lapply(tickers, twsSTK, exch = "ISLAND", currency = "USD"), tickGenerics="", snapshot=T)
twsDisconnect(tws)
library(“IBrokers”)
tws
library("IBrokers")
tws <- twsConnect()
tickers <- c("AAPL","YHOO","MSFT","GLD")
reqMktData(tws, lapply(tickers, twsSTK, exch = "ISLAND", currency = "USD"), tickGenerics="", snapshot=T)
twsDisconnect(tws)