我没有对指数数据的市场数据访问权限,但我认为以下应该可行。
reqHistoricalData(tws, twsIndex(symbol = "SPX", exch = "CBOE"))
## waiting for TWS reply on SPX ....failed.
## NULL
## Warning message:
## In errorHandler(con, verbose, OK = c(165, 300, 366, 2104, 2106, :
## Historical Market Data Service error message:No market data permissions for CBOE IND
以下是reqContractDetails
使用与上述类似方法的结果,证明合约对象是由twsIndex
reqContractDetails(tws, twsIndex(symbol = "SPX", exch = "CBOE"))
## [[1]]
## List of 18
## $ version : chr "8"
## $ contract :List of 16
## ..$ conId : chr "416904"
## ..$ symbol : chr "SPX"
## ..$ sectype : chr "IND"
## ..$ exch : chr "CBOE"
## ..$ primary : chr ""
## ..$ expiry : chr ""
## ..$ strike : chr "0"
## ..$ currency : chr "USD"
## ..$ right : chr ""
## ..$ local : chr "SPX"
## ..$ multiplier : chr ""
## ..$ combo_legs_desc: chr ""
## ..$ comboleg : chr ""
## ..$ include_expired: chr ""
## ..$ secIdType : chr ""
## ..$ secId : chr ""
## ..- attr(*, "class")= chr "twsContract"
## $ marketName : chr "SPX"
## $ tradingClass : chr "SPX"
## $ conId : chr "416904"
## $ minTick : chr "0.01"
## $ orderTypes : chr [1:22] "ACTIVETIM" "ADJUST" "ALERT" "ALLOC" ...
## $ validExchanges: chr "CBOE"
## $ priceMagnifier: chr "1"
## $ underConId : chr "0"
## $ longName : chr "S&P 500 Stock Index"
## $ contractMonth : chr ""
## $ industry : chr "Indices"
## $ category : chr "Broad Range Equity Index"
## $ subcategory : chr "*"
## $ timeZoneId : chr "CST"
## $ tradingHours : chr "20130321:0830-1500;20130322:0830-1500"
## $ liquidHours : chr "20130321:0830-1500;20130322:0830-1500"
##