One Triggers Other (OTO)
An OTO order consists of a primary order and one or more secondary orders that are triggered only after the primary order is filled.
Triggering Behavior
The
primaryorder is placed immediately when the algo startsThe
secondaryorders are only placed after theprimaryorder is filledIf
trigger_in_proportionis true, the other orders are triggered proportionally based on the fill quantity of the primary order. The quantities are rounded down where necessaryFor example, if
primaryhas quantity 10, andsecondaryis a single order of quantity 5, then ifprimaryis filled 5 lots andtrigger_in_proportionis true,otherwill fire for 2 lots: (5/10) * 5 = 2.5, rounded downIf
primarysubsequently receives another fill for 5 lots,secondarywill fire its remaining 3 lots, and the algo will complete oncesecondarygets that filled
If
trigger_in_proportionis false, the other orders are only triggered after the primary order is completely filled
The OTO algo completes when:
If
primaryis OUT andsecondaryare OUT /cancelled/rejectedIf
primaryis rejected or at any point cancelled.
You cannot modify the algo once it is sent, you must cancel and send a new one if you want different parameters. You also cannot pause the algo, it will just cancel when you send a pause.
Use Cases
Executing a hedging strategy after an initial position is established
Implementing conditional order sequences where subsequent orders depend on initial fills
OneTriggersOtherParams
primary (OrderInfo)
Designate your primary order, which is placed immediately upon algo start. See OTOOrderInfo
secondary (List[OrderInfo])
A list of orders (use a singleton list for just one order) that will simultaneously trigger after the primary order is filled (depending on trigger_in_proportion).
trigger_in_proportion (bool)
If true, secondary orders are triggered proportionally based on the fill quantity of the primary order. If false, secondary orders are only placed once the primary order is completely filled.
OTOOrderInfo
OTOOrderInfo is very similar to a PlaceOrderRequest. This contains the order information for each leg of the OTO algo.
symbol
Y
Tradable product
dir
Y
Order side; BUY or SELL
quantity
Y
Order quantity
order_type
Y
Order type
limit_price
N*
Required for certain order types
post_only
N*
Required for certain order types
trigger_price
N*
Required for certain order types
time_in_force
Y
Order time-in-force instruction
execution_venue
Y
Execution venue for the order. Unlike PlaceOrderRequest, this is required
Example
from architect_py import (
OneTriggersOtherParams,
OrderInfo,
OrderDir,
TimeInForce,
OrderType,
)
symbol1 = 'NQ 20251219 CME Future'
symbol2 = 'MNQ 20251219 CME Future'
tp1 = f"{symbol1}/USD"
tp2 = f"{symbol2}/USD"
account = "PAPER:[email protected]"
venue = "CME"
params = OneTriggersOtherParams.new(
primary=OrderInfo.new(
symbol=tp1,
execution_venue=venue,
dir=OrderDir.BUY,
quantity=10,
limit_price=24940,
post_only=False,
time_in_force=TimeInForce.IOC,
order_type=OrderType.LIMIT,
),
secondary= [
OrderInfo.new(
symbol=tp2,
execution_venue=venue,
dir=OrderDir.SELL,
quantity=100,
limit_price=25000,
post_only=False,
time_in_force=TimeInForce.IOC,
order_type=OrderType.LIMIT,
)
],
trigger_in_proportion=True,
)
order = await client.place_algo_order(params=params, account=account)Last updated