私はChi-Xを使用しませんが、例として以下のコードはASXとGlobexの交換に適しています。私はこれが役立つことを願っています
library(IBrokers)
tws = twsConnect()
#ASX
contract <- twsSTK(symbol="BHP",exch="ASX",primary="ASX",currency="AUD")
BHPHistorical <- reqHistoricalData(tws, contract)
BHPRealTime <- reqMktData(tws,contract,snapshot = TRUE)
#SNFE futures data
contract <- twsFuture(symbol="SPI",exch="SNFE",primary="SNFE",currency="AUD",expiry="201712")
SPIHistorical <- reqHistoricalData(tws, contract,barSize="30 mins",duration="1 M")
SPIPRealTime <- reqMktData(tws,contract)
#ASX Options data
#using twsOption hasn't always worked
contract <- twsOption(local="XJOHU9",expiry = "20171116",strike="5750",right="C",exch="ASX",primary="",currency="AUD",symbol="",multiplier = 10,include_expired = FALSE,conId = 0)
OptRealTime <- reqMktData(tws,contract)
OptHistorical <- reqHistoricalData(tws, contract)
contract <- twsContract(0,symbol="AP",sectype="OPT",exch="ASX",primary="ASX",expiry= "20171116",strike="5750",currency="AUD",right="C",local="",multiplier = "10",combo_legs_desc = "",comboleg = "",include_expired = "",secIdType = "",secId = "")
OptRealTime <- reqMktData(tws,contract,snapshot = TRUE)
OptHistorical <- reqHistoricalData(tws, contract)
#USA
contract = twsFuture(symbol="ES",exch="GLOBEX",primary="GLOBEX",currency="USD",expiry="20171215")
ESHistorical = reqHistoricalData(tws, contract)
ESRealTime = reqMktData(tws, contract)