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 primary order is placed immediately when the algo starts

  • The secondary orders are only placed after the primary order is filled

  • If trigger_in_proportion is true, the other orders are triggered proportionally based on the fill quantity of the primary order. The quantities are rounded down where necessary

    • For example, if primary has quantity 10, and secondary is a single order of quantity 5, then if primary is filled 5 lots and trigger_in_proportion is true, other will fire for 2 lots: (5/10) * 5 = 2.5, rounded down

    • If primary subsequently receives another fill for 5 lots, secondary will fire its remaining 3 lots, and the algo will complete once secondary gets that filled

  • If trigger_in_proportion is false, the other orders are only triggered after the primary order is completely filled

The OTO algo completes when:

  • If primary is OUT and secondary are OUT /cancelled/rejected

  • If primary is rejected or at any point cancelled.

Use Cases

  • Executing a hedging strategy after an initial position is established

  • Implementing conditional order sequences where subsequent orders depend on initial fills

OneTriggersOtherParams

Parameter
Description

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.

Field
Required
Description

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