Combo Limit with Price per Leg

View as MarkdownOpen in Claude

Create combination orders that include options, stock and futures legs (stock legs can be included if the order is routed through SmartRouting). Although a combination/spread order is constructed of separate legs, it is executed as a single transaction if it is routed directly to an exchange. For combination orders that are SmartRouted, each leg may be executed separately to ensure best execution.

Products: OPT, STK, FUT

1order = Order()
2order.action = action
3order.orderType = "LMT"
4order.totalQuantity = quantity
5order.orderComboLegs = []
6
7for price in legPrices:
8 comboLeg = OrderComboLeg()
9 comboLeg.price = price
10 order.orderComboLegs.append(comboLeg)
11
12if nonGuaranteed:
13 order.smartComboRoutingParams = []
14 order.smartComboRoutingParams.append(TagValue("NonGuaranteed", "1"))