Smart-Routed Futures Spread

View as MarkdownOpen in Claude

Futures spreads can also be defined as Smart-routed (non-guaranteed) combos. When placing an order for a non-guaranteed combo from the API, the non-guaranteed flag must be set to 1. Historical data for smart-routed futures spreads is generally available from the API with the requisite market data subscriptions.

1contract = Contract()
2contract.symbol = "WTI" # WTI,COIL spread. Symbol can be defined as first leg symbol ("WTI") or currency ("USD")
3contract.secType = "BAG"
4contract.currency = "USD"
5contract.exchange = "SMART"
6
7leg1 = ComboLeg()
8leg1.conId = 55928698 # WTI future June 2017
9leg1.ratio = 1
10leg1.action = "BUY"
11leg1.exchange = "IPE"
12
13leg2 = ComboLeg()
14leg2.conId = 55850663 # COIL future June 2017
15leg2.ratio = 1
16leg2.action = "SELL"
17leg2.exchange = "IPE"
18
19contract.comboLegs = []
20contract.comboLegs.append(leg1)
21contract.comboLegs.append(leg2)