Order Types
Contingent Orders
Contingent orders are sets of orders with related lifecycles. When an order in the set fills or you cancel it, the brokerage triggers, cancels, or resizes the other orders in the set. The brokerage manages the whole set, so a fill and a cancel request can't race each other and leave a position without its exit orders. LEAN supports the following contingency types:
- One Cancels Other (OCO) orders cancel the rest of the set when one of them fills, even partially.
- One Triggers Other (OTO) orders hold the child orders until the parent order completely fills.
- One Updates Other (OUO) orders reduce the remaining quantity of the rest of the set when one of them partially fills.
You can combine these types. For example, a bracket order is an entry order that triggers a take-profit order and a stop-loss order, which cancel each other. The members of a set can be combo orders.
Bracket Orders
BracketOrderself.bracket_order
One Cancels Other Orders
OneCancelsOtherOrderself.one_cancels_other_order
One Triggers Other Orders
OneTriggersOtherOrderself.one_triggers_other_order
One Updates Other Orders
OneUpdatesOtherOrderself.one_updates_other_order
Custom Contingent Orders
OrderFactoryself.order_factory