Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
Search
How to get real time data for INDEX and FUTURES using TWS API reqMktData()?
Hi,
Normally I use the following format of code to get real-time market data for a Symbol, which works fine: ``` contract = Contract() contract.symbol = sym contract.secType = "STK" contract.currency = "USD" contract.exchange = "SMART" reqMarketDataType(1) reqMktData(x, contract, "", False, False, []) ``` So I want to write a similar code to get real-time data for FUTURES and INDEX. But the problem is, I have a little bit of doubt about how to write the symbol of an INDEX/FUTURES to receive actual data. Because the following code is not working: ``` contract = Contract() contract.symbol = "/ES" contract.secType = "IND" contract.currency = "USD" contract.exchange = "SMART" reqMarketDataType(1) reqMktData(x, contract, "", False, False, []) ``` Does anyone have any idea how to write the code for INDEX/FUTURES to receive real-time data? Thanks - Tareq |
Ted Penner
Is rstudio used for this? On Tue, Mar 1, 2022 at 11:39 PM Tareq Naushad <tareq_ifti@...> wrote: Hi, --
|
Example of the minimum fields to set for a march ZB futures contract: ? ? With lContractInfo ? ? ? ? .symbol = "" ? ? ? ? .secType = "FUT" ? ? ? ? .lastTradeDateOrContractMonth = "" ? ? ? ? .Strike = 0 ? ? ? ? .Right = "" ? ? ? ? .multiplier = "" ? ? ? ? .Exchange = "ECBOT" ? ? ? ? .primaryExchange = "" ? ? ? ? .currency = "USD" ? ? ? ? .localSymbol = "ZB ? MAR 22" ? ? ? ? .conId = 0 ? ? End With You could also set the Symbol = "ZB" and the lastTradeDateOrContractMonth = "202203" instead of the localSymbol El mié, 2 mar 2022 a las 6:39, Tareq Naushad (<tareq_ifti@...>) escribió: Hi, |
to navigate to use esc to dismiss