Hello, I think I 've already posted this one time before, but does someone know if we can get futures calendar spreads quotes on TWS API( excel )? I am talking about the real exchange calendar spread market and not the combination of expiry( like I think we get using "combo legs" to get quotes ). Should someone from IB answer this? Thanks a lot.
A calendar spread market with a distinct order book from the 2 outright expiry markets. I believe that if you use Combo legs in TWS API to buy a spread, they give you the further expiry ask minus front month bid instead of the "real exchange calendat spread"( LOL ) ask. Capiche?
Hi, I realize this is an old thread but haven't found anything more recent on this. Does anyone know anything about this by any chance? I am looking at trading and getting market data for calendar spreads through the TWS API. Thanks
create a BAG instrument Code: def createBag( conidOne, conidTwo, symbol, exchange='NYMEX'): leg1 = ComboLeg() leg2 = ComboLeg() addAllLegs = [] print "conid in bag %s" % (conidOne) leg1.m_conId = conidOne leg1.m_ratio = 1 leg1.m_action = "BUY" leg1.m_exchange = exchange leg1.m_openClose = 0 leg1.m_shortSaleSlot = 0 leg1.m_designatedLocation = "" leg2.m_conId = conidTwo leg2.m_ratio = 1 leg2.m_action = "SELL" leg2.m_exchange = exchange leg2.m_openClose = 0 leg2.m_shortSaleSlot = 0 leg2.m_designatedLocation = "" addAllLegs.append(leg1) addAllLegs.append(leg2) contract = Contract() contract.m_symbol = "USD" # For combo order use ?USD? as the symbol value all the time contract.m_secType = "BAG" # BAG is the security type for COMBO order contract.m_exchange = exchange contract.m_currency = "USD" contract.m_comboLegs = addAllLegs #including combo order in contract object contract.m_symbol = symbol return contract
Great thanks, will give this a try. Do you know by any chance if it is possible to get market data for this also? I looked in the API and it seems that getting data for BAG is not supported? Although I might be wrong...
I was definitely getting the native spread datas through the excel DDE API. It was really long to gather all the conid ids though...