Orders¶
Provides a full range of standard order types, as well as more advanced types and order lists.
- class LimitIfTouchedOrder¶
Bases:
OrderLimitIfTouchedOrder(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, OrderSide order_side, Quantity quantity, Price price, Price trigger_price, TriggerType trigger_type, UUID4 init_id, uint64_t ts_init, TimeInForce time_in_force=TimeInForce.GTC, uint64_t expire_time_ns=0, bool post_only=False, bool reduce_only=False, bool quote_quantity=False, Quantity display_qty=None, TriggerType emulation_trigger=TriggerType.NO_TRIGGER, InstrumentId trigger_instrument_id=None, ContingencyType contingency_type=ContingencyType.NO_CONTINGENCY, OrderListId order_list_id=None, list linked_order_ids=None, ClientOrderId parent_order_id=None, ExecAlgorithmId exec_algorithm_id=None, dict exec_algorithm_params=None, ClientOrderId exec_spawn_id=None, list tags=None)
Represents a Limit-If-Touched (LIT) conditional order.
A Limit-If-Touched (LIT) is an order to BUY (or SELL) an instrument at a specified price or better, below (or above) the market. This order is held in the system until the trigger price is touched. A LIT order is similar to a Stop-Limit order, except that a LIT SELL order is placed above the current market price, and a Stop-Limit SELL order is placed below.
Using a LIT order helps to ensure that, if the order does execute, the order will not execute at a price less favorable than the limit price.
- Parameters:
trader_id (TraderId) – The trader ID associated with the order.
strategy_id (StrategyId) – The strategy ID associated with the order.
instrument_id (InstrumentId) – The order instrument ID.
client_order_id (ClientOrderId) – The client order ID.
order_side (OrderSide {
BUY,SELL}) – The order side.quantity (Quantity) – The order quantity (> 0).
price (Price) – The order price (LIMIT).
trigger_price (Price) – The order trigger price (STOP).
trigger_type (TriggerType) – The order trigger type.
init_id (UUID4) – The order initialization event ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
time_in_force (TimeInForce {
GTC,IOC,FOK,GTD,DAY}, defaultGTC) – The order time in force.expire_time_ns (uint64_t, default 0 (no expiry)) – UNIX timestamp (nanoseconds) when the order will expire.
post_only (bool, default False) – If the
LIMITorder will only provide liquidity (once triggered).reduce_only (bool, default False) – If the
LIMITorder carries the ‘reduce-only’ execution instruction.quote_quantity (bool, default False) – If the order quantity is denominated in the quote currency.
display_qty (Quantity, optional) – The quantity of the
LIMITorder to display on the public book (iceberg).emulation_trigger (TriggerType, default
NO_TRIGGER) – The type of market price trigger to use for local order emulation. -NO_TRIGGER(default): Disables local emulation; orders are sent directly to the venue. -DEFAULT(the same asBID_ASK): Enables local order emulation by triggering orders based on bid/ask prices. Additional trigger types are available. See the “Emulated Orders” section in the documentation for more details.trigger_instrument_id (InstrumentId, optional) – The emulation trigger instrument ID for the order (if
Nonethen will be the instrument_id).contingency_type (ContingencyType, default
NO_CONTINGENCY) – The order contingency type.order_list_id (OrderListId, optional) – The order list ID associated with the order.
linked_order_ids (list[ClientOrderId], optional) – The order linked client order ID(s).
parent_order_id (ClientOrderId, optional) – The order parent client order ID.
exec_algorithm_id (ExecAlgorithmId, optional) – The execution algorithm ID for the order.
exec_algorithm_params (dict[str, Any], optional) – The execution algorithm parameters for the order.
exec_spawn_id (ClientOrderId, optional) – The execution algorithm spawning primary client order ID.
tags (list[str], optional) – The custom user tags for the order.
- Raises:
ValueError – If order_side is
NO_ORDER_SIDE.ValueError – If quantity is not positive (> 0).
ValueError – If trigger_type is
NO_TRIGGER.ValueError – If time_in_force is
AT_THE_OPENorAT_THE_CLOSE.ValueError – If time_in_force is
GTDand expire_time_ns <= UNIX epoch.ValueError – If display_qty is negative (< 0) or greater than quantity.
- static create(init)¶
- display_qty¶
The quantity of the
LIMITorder to display on the public book (iceberg).- Returns:
Quantity or
None
- expire_time¶
Return the expire time for the order (UTC).
- Return type:
datetime or
None
- expire_time_ns¶
The order expiration (UNIX epoch nanoseconds), zero for no expiration.
- Returns:
uint64_t
- info(self) str¶
Return a summary description of the order.
- Return type:
str
- is_triggered¶
If the order has been triggered.
- Returns:
bool
- price¶
The order price (LIMIT).
- Returns:
Price
- to_dict(self) dict¶
Return a dictionary representation of this object.
- Return type:
dict[str, object]
- trigger_price¶
The order trigger price (STOP).
- Returns:
Price
- trigger_type¶
The trigger type for the order.
- Returns:
TriggerType
- ts_triggered¶
UNIX timestamp (nanoseconds) when the order was triggered (0 if not triggered).
- Returns:
uint64_t
- class LimitOrder¶
Bases:
OrderLimitOrder(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, OrderSide order_side, Quantity quantity, Price price, UUID4 init_id, uint64_t ts_init, TimeInForce time_in_force=TimeInForce.GTC, uint64_t expire_time_ns=0, bool post_only=False, bool reduce_only=False, bool quote_quantity=False, Quantity display_qty=None, TriggerType emulation_trigger=TriggerType.NO_TRIGGER, InstrumentId trigger_instrument_id=None, ContingencyType contingency_type=ContingencyType.NO_CONTINGENCY, OrderListId order_list_id=None, list linked_order_ids=None, ClientOrderId parent_order_id=None, ExecAlgorithmId exec_algorithm_id=None, dict exec_algorithm_params=None, ClientOrderId exec_spawn_id=None, list tags=None)
Represents a Limit order.
A Limit order is an order to BUY (or SELL) at a specified price or better. The Limit order ensures that if the order fills, it will not fill at a price less favorable than your limit price, but it does not guarantee a fill.
A Limit-On-Open (LOO) order can be represented using a time in force of
AT_THE_OPEN.A Limit-On-Close (LOC) order can be represented using a time in force of
AT_THE_CLOSE.
- Parameters:
trader_id (TraderId) – The trader ID associated with the order.
strategy_id (StrategyId) – The strategy ID associated with the order.
instrument_id (InstrumentId) – The order instrument ID.
client_order_id (ClientOrderId) – The client order ID.
order_side (OrderSide {
BUY,SELL}) – The order side.quantity (Quantity) – The order quantity (> 0).
price (Price) – The order limit price.
init_id (UUID4) – The order initialization event ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
time_in_force (TimeInForce {
GTC,IOC,FOK,GTD,DAY,AT_THE_OPEN,AT_THE_CLOSE}, defaultGTC) – The order time in force.expire_time_ns (uint64_t, default 0 (no expiry)) – UNIX timestamp (nanoseconds) when the order will expire.
post_only (bool, default False) – If the order will only provide liquidity (make a market).
reduce_only (bool, default False) – If the order carries the ‘reduce-only’ execution instruction.
quote_quantity (bool, default False) – If the order quantity is denominated in the quote currency.
display_qty (Quantity, optional) – The quantity of the order to display on the public book (iceberg).
emulation_trigger (TriggerType, default
NO_TRIGGER) – The type of market price trigger to use for local order emulation. -NO_TRIGGER(default): Disables local emulation; orders are sent directly to the venue. -DEFAULT(the same asBID_ASK): Enables local order emulation by triggering orders based on bid/ask prices. Additional trigger types are available. See the “Emulated Orders” section in the documentation for more details.trigger_instrument_id (InstrumentId, optional) – The emulation trigger instrument ID for the order (if
Nonethen will be the instrument_id).contingency_type (ContingencyType, default
NO_CONTINGENCY) – The order contingency type.order_list_id (OrderListId, optional) – The order list ID associated with the order.
linked_order_ids (list[ClientOrderId], optional) – The order linked client order ID(s).
parent_order_id (ClientOrderId, optional) – The order parent client order ID.
exec_algorithm_id (ExecAlgorithmId, optional) – The execution algorithm ID for the order.
exec_algorithm_params (dict[str, Any], optional) – The execution algorithm parameters for the order.
exec_spawn_id (ClientOrderId, optional) – The execution algorithm spawning primary client order ID.
tags (list[str], optional) – The custom user tags for the order.
- Raises:
ValueError – If order_side is
NO_ORDER_SIDE.ValueError – If quantity is not positive (> 0).
ValueError – If time_in_force is
GTDand expire_time_ns <= UNIX epoch.ValueError – If display_qty is negative (< 0) or greater than quantity.
- static create(OrderInitialized init)¶
- display_qty¶
The quantity of the order to display on the public book (iceberg).
- Returns:
Quantity or
None
- expire_time¶
Return the expire time for the order (UTC).
- Return type:
datetime or
None
- expire_time_ns¶
The order expiration (UNIX epoch nanoseconds), zero for no expiration.
- Returns:
uint64_t
- static from_pyo3(pyo3_order)¶
- info(self) str¶
Return a summary description of the order.
- Return type:
str
- price¶
The order price (LIMIT).
- Returns:
Price
- to_dict(self) dict¶
Return a dictionary representation of this object.
- Return type:
dict[str, object]
- static transform_py(Order order, uint64_t ts_init, Price price=None) LimitOrder¶
- class MarketIfTouchedOrder¶
Bases:
OrderMarketIfTouchedOrder(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, OrderSide order_side, Quantity quantity, Price trigger_price, TriggerType trigger_type, UUID4 init_id, uint64_t ts_init, TimeInForce time_in_force=TimeInForce.GTC, uint64_t expire_time_ns=0, bool reduce_only=False, bool quote_quantity=False, TriggerType emulation_trigger=TriggerType.NO_TRIGGER, InstrumentId trigger_instrument_id=None, ContingencyType contingency_type=ContingencyType.NO_CONTINGENCY, OrderListId order_list_id=None, list linked_order_ids=None, ClientOrderId parent_order_id=None, ExecAlgorithmId exec_algorithm_id=None, dict exec_algorithm_params=None, ClientOrderId exec_spawn_id=None, list tags=None)
Represents a Market-If-Touched (MIT) conditional order.
A Market-If-Touched (MIT) is an order to BUY (or SELL) an instrument below (or above) the market. This order is held in the system until the trigger price is touched, and is then submitted as a market order. An MIT order is similar to a Stop-Order, except that an MIT SELL order is placed above the current market price, and a stop SELL order is placed below.
- Parameters:
trader_id (TraderId) – The trader ID associated with the order.
strategy_id (StrategyId) – The strategy ID associated with the order.
instrument_id (InstrumentId) – The order instrument ID.
client_order_id (ClientOrderId) – The client order ID.
order_side (OrderSide {
BUY,SELL}) – The order side.quantity (Quantity) – The order quantity (> 0).
trigger_price (Price) – The order trigger price (STOP).
trigger_type (TriggerType) – The order trigger type.
init_id (UUID4) – The order initialization event ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
time_in_force (TimeInForce {
GTC,IOC,FOK,GTD,DAY}, defaultGTC) – The order time in force.expire_time_ns (uint64_t, default 0 (no expiry)) – UNIX timestamp (nanoseconds) when the order will expire.
reduce_only (bool, default False) – If the order carries the ‘reduce-only’ execution instruction.
quote_quantity (bool, default False) – If the order quantity is denominated in the quote currency.
emulation_trigger (TriggerType, default
NO_TRIGGER) – The type of market price trigger to use for local order emulation. -NO_TRIGGER(default): Disables local emulation; orders are sent directly to the venue. -DEFAULT(the same asBID_ASK): Enables local order emulation by triggering orders based on bid/ask prices. Additional trigger types are available. See the “Emulated Orders” section in the documentation for more details.trigger_instrument_id (InstrumentId, optional) – The emulation trigger instrument ID for the order (if
Nonethen will be the instrument_id).contingency_type (ContingencyType, default
NO_CONTINGENCY) – The order contingency type.order_list_id (OrderListId, optional) – The order list ID associated with the order.
linked_order_ids (list[ClientOrderId], optional) – The order linked client order ID(s).
parent_order_id (ClientOrderId, optional) – The order parent client order ID.
exec_algorithm_id (ExecAlgorithmId, optional) – The execution algorithm ID for the order.
exec_algorithm_params (dict[str, Any], optional) – The execution algorithm parameters for the order.
exec_spawn_id (ClientOrderId, optional) – The execution algorithm spawning primary client order ID.
tags (list[str], optional) – The custom user tags for the order.
- Raises:
ValueError – If order_side is
NO_ORDER_SIDE.ValueError – If quantity is not positive (> 0).
ValueError – If trigger_type is
NO_TRIGGER.ValueError – If time_in_force is
AT_THE_OPENorAT_THE_CLOSE.ValueError – If time_in_force is
GTDand expire_time_ns <= UNIX epoch.
- static create(init)¶
- expire_time¶
Return the expire time for the order (UTC).
- Return type:
datetime or
None
- expire_time_ns¶
The order expiration (UNIX epoch nanoseconds), zero for no expiration.
- Returns:
uint64_t
- info(self) str¶
Return a summary description of the order.
- Return type:
str
- to_dict(self) dict¶
Return a dictionary representation of this object.
- Return type:
dict[str, object]
- trigger_price¶
The order trigger price (STOP).
- Returns:
Price
- trigger_type¶
The trigger type for the order.
- Returns:
TriggerType
- class MarketOrder¶
Bases:
OrderMarketOrder(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, OrderSide order_side, Quantity quantity, UUID4 init_id, uint64_t ts_init, TimeInForce time_in_force=TimeInForce.GTC, bool reduce_only=False, bool quote_quantity=False, ContingencyType contingency_type=ContingencyType.NO_CONTINGENCY, OrderListId order_list_id=None, list linked_order_ids=None, ClientOrderId parent_order_id=None, ExecAlgorithmId exec_algorithm_id=None, dict exec_algorithm_params=None, ClientOrderId exec_spawn_id=None, list tags=None)
Represents a Market order.
A Market order is an order to BUY (or SELL) at the market bid or offer price. A market order may increase the likelihood of a fill and the speed of execution, but unlike the Limit order - a Market order provides no price protection and may fill at a price far lower/higher than the top-of-book bid/ask.
A Market-On-Open (MOO) order can be represented using a time in force of
AT_THE_OPEN.A Market-On-Close (MOC) order can be represented using a time in force of
AT_THE_CLOSE.
- Parameters:
trader_id (TraderId) – The trader ID associated with the order.
strategy_id (StrategyId) – The strategy ID associated with the order.
instrument_id (InstrumentId) – The order instrument ID.
client_order_id (ClientOrderId) – The client order ID.
order_side (OrderSide {
BUY,SELL}) – The order side.quantity (Quantity) – The order quantity (> 0).
init_id (UUID4) – The order initialization event ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
time_in_force (TimeInForce {
GTC,IOC,FOK,DAY,AT_THE_OPEN,AT_THE_CLOSE}, defaultGTC) – The order time in force.reduce_only (bool, default False) – If the order carries the ‘reduce-only’ execution instruction.
quote_quantity (bool, default False) – If the order quantity is denominated in the quote currency.
contingency_type (ContingencyType, default
NO_CONTINGENCY) – The order contingency type.order_list_id (OrderListId, optional) – The order list ID associated with the order.
linked_order_ids (list[ClientOrderId], optional) – The order linked client order ID(s).
parent_order_id (ClientOrderId, optional) – The order parent client order ID.
exec_algorithm_id (ExecAlgorithmId, optional) – The execution algorithm ID for the order.
exec_algorithm_params (dict[str, Any], optional) – The execution algorithm parameters for the order.
exec_spawn_id (ClientOrderId, optional) – The execution algorithm spawning primary client order ID.
tags (list[str], optional) – The custom user tags for the order.
- Raises:
ValueError – If order_side is
NO_ORDER_SIDE.ValueError – If quantity is not positive (> 0).
ValueError – If time_in_force is
GTD.
- static create(init)¶
- static from_pyo3(pyo3_order)¶
- info(self) str¶
Return a summary description of the order.
- Return type:
str
- to_dict(self) dict¶
Return a dictionary representation of this object.
- Return type:
dict[str, object]
- static transform_py(Order order, uint64_t ts_init) MarketOrder¶
- class MarketToLimitOrder¶
Bases:
OrderMarketToLimitOrder(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, OrderSide order_side, Quantity quantity, UUID4 init_id, uint64_t ts_init, TimeInForce time_in_force=TimeInForce.GTC, uint64_t expire_time_ns=0, bool reduce_only=False, bool quote_quantity=False, Quantity display_qty=None, ContingencyType contingency_type=ContingencyType.NO_CONTINGENCY, OrderListId order_list_id=None, list linked_order_ids=None, ClientOrderId parent_order_id=None, ExecAlgorithmId exec_algorithm_id=None, dict exec_algorithm_params=None, ClientOrderId exec_spawn_id=None, list tags=None)
Represents a Market-To-Limit (MTL) order.
A Market-to-Limit (MTL) order is submitted as a market order to execute at the current best market price. If the order is only partially filled, the remainder of the order is canceled and re-submitted as a Limit order with the limit price equal to the price at which the filled portion of the order executed.
- Parameters:
trader_id (TraderId) – The trader ID associated with the order.
strategy_id (StrategyId) – The strategy ID associated with the order.
instrument_id (InstrumentId) – The order instrument ID.
client_order_id (ClientOrderId) – The client order ID.
order_side (OrderSide {
BUY,SELL}) – The order side.quantity (Quantity) – The order quantity (> 0).
init_id (UUID4) – The order initialization event ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
time_in_force (TimeInForce {
GTC,IOC,FOK,GTD,DAY}, defaultGTC) – The order time in force.expire_time_ns (uint64_t, default 0 (no expiry)) – UNIX timestamp (nanoseconds) when the order will expire.
reduce_only (bool, default False) – If the order carries the ‘reduce-only’ execution instruction.
quote_quantity (bool, default False) – If the order quantity is denominated in the quote currency.
display_qty (Quantity, optional) – The quantity of the limit order to display on the public book (iceberg).
contingency_type (ContingencyType, default
NO_CONTINGENCY) – The order contingency type.order_list_id (OrderListId, optional) – The order list ID associated with the order.
linked_order_ids (list[ClientOrderId], optional) – The order linked client order ID(s).
parent_order_id (ClientOrderId, optional) – The order parent client order ID.
exec_algorithm_id (ExecAlgorithmId, optional) – The execution algorithm ID for the order.
exec_algorithm_params (dict[str, Any], optional) – The execution algorithm parameters for the order.
exec_spawn_id (ClientOrderId, optional) – The execution algorithm spawning primary client order ID.
tags (list[str], optional) – The custom user tags for the order.
- Raises:
ValueError – If order_side is
NO_ORDER_SIDE.ValueError – If quantity is not positive (> 0).
ValueError – If time_in_force is
AT_THE_OPENorAT_THE_CLOSE.
- static create(init)¶
- display_qty¶
The quantity of the limit order to display on the public book (iceberg).
- Returns:
Quantity or
None
- expire_time¶
Return the expire time for the order (UTC).
- Return type:
datetime or
None
- expire_time_ns¶
The order expiration (UNIX epoch nanoseconds), zero for no expiration.
- Returns:
uint64_t
- info(self) str¶
Return a summary description of the order.
- Return type:
str
- price¶
The order price (LIMIT).
- Returns:
Price or
None
- to_dict(self) dict¶
Return a dictionary representation of this object.
- Return type:
dict[str, object]
- class Order¶
Bases:
objectOrder(OrderInitialized init)
The base class for all orders.
- Parameters:
init (OrderInitialized) – The order initialized event.
Warning
This class should not be used directly, but through a concrete subclass.
- account_id¶
The account ID associated with the order.
- Returns:
AccountId or
None
- apply(self, OrderEvent event) void¶
Apply the given order event to the order.
- Parameters:
event (OrderEvent) – The order event to apply.
- Raises:
ValueError – If self.client_order_id is not equal to event.client_order_id.
ValueError – If self.venue_order_id and event.venue_order_id are both not
None, and are not equal.InvalidStateTrigger – If event is not a valid trigger from the current order.status.
KeyError – If event is OrderFilled and event.trade_id already applied to the order.
- avg_px¶
The order average fill price.
- Returns:
double
- client_order_id¶
The client order ID.
- Returns:
ClientOrderId
- static closing_side(PositionSide position_side) OrderSide¶
Return the order side needed to close a position with the given side.
- Parameters:
position_side (PositionSide {
LONG,SHORT}) – The side of the position to close.- Return type:
OrderSide
- Raises:
ValueError – If position_side is
FLATor invalid.
- commissions(self) list¶
Return the total commissions generated by the order.
- Return type:
list[Money]
- contingency_type¶
The orders contingency type.
- Returns:
ContingencyType
- emulation_trigger¶
The order emulation trigger type.
- Returns:
TriggerType
- event_count¶
Return the count of events applied to the order.
- Return type:
int
- events¶
Return the order events.
- Return type:
list[OrderEvent]
- exec_algorithm_id¶
The execution algorithm ID for the order.
- Returns:
ExecAlgorithmId or
None
- exec_algorithm_params¶
The execution algorithm parameters for the order.
- Returns:
dict[str, Any] or
None
- exec_spawn_id¶
The execution algorithm spawning client order ID.
- Returns:
ClientOrderId or
None
- filled_qty¶
The order total filled quantity.
- Returns:
Quantity
- has_activation_price¶
Return whether the order has a activation_price property.
- Return type:
bool
- has_price¶
Return whether the order has a price property.
- Return type:
bool
- has_trigger_price¶
Return whether the order has a trigger_price property.
- Return type:
bool
- info(self) str¶
Return a summary description of the order.
- Return type:
str
- init_event¶
Return the initialization event for the order.
- Return type:
- init_id¶
The event ID of the OrderInitialized event.
- Returns:
UUID4
- instrument_id¶
The order instrument ID.
- Returns:
InstrumentId
- is_active_local¶
Return whether the order is active and held in the local system.
An order is considered active local when its status is any of: -
INITIALIZED-EMULATED-RELEASED- Return type:
bool
- is_aggressive¶
Return whether the order is aggressive (order_type is
MARKET).- Return type:
bool
- is_buy¶
Return whether the order side is
BUY.- Return type:
bool
- is_canceled¶
Return whether current status is
CANCELED.- Return type:
bool
- is_child_order¶
Return whether the order has a parent order.
- Return type:
bool
- is_closed¶
Return whether the order is closed (lifecycle completed).
An order is considered closed when its status can no longer change. The possible statuses of closed orders include;
DENIEDREJECTEDCANCELEDEXPIREDFILLED
- Return type:
bool
- is_contingency¶
Return whether the order has a contingency (contingency_type is not
NO_CONTINGENCY).- Return type:
bool
- is_duplicate_fill(self, OrderFilled fill) bool¶
Return whether a fill with matching trade_id, side, qty, and price already exists.
- Parameters:
fill (OrderFilled) – The fill event to check.
- Return type:
bool
- is_emulated¶
Return whether the order is emulated and held in the local system.
- Return type:
bool
- is_inflight¶
Return whether the order is in-flight (order request sent to the trading venue).
An order is considered in-flight when its status is any of: -
SUBMITTED-PENDING_UPDATE-PENDING_CANCEL- Return type:
bool
Warning
An emulated order is never considered in-flight.
- is_open¶
Return whether the order is open at the trading venue.
An order is considered open when its status is any of: -
ACCEPTED-TRIGGERED-PENDING_UPDATE-PENDING_CANCEL-PARTIALLY_FILLED- Return type:
bool
Warning
An emulated order is never considered open.
- is_parent_order¶
Return whether the order has at least one child order.
- Return type:
bool
- is_passive¶
Return whether the order is passive (order_type not
MARKET).- Return type:
bool
- is_pending_cancel¶
Return whether the current status is
PENDING_CANCEL.- Return type:
bool
- is_pending_update¶
Return whether the current status is
PENDING_UPDATE.- Return type:
bool
- is_post_only¶
If the order will only provide liquidity (make a market).
- Returns:
bool
- is_primary¶
Return whether the order is the primary for an execution algorithm sequence.
- Return type:
bool
- is_quote_quantity¶
If the order quantity is denominated in the quote currency.
- Returns:
bool
- is_reduce_only¶
If the order carries the ‘reduce-only’ execution instruction.
- Returns:
bool
- is_sell¶
Return whether the order side is
SELL.- Return type:
bool
- is_spawned¶
Return whether the order was spawned as part of an execution algorithm sequence.
- Return type:
bool
- last_event¶
Return the last event applied to the order.
- Return type:
- last_trade_id¶
The orders last trade match ID.
- Returns:
TradeId or
None
- leaves_qty¶
The order total leaves quantity.
- Returns:
Quantity
- linked_order_ids¶
The orders linked client order ID(s).
- Returns:
list[ClientOrderId] or
None
- liquidity_side¶
The order liquidity side.
- Returns:
LiquiditySide
- static opposite_side(OrderSide side) OrderSide¶
Return the opposite order side from the given side.
- Parameters:
side (OrderSide {
BUY,SELL}) – The original order side.- Return type:
OrderSide
- Raises:
ValueError – If side is invalid.
- order_list_id¶
The order list ID associated with the order.
- Returns:
OrderListId or
None
- order_type¶
The order type.
- Returns:
OrderType
- overfill_qty¶
The order total overfill quantity (filled beyond original quantity).
- Returns:
Quantity
- parent_order_id¶
The parent client order ID.
- Returns:
ClientOrderId or
None
- position_id¶
The position ID associated with the order.
- Returns:
PositionId or
None
- quantity¶
The order quantity.
- Returns:
Quantity
- set_quote_quantity(self, bool value) void¶
- side¶
The order side.
- Returns:
OrderSide
- side_string(self) str¶
Return the orders side as a string.
- Return type:
str
- signed_decimal_qty(self)¶
Return a signed decimal representation of the remaining quantity.
If the order is a BUY, the value is positive (e.g. Decimal(‘10.25’))
If the order is a SELL, the value is negative (e.g. Decimal(‘-10.25’))
- Return type:
Decimal
- slippage¶
The order total price slippage.
- Returns:
double
- status¶
Return the orders current status.
- Return type:
OrderStatus
- status_string(self) str¶
Return the orders current status as a string.
- Return type:
str
- strategy_id¶
The strategy ID associated with the order.
- Returns:
StrategyId
- tags¶
The order custom user tags.
- Returns:
list[str] or
None
- tif_string(self) str¶
Return the orders time in force as a string.
- Return type:
str
- time_in_force¶
The order time in force.
- Returns:
TimeInForce
- to_dict(self) dict¶
Return a dictionary representation of this object.
- Return type:
dict[str, object]
- to_own_book_order(self) nautilus_pyo3.OwnBookOrder¶
Returns an own/user order representation of this order.
- Return type:
nautilus_pyo3.OwnBookOrder
- trader_id¶
The trader ID associated with the position.
- Returns:
TraderId
- trigger_instrument_id¶
The order emulation trigger instrument ID (will be instrument_id if
None).- Returns:
InstrumentId or
None
- ts_accepted¶
UNIX timestamp (nanoseconds) when the order was accepted or first filled (zero unless accepted or filled).
- Returns:
uint64_t
- ts_closed¶
UNIX timestamp (nanoseconds) when the order closed / lifecycle completed (zero unless closed).
- Returns:
uint64_t
- ts_init¶
UNIX timestamp (nanoseconds) when the order was initialized.
- Returns:
uint64_t
- ts_last¶
UNIX timestamp (nanoseconds) when the last order event occurred.
- Returns:
uint64_t
- ts_submitted¶
UNIX timestamp (nanoseconds) when the order was submitted (zero unless submitted).
- Returns:
uint64_t
- type_string(self) str¶
Return the orders type as a string.
- Return type:
str
- venue_order_id¶
The venue assigned order ID.
- Returns:
VenueOrderId or
None
- venue_order_ids¶
Return the venue order IDs.
- Return type:
list[VenueOrderId]
- would_reduce_only(self, PositionSide position_side, Quantity position_qty) bool¶
Whether the current order would only reduce the given position if applied in full.
- Parameters:
position_side (PositionSide {
FLAT,LONG,SHORT}) – The side of the position to check against.position_qty (Quantity) – The quantity of the position to check against.
- Return type:
bool
- class OrderList¶
Bases:
objectOrderList(OrderListId order_list_id, list orders) -> None
Represents a list of bulk or related contingent orders.
All orders must be for the same instrument ID.
- Parameters:
order_list_id (OrderListId) – The order list ID.
orders (list[Order]) – The contained orders list.
- Raises:
ValueError – If orders is empty.
ValueError – If orders contains a type other than Order.
ValueError – If orders contain different instrument IDs (must all be the same instrument).
- first¶
The first order in the list (typically the parent).
- Returns:
list[Order]
- id¶
The order list ID.
- Returns:
OrderListId
- instrument_id¶
The instrument ID associated with the list.
- Returns:
InstrumentId
- is_bracket(self) bool¶
Return whether this order list represents a bracket order.
A bracket order has exactly 3 orders: an entry order (OTO contingency) with exactly 2 child orders (OUO contingency, not OCO) that are reduce-only TP/SL orders.
- Return type:
bool
- orders¶
The contained orders list.
- Returns:
list[Order]
- strategy_id¶
The strategy ID associated with the list.
- Returns:
StrategyId
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- class OrderUnpacker¶
Bases:
objectProvides a means of unpacking orders from value dictionaries.
- static from_init(OrderInitialized init) Order¶
Return an order initialized from the given event.
- Parameters:
init (OrderInitialized) – The event to initialize with.
- Return type:
- class StopLimitOrder¶
Bases:
OrderStopLimitOrder(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, OrderSide order_side, Quantity quantity, Price price, Price trigger_price, TriggerType trigger_type, UUID4 init_id, uint64_t ts_init, TimeInForce time_in_force=TimeInForce.GTC, uint64_t expire_time_ns=0, bool post_only=False, bool reduce_only=False, bool quote_quantity=False, Quantity display_qty=None, TriggerType emulation_trigger=TriggerType.NO_TRIGGER, InstrumentId trigger_instrument_id=None, ContingencyType contingency_type=ContingencyType.NO_CONTINGENCY, OrderListId order_list_id=None, list linked_order_ids=None, ClientOrderId parent_order_id=None, ExecAlgorithmId exec_algorithm_id=None, dict exec_algorithm_params=None, ClientOrderId exec_spawn_id=None, list tags=None)
Represents a Stop-Limit conditional order.
A Stop-Limit order is an instruction to submit a BUY (or SELL) limit order when the specified stop trigger price is attained or penetrated. The order has two basic components: the stop price and the limit price. When a trade has occurred at or through the stop price, the order becomes executable and enters the market as a limit order, which is an order to BUY (or SELL) at a specified price or better.
A Stop-Limit eliminates the price risk associated with a stop order where the execution price cannot be guaranteed, but exposes the trader to the risk that the order may never fill, even if the stop price is reached.
- Parameters:
trader_id (TraderId) – The trader ID associated with the order.
strategy_id (StrategyId) – The strategy ID associated with the order.
instrument_id (InstrumentId) – The order instrument ID.
client_order_id (ClientOrderId) – The client order ID.
order_side (OrderSide {
BUY,SELL}) – The order side.quantity (Quantity) – The order quantity (> 0).
price (Price) – The order price (LIMIT).
trigger_price (Price) – The order trigger price (STOP).
trigger_type (TriggerType) – The order trigger type.
init_id (UUID4) – The order initialization event ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
time_in_force (TimeInForce {
GTC,IOC,FOK,GTD,DAY}, defaultGTC) – The order time in force.expire_time_ns (uint64_t, default 0 (no expiry)) – UNIX timestamp (nanoseconds) when the order will expire.
post_only (bool, default False) – If the
LIMITorder will only provide liquidity (once triggered).reduce_only (bool, default False) – If the
LIMITorder carries the ‘reduce-only’ execution instruction.quote_quantity (bool, default False) – If the order quantity is denominated in the quote currency.
display_qty (Quantity, optional) – The quantity of the
LIMITorder to display on the public book (iceberg).emulation_trigger (EmulationTrigger, default
NO_TRIGGER) – The emulation trigger for the order.trigger_instrument_id (InstrumentId, optional) – The emulation trigger instrument ID for the order (if
Nonethen will be the instrument_id).contingency_type (ContingencyType, default
NO_CONTINGENCY) – The order contingency type.order_list_id (OrderListId, optional) – The order list ID associated with the order.
linked_order_ids (list[ClientOrderId], optional) – The order linked client order ID(s).
parent_order_id (ClientOrderId, optional) – The order parent client order ID.
exec_algorithm_id (ExecAlgorithmId, optional) – The execution algorithm ID for the order.
exec_algorithm_params (dict[str, Any], optional) – The execution algorithm parameters for the order.
exec_spawn_id (ClientOrderId, optional) – The execution algorithm spawning primary client order ID.
tags (list[str], optional) – The custom user tags for the order.
- Raises:
ValueError – If order_side is
NO_ORDER_SIDE.ValueError – If quantity is not positive (> 0).
ValueError – If trigger_type is
NO_TRIGGER.ValueError – If time_in_force is
AT_THE_OPENorAT_THE_CLOSE.ValueError – If time_in_force is
GTDand expire_time_ns <= UNIX epoch.ValueError – If display_qty is negative (< 0) or greater than quantity.
- static create(init)¶
- display_qty¶
The quantity of the
LIMITorder to display on the public book (iceberg).- Returns:
Quantity or
None
- expire_time¶
Return the expire time for the order (UTC).
- Return type:
datetime or
None
- expire_time_ns¶
The order expiration (UNIX epoch nanoseconds), zero for no expiration.
- Returns:
uint64_t
- static from_pyo3(pyo3_order)¶
- info(self) str¶
Return a summary description of the order.
- Return type:
str
- is_triggered¶
If the order has been triggered.
- Returns:
bool
- price¶
The order price (LIMIT).
- Returns:
Price
- to_dict(self) dict¶
Return a dictionary representation of this object.
- Return type:
dict[str, object]
- trigger_price¶
The order trigger price (STOP).
- Returns:
Price
- trigger_type¶
The trigger type for the order.
- Returns:
TriggerType
- ts_triggered¶
UNIX timestamp (nanoseconds) when the order was triggered (0 if not triggered).
- Returns:
uint64_t
- class StopMarketOrder¶
Bases:
OrderStopMarketOrder(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, OrderSide order_side, Quantity quantity, Price trigger_price, TriggerType trigger_type, UUID4 init_id, uint64_t ts_init, TimeInForce time_in_force=TimeInForce.GTC, uint64_t expire_time_ns=0, bool reduce_only=False, bool quote_quantity=False, TriggerType emulation_trigger=TriggerType.NO_TRIGGER, InstrumentId trigger_instrument_id=None, ContingencyType contingency_type=ContingencyType.NO_CONTINGENCY, OrderListId order_list_id=None, list linked_order_ids=None, ClientOrderId parent_order_id=None, ExecAlgorithmId exec_algorithm_id=None, dict exec_algorithm_params=None, ClientOrderId exec_spawn_id=None, list tags=None)
Represents a Stop-Market conditional order.
A Stop-Market order is an instruction to submit a BUY (or SELL) market order if and when the specified stop trigger price is attained or penetrated. A Stop-Market order is not guaranteed a specific execution price and may execute significantly away from its stop price.
A SELL Stop-Market order is always placed below the current market price, and is typically used to limit a loss or protect a profit on a long position.
A BUY Stop-Market order is always placed above the current market price, and is typically used to limit a loss or protect a profit on a short position.
- Parameters:
trader_id (TraderId) – The trader ID associated with the order.
strategy_id (StrategyId) – The strategy ID associated with the order.
instrument_id (InstrumentId) – The order instrument ID.
client_order_id (ClientOrderId) – The client order ID.
order_side (OrderSide {
BUY,SELL}) – The order side.quantity (Quantity) – The order quantity (> 0).
trigger_price (Price) – The order trigger price (STOP).
trigger_type (TriggerType) – The order trigger type.
init_id (UUID4) – The order initialization event ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
time_in_force (TimeInForce {
GTC,IOC,FOK,GTD,DAY}, defaultGTC) – The order time in force.expire_time_ns (uint64_t, default 0 (no expiry)) – UNIX timestamp (nanoseconds) when the order will expire.
reduce_only (bool, default False) – If the order carries the ‘reduce-only’ execution instruction.
quote_quantity (bool, default False) – If the order quantity is denominated in the quote currency.
emulation_trigger (TriggerType, default
NO_TRIGGER) – The type of market price trigger to use for local order emulation. -NO_TRIGGER(default): Disables local emulation; orders are sent directly to the venue. -DEFAULT(the same asBID_ASK): Enables local order emulation by triggering orders based on bid/ask prices. Additional trigger types are available. See the “Emulated Orders” section in the documentation for more details.trigger_instrument_id (InstrumentId, optional) – The emulation trigger instrument ID for the order (if
Nonethen will be the instrument_id).contingency_type (ContingencyType, default
NO_CONTINGENCY) – The order contingency type.order_list_id (OrderListId, optional) – The order list ID associated with the order.
linked_order_ids (list[ClientOrderId], optional) – The order linked client order ID(s).
parent_order_id (ClientOrderId, optional) – The order parent client order ID.
exec_algorithm_id (ExecAlgorithmId, optional) – The execution algorithm ID for the order.
exec_algorithm_params (dict[str, Any], optional) – The execution algorithm parameters for the order.
exec_spawn_id (ClientOrderId, optional) – The execution algorithm spawning primary client order ID.
tags (list[str], optional) – The custom user tags for the order.
- Raises:
ValueError – If order_side is
NO_ORDER_SIDE.ValueError – If quantity is not positive (> 0).
ValueError – If trigger_type is
NO_TRIGGER.ValueError – If time_in_force is
AT_THE_OPENorAT_THE_CLOSE.ValueError – If time_in_force is
GTDand expire_time_ns <= UNIX epoch.
- static create(init)¶
- expire_time¶
Return the expire time for the order (UTC).
- Return type:
datetime or
None
- expire_time_ns¶
The order expiration (UNIX epoch nanoseconds), zero for no expiration.
- Returns:
uint64_t
- info(self) str¶
Return a summary description of the order.
- Return type:
str
- to_dict(self) dict¶
Return a dictionary representation of this object.
- Return type:
dict[str, object]
- trigger_price¶
The order trigger price (STOP).
- Returns:
Price
- trigger_type¶
The trigger type for the order.
- Returns:
TriggerType
- class TrailingStopLimitOrder¶
Bases:
OrderTrailingStopLimitOrder(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, OrderSide order_side, Quantity quantity, Price price: Price | None, Price trigger_price: Price | None, TriggerType trigger_type, limit_offset: Decimal, trailing_offset: Decimal, TrailingOffsetType trailing_offset_type, UUID4 init_id, uint64_t ts_init, Price activation_price: Price | None = None, TimeInForce time_in_force=TimeInForce.GTC, uint64_t expire_time_ns=0, bool post_only=False, bool reduce_only=False, bool quote_quantity=False, Quantity display_qty=None, TriggerType emulation_trigger=TriggerType.NO_TRIGGER, InstrumentId trigger_instrument_id=None, ContingencyType contingency_type=ContingencyType.NO_CONTINGENCY, OrderListId order_list_id=None, list linked_order_ids=None, ClientOrderId parent_order_id=None, ExecAlgorithmId exec_algorithm_id=None, dict exec_algorithm_params=None, ClientOrderId exec_spawn_id=None, list tags=None)
Represents a Trailing-Stop-Limit conditional order.
- Parameters:
trader_id (TraderId) – The trader ID associated with the order.
strategy_id (StrategyId) – The strategy ID associated with the order.
instrument_id (InstrumentId) – The order instrument ID.
client_order_id (ClientOrderId) – The client order ID.
order_side (OrderSide {
BUY,SELL}) – The order side.quantity (Quantity) – The order quantity (> 0).
price (Price or
None) – The order price (LIMIT). IfNonethen will typically default to the delta of market price and limit_offset.trigger_price (Price or
None) – The order trigger price (STOP). IfNonethen will typically default to the delta of market price and trailing_offset.trigger_type (TriggerType) – The order trigger type.
limit_offset (Decimal) – The trailing offset for the order price (LIMIT).
trailing_offset (Decimal) – The trailing offset for the order trigger price (STOP).
trailing_offset_type (TrailingOffsetType) – The order trailing offset type.
init_id (UUID4) – The order initialization event ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
activation_price (Price, optional) – The price for the order to become active. If
Nonethen the order will be activated right after the order is accepted.time_in_force (TimeInForce {
GTC,IOC,FOK,GTD,DAY}, defaultGTC) – The order time in force.expire_time_ns (uint64_t, default 0 (no expiry)) – UNIX timestamp (nanoseconds) when the order will expire.
post_only (bool, default False) – If the
LIMITorder will only provide liquidity (once triggered).reduce_only (bool, default False) – If the
LIMITorder carries the ‘reduce-only’ execution instruction.quote_quantity (bool, default False) – If the order quantity is denominated in the quote currency.
display_qty (Quantity, optional) – The quantity of the
LIMITorder to display on the public book (iceberg).emulation_trigger (TriggerType, default
NO_TRIGGER) – The type of market price trigger to use for local order emulation. -NO_TRIGGER(default): Disables local emulation; orders are sent directly to the venue. -DEFAULT(the same asBID_ASK): Enables local order emulation by triggering orders based on bid/ask prices. Additional trigger types are available. See the “Emulated Orders” section in the documentation for more details.trigger_instrument_id (InstrumentId, optional) – The emulation trigger instrument ID for the order (if
Nonethen will be the instrument_id).contingency_type (ContingencyType, default
NO_CONTINGENCY) – The order contingency type.order_list_id (OrderListId, optional) – The order list ID associated with the order.
linked_order_ids (list[ClientOrderId], optional) – The order linked client order ID(s).
parent_order_id (ClientOrderId, optional) – The order parent client order ID.
exec_algorithm_id (ExecAlgorithmId, optional) – The execution algorithm ID for the order.
exec_algorithm_params (dict[str, Any], optional) – The execution algorithm parameters for the order.
exec_spawn_id (ClientOrderId, optional) – The execution algorithm spawning primary client order ID.
tags (list[str], optional) – The custom user tags for the order.
- Raises:
ValueError – If order_side is
NO_ORDER_SIDE.ValueError – If quantity is not positive (> 0).
ValueError – If trigger_type is
NO_TRIGGER.ValueError – If trailing_offset_type is
NO_TRAILING_OFFSET.ValueError – If time_in_force is
AT_THE_OPENorAT_THE_CLOSE.ValueError – If time_in_force is
GTDand expire_time_ns <= UNIX epoch.ValueError – If display_qty is negative (< 0) or greater than quantity.
- activation_price¶
The order activation price (STOP).
- Returns:
Price or
None
- static create(init)¶
- display_qty¶
The quantity of the
LIMITorder to display on the public book (iceberg).- Returns:
Quantity or
None
- expire_time¶
Return the expire time for the order (UTC).
- Return type:
datetime or
None
- expire_time_ns¶
The order expiration (UNIX epoch nanoseconds), zero for no expiration.
- Returns:
uint64_t
- info(self) str¶
Return a summary description of the order.
- Return type:
str
- is_activated¶
If the order has been activated.
- Returns:
bool
- is_triggered¶
If the order has been triggered.
- Returns:
bool
- limit_offset¶
The trailing offset for the orders limit price.
- Returns:
Decimal
- price¶
The order price (LIMIT).
- Returns:
Price or
None
- to_dict(self) dict¶
Return a dictionary representation of this object.
- Return type:
dict[str, object]
- trailing_offset¶
The trailing offset for the orders trigger price (STOP).
- Returns:
Decimal
- trailing_offset_type¶
The trailing offset type.
- Returns:
TrailingOffsetType
- trigger_price¶
The order trigger price (STOP).
- Returns:
Price or
None
- trigger_type¶
The trigger type for the order.
- Returns:
TriggerType
- ts_triggered¶
UNIX timestamp (nanoseconds) when the order was triggered (0 if not triggered).
- Returns:
uint64_t
- class TrailingStopMarketOrder¶
Bases:
OrderTrailingStopMarketOrder(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, OrderSide order_side, Quantity quantity, Price trigger_price: Price | None, TriggerType trigger_type, trailing_offset: Decimal, TrailingOffsetType trailing_offset_type, UUID4 init_id, uint64_t ts_init, Price activation_price: Price | None = None, TimeInForce time_in_force=TimeInForce.GTC, uint64_t expire_time_ns=0, bool reduce_only=False, bool quote_quantity=False, TriggerType emulation_trigger=TriggerType.NO_TRIGGER, InstrumentId trigger_instrument_id=None, ContingencyType contingency_type=ContingencyType.NO_CONTINGENCY, OrderListId order_list_id=None, list linked_order_ids=None, ClientOrderId parent_order_id=None, ExecAlgorithmId exec_algorithm_id=None, dict exec_algorithm_params=None, ClientOrderId exec_spawn_id=None, list tags=None)
Represents a Trailing-Stop-Market conditional order.
- Parameters:
trader_id (TraderId) – The trader ID associated with the order.
strategy_id (StrategyId) – The strategy ID associated with the order.
instrument_id (InstrumentId) – The order instrument ID.
client_order_id (ClientOrderId) – The client order ID.
order_side (OrderSide {
BUY,SELL}) – The order side.quantity (Quantity) – The order quantity (> 0).
trigger_price (Price or
None) – The order trigger price (STOP). IfNonethen will typically default to the delta of market price and trailing_offset.trigger_type (TriggerType) – The order trigger type.
trailing_offset (Decimal) – The trailing offset for the trigger price (STOP).
trailing_offset_type (TrailingOffsetType) – The order trailing offset type.
init_id (UUID4) – The order initialization event ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
activation_price (Price, optional) – The price for the order to become active. If
Nonethen the order will be activated right after the order is accepted.time_in_force (TimeInForce {
GTC,IOC,FOK,GTD,DAY}, defaultGTC) – The order time in force.expire_time_ns (uint64_t, default 0 (no expiry)) – UNIX timestamp (nanoseconds) when the order will expire.
reduce_only (bool, default False) – If the order carries the ‘reduce-only’ execution instruction.
quote_quantity (bool, default False) – If the order quantity is denominated in the quote currency.
emulation_trigger (TriggerType, default
NO_TRIGGER) – The type of market price trigger to use for local order emulation. -NO_TRIGGER(default): Disables local emulation; orders are sent directly to the venue. -DEFAULT(the same asBID_ASK): Enables local order emulation by triggering orders based on bid/ask prices. Additional trigger types are available. See the “Emulated Orders” section in the documentation for more details.trigger_instrument_id (InstrumentId, optional) – The emulation trigger instrument ID for the order (if
Nonethen will be the instrument_id).contingency_type (ContingencyType, default
NO_CONTINGENCY) – The order contingency type.order_list_id (OrderListId, optional) – The order list ID associated with the order.
linked_order_ids (list[ClientOrderId], optional) – The order linked client order ID(s).
parent_order_id (ClientOrderId, optional) – The order parent client order ID.
exec_algorithm_id (ExecAlgorithmId, optional) – The execution algorithm ID for the order.
exec_algorithm_params (dict[str, Any], optional) – The execution algorithm parameters for the order.
exec_spawn_id (ClientOrderId, optional) – The execution algorithm spawning primary client order ID.
tags (list[str], optional) – The custom user tags for the order.
- Raises:
ValueError – If order_side is
NO_ORDER_SIDE.ValueError – If quantity is not positive (> 0).
ValueError – If trigger_type is
NO_TRIGGER.ValueError – If trailing_offset_type is
NO_TRAILING_OFFSET.ValueError – If time_in_force is
AT_THE_OPENorAT_THE_CLOSE.ValueError – If time_in_force is
GTDand expire_time_ns <= UNIX epoch.
- activation_price¶
The order activation price (STOP).
- Returns:
Price or
None
- static create(init)¶
- expire_time¶
Return the expire time for the order (UTC).
- Return type:
datetime or
None
- expire_time_ns¶
The order expiration (UNIX epoch nanoseconds), zero for no expiration.
- Returns:
uint64_t
- info(self) str¶
Return a summary description of the order.
- Return type:
str
- is_activated¶
If the order has been activated.
- Returns:
bool
- to_dict(self) dict¶
Return a dictionary representation of this object.
- Return type:
dict[str, object]
- trailing_offset¶
The trailing offset for the orders trigger price (STOP).
- Returns:
Decimal
- trailing_offset_type¶
The trailing offset type.
- Returns:
TrailingOffsetType
- trigger_price¶
The order trigger price (STOP).
- Returns:
Price or
None
- trigger_type¶
The trigger type for the order.
- Returns:
TriggerType
- class MarketOrder¶
Bases:
OrderMarketOrder(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, OrderSide order_side, Quantity quantity, UUID4 init_id, uint64_t ts_init, TimeInForce time_in_force=TimeInForce.GTC, bool reduce_only=False, bool quote_quantity=False, ContingencyType contingency_type=ContingencyType.NO_CONTINGENCY, OrderListId order_list_id=None, list linked_order_ids=None, ClientOrderId parent_order_id=None, ExecAlgorithmId exec_algorithm_id=None, dict exec_algorithm_params=None, ClientOrderId exec_spawn_id=None, list tags=None)
Represents a Market order.
A Market order is an order to BUY (or SELL) at the market bid or offer price. A market order may increase the likelihood of a fill and the speed of execution, but unlike the Limit order - a Market order provides no price protection and may fill at a price far lower/higher than the top-of-book bid/ask.
A Market-On-Open (MOO) order can be represented using a time in force of
AT_THE_OPEN.A Market-On-Close (MOC) order can be represented using a time in force of
AT_THE_CLOSE.
- Parameters:
trader_id (TraderId) – The trader ID associated with the order.
strategy_id (StrategyId) – The strategy ID associated with the order.
instrument_id (InstrumentId) – The order instrument ID.
client_order_id (ClientOrderId) – The client order ID.
order_side (OrderSide {
BUY,SELL}) – The order side.quantity (Quantity) – The order quantity (> 0).
init_id (UUID4) – The order initialization event ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
time_in_force (TimeInForce {
GTC,IOC,FOK,DAY,AT_THE_OPEN,AT_THE_CLOSE}, defaultGTC) – The order time in force.reduce_only (bool, default False) – If the order carries the ‘reduce-only’ execution instruction.
quote_quantity (bool, default False) – If the order quantity is denominated in the quote currency.
contingency_type (ContingencyType, default
NO_CONTINGENCY) – The order contingency type.order_list_id (OrderListId, optional) – The order list ID associated with the order.
linked_order_ids (list[ClientOrderId], optional) – The order linked client order ID(s).
parent_order_id (ClientOrderId, optional) – The order parent client order ID.
exec_algorithm_id (ExecAlgorithmId, optional) – The execution algorithm ID for the order.
exec_algorithm_params (dict[str, Any], optional) – The execution algorithm parameters for the order.
exec_spawn_id (ClientOrderId, optional) – The execution algorithm spawning primary client order ID.
tags (list[str], optional) – The custom user tags for the order.
- Raises:
ValueError – If order_side is
NO_ORDER_SIDE.ValueError – If quantity is not positive (> 0).
ValueError – If time_in_force is
GTD.
- account_id¶
The account ID associated with the order.
- Returns:
AccountId or
None
- apply(self, OrderEvent event) void¶
Apply the given order event to the order.
- Parameters:
event (OrderEvent) – The order event to apply.
- Raises:
ValueError – If self.client_order_id is not equal to event.client_order_id.
ValueError – If self.venue_order_id and event.venue_order_id are both not
None, and are not equal.InvalidStateTrigger – If event is not a valid trigger from the current order.status.
KeyError – If event is OrderFilled and event.trade_id already applied to the order.
- avg_px¶
The order average fill price.
- Returns:
double
- client_order_id¶
The client order ID.
- Returns:
ClientOrderId
- static closing_side(PositionSide position_side) OrderSide¶
Return the order side needed to close a position with the given side.
- Parameters:
position_side (PositionSide {
LONG,SHORT}) – The side of the position to close.- Return type:
OrderSide
- Raises:
ValueError – If position_side is
FLATor invalid.
- commissions(self) list¶
Return the total commissions generated by the order.
- Return type:
list[Money]
- contingency_type¶
The orders contingency type.
- Returns:
ContingencyType
- static create(init)¶
- emulation_trigger¶
The order emulation trigger type.
- Returns:
TriggerType
- event_count¶
Return the count of events applied to the order.
- Return type:
int
- events¶
Return the order events.
- Return type:
list[OrderEvent]
- exec_algorithm_id¶
The execution algorithm ID for the order.
- Returns:
ExecAlgorithmId or
None
- exec_algorithm_params¶
The execution algorithm parameters for the order.
- Returns:
dict[str, Any] or
None
- exec_spawn_id¶
The execution algorithm spawning client order ID.
- Returns:
ClientOrderId or
None
- filled_qty¶
The order total filled quantity.
- Returns:
Quantity
- static from_pyo3(pyo3_order)¶
- has_activation_price¶
Return whether the order has a activation_price property.
- Return type:
bool
- has_price¶
Return whether the order has a price property.
- Return type:
bool
- has_trigger_price¶
Return whether the order has a trigger_price property.
- Return type:
bool
- info(self) str¶
Return a summary description of the order.
- Return type:
str
- init_event¶
Return the initialization event for the order.
- Return type:
- init_id¶
The event ID of the OrderInitialized event.
- Returns:
UUID4
- instrument_id¶
The order instrument ID.
- Returns:
InstrumentId
- is_active_local¶
Return whether the order is active and held in the local system.
An order is considered active local when its status is any of: -
INITIALIZED-EMULATED-RELEASED- Return type:
bool
- is_aggressive¶
Return whether the order is aggressive (order_type is
MARKET).- Return type:
bool
- is_buy¶
Return whether the order side is
BUY.- Return type:
bool
- is_canceled¶
Return whether current status is
CANCELED.- Return type:
bool
- is_child_order¶
Return whether the order has a parent order.
- Return type:
bool
- is_closed¶
Return whether the order is closed (lifecycle completed).
An order is considered closed when its status can no longer change. The possible statuses of closed orders include;
DENIEDREJECTEDCANCELEDEXPIREDFILLED
- Return type:
bool
- is_contingency¶
Return whether the order has a contingency (contingency_type is not
NO_CONTINGENCY).- Return type:
bool
- is_duplicate_fill(self, OrderFilled fill) bool¶
Return whether a fill with matching trade_id, side, qty, and price already exists.
- Parameters:
fill (OrderFilled) – The fill event to check.
- Return type:
bool
- is_emulated¶
Return whether the order is emulated and held in the local system.
- Return type:
bool
- is_inflight¶
Return whether the order is in-flight (order request sent to the trading venue).
An order is considered in-flight when its status is any of: -
SUBMITTED-PENDING_UPDATE-PENDING_CANCEL- Return type:
bool
Warning
An emulated order is never considered in-flight.
- is_open¶
Return whether the order is open at the trading venue.
An order is considered open when its status is any of: -
ACCEPTED-TRIGGERED-PENDING_UPDATE-PENDING_CANCEL-PARTIALLY_FILLED- Return type:
bool
Warning
An emulated order is never considered open.
- is_parent_order¶
Return whether the order has at least one child order.
- Return type:
bool
- is_passive¶
Return whether the order is passive (order_type not
MARKET).- Return type:
bool
- is_pending_cancel¶
Return whether the current status is
PENDING_CANCEL.- Return type:
bool
- is_pending_update¶
Return whether the current status is
PENDING_UPDATE.- Return type:
bool
- is_post_only¶
If the order will only provide liquidity (make a market).
- Returns:
bool
- is_primary¶
Return whether the order is the primary for an execution algorithm sequence.
- Return type:
bool
- is_quote_quantity¶
If the order quantity is denominated in the quote currency.
- Returns:
bool
- is_reduce_only¶
If the order carries the ‘reduce-only’ execution instruction.
- Returns:
bool
- is_sell¶
Return whether the order side is
SELL.- Return type:
bool
- is_spawned¶
Return whether the order was spawned as part of an execution algorithm sequence.
- Return type:
bool
- last_event¶
Return the last event applied to the order.
- Return type:
- last_trade_id¶
The orders last trade match ID.
- Returns:
TradeId or
None
- leaves_qty¶
The order total leaves quantity.
- Returns:
Quantity
- linked_order_ids¶
The orders linked client order ID(s).
- Returns:
list[ClientOrderId] or
None
- liquidity_side¶
The order liquidity side.
- Returns:
LiquiditySide
- static opposite_side(OrderSide side) OrderSide¶
Return the opposite order side from the given side.
- Parameters:
side (OrderSide {
BUY,SELL}) – The original order side.- Return type:
OrderSide
- Raises:
ValueError – If side is invalid.
- order_list_id¶
The order list ID associated with the order.
- Returns:
OrderListId or
None
- order_type¶
The order type.
- Returns:
OrderType
- overfill_qty¶
The order total overfill quantity (filled beyond original quantity).
- Returns:
Quantity
- parent_order_id¶
The parent client order ID.
- Returns:
ClientOrderId or
None
- position_id¶
The position ID associated with the order.
- Returns:
PositionId or
None
- quantity¶
The order quantity.
- Returns:
Quantity
- set_quote_quantity(self, bool value) void¶
- side¶
The order side.
- Returns:
OrderSide
- side_string(self) str¶
Return the orders side as a string.
- Return type:
str
- signed_decimal_qty(self)¶
Return a signed decimal representation of the remaining quantity.
If the order is a BUY, the value is positive (e.g. Decimal(‘10.25’))
If the order is a SELL, the value is negative (e.g. Decimal(‘-10.25’))
- Return type:
Decimal
- slippage¶
The order total price slippage.
- Returns:
double
- status¶
Return the orders current status.
- Return type:
OrderStatus
- status_string(self) str¶
Return the orders current status as a string.
- Return type:
str
- strategy_id¶
The strategy ID associated with the order.
- Returns:
StrategyId
- tags¶
The order custom user tags.
- Returns:
list[str] or
None
- tif_string(self) str¶
Return the orders time in force as a string.
- Return type:
str
- time_in_force¶
The order time in force.
- Returns:
TimeInForce
- to_dict(self) dict¶
Return a dictionary representation of this object.
- Return type:
dict[str, object]
- to_own_book_order(self) nautilus_pyo3.OwnBookOrder¶
Returns an own/user order representation of this order.
- Return type:
nautilus_pyo3.OwnBookOrder
- trader_id¶
The trader ID associated with the position.
- Returns:
TraderId
- static transform_py(Order order, uint64_t ts_init) MarketOrder¶
- trigger_instrument_id¶
The order emulation trigger instrument ID (will be instrument_id if
None).- Returns:
InstrumentId or
None
- ts_accepted¶
UNIX timestamp (nanoseconds) when the order was accepted or first filled (zero unless accepted or filled).
- Returns:
uint64_t
- ts_closed¶
UNIX timestamp (nanoseconds) when the order closed / lifecycle completed (zero unless closed).
- Returns:
uint64_t
- ts_init¶
UNIX timestamp (nanoseconds) when the order was initialized.
- Returns:
uint64_t
- ts_last¶
UNIX timestamp (nanoseconds) when the last order event occurred.
- Returns:
uint64_t
- ts_submitted¶
UNIX timestamp (nanoseconds) when the order was submitted (zero unless submitted).
- Returns:
uint64_t
- type_string(self) str¶
Return the orders type as a string.
- Return type:
str
- venue_order_id¶
The venue assigned order ID.
- Returns:
VenueOrderId or
None
- venue_order_ids¶
Return the venue order IDs.
- Return type:
list[VenueOrderId]
- would_reduce_only(self, PositionSide position_side, Quantity position_qty) bool¶
Whether the current order would only reduce the given position if applied in full.
- Parameters:
position_side (PositionSide {
FLAT,LONG,SHORT}) – The side of the position to check against.position_qty (Quantity) – The quantity of the position to check against.
- Return type:
bool
- class LimitOrder¶
Bases:
OrderLimitOrder(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, OrderSide order_side, Quantity quantity, Price price, UUID4 init_id, uint64_t ts_init, TimeInForce time_in_force=TimeInForce.GTC, uint64_t expire_time_ns=0, bool post_only=False, bool reduce_only=False, bool quote_quantity=False, Quantity display_qty=None, TriggerType emulation_trigger=TriggerType.NO_TRIGGER, InstrumentId trigger_instrument_id=None, ContingencyType contingency_type=ContingencyType.NO_CONTINGENCY, OrderListId order_list_id=None, list linked_order_ids=None, ClientOrderId parent_order_id=None, ExecAlgorithmId exec_algorithm_id=None, dict exec_algorithm_params=None, ClientOrderId exec_spawn_id=None, list tags=None)
Represents a Limit order.
A Limit order is an order to BUY (or SELL) at a specified price or better. The Limit order ensures that if the order fills, it will not fill at a price less favorable than your limit price, but it does not guarantee a fill.
A Limit-On-Open (LOO) order can be represented using a time in force of
AT_THE_OPEN.A Limit-On-Close (LOC) order can be represented using a time in force of
AT_THE_CLOSE.
- Parameters:
trader_id (TraderId) – The trader ID associated with the order.
strategy_id (StrategyId) – The strategy ID associated with the order.
instrument_id (InstrumentId) – The order instrument ID.
client_order_id (ClientOrderId) – The client order ID.
order_side (OrderSide {
BUY,SELL}) – The order side.quantity (Quantity) – The order quantity (> 0).
price (Price) – The order limit price.
init_id (UUID4) – The order initialization event ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
time_in_force (TimeInForce {
GTC,IOC,FOK,GTD,DAY,AT_THE_OPEN,AT_THE_CLOSE}, defaultGTC) – The order time in force.expire_time_ns (uint64_t, default 0 (no expiry)) – UNIX timestamp (nanoseconds) when the order will expire.
post_only (bool, default False) – If the order will only provide liquidity (make a market).
reduce_only (bool, default False) – If the order carries the ‘reduce-only’ execution instruction.
quote_quantity (bool, default False) – If the order quantity is denominated in the quote currency.
display_qty (Quantity, optional) – The quantity of the order to display on the public book (iceberg).
emulation_trigger (TriggerType, default
NO_TRIGGER) – The type of market price trigger to use for local order emulation. -NO_TRIGGER(default): Disables local emulation; orders are sent directly to the venue. -DEFAULT(the same asBID_ASK): Enables local order emulation by triggering orders based on bid/ask prices. Additional trigger types are available. See the “Emulated Orders” section in the documentation for more details.trigger_instrument_id (InstrumentId, optional) – The emulation trigger instrument ID for the order (if
Nonethen will be the instrument_id).contingency_type (ContingencyType, default
NO_CONTINGENCY) – The order contingency type.order_list_id (OrderListId, optional) – The order list ID associated with the order.
linked_order_ids (list[ClientOrderId], optional) – The order linked client order ID(s).
parent_order_id (ClientOrderId, optional) – The order parent client order ID.
exec_algorithm_id (ExecAlgorithmId, optional) – The execution algorithm ID for the order.
exec_algorithm_params (dict[str, Any], optional) – The execution algorithm parameters for the order.
exec_spawn_id (ClientOrderId, optional) – The execution algorithm spawning primary client order ID.
tags (list[str], optional) – The custom user tags for the order.
- Raises:
ValueError – If order_side is
NO_ORDER_SIDE.ValueError – If quantity is not positive (> 0).
ValueError – If time_in_force is
GTDand expire_time_ns <= UNIX epoch.ValueError – If display_qty is negative (< 0) or greater than quantity.
- account_id¶
The account ID associated with the order.
- Returns:
AccountId or
None
- apply(self, OrderEvent event) void¶
Apply the given order event to the order.
- Parameters:
event (OrderEvent) – The order event to apply.
- Raises:
ValueError – If self.client_order_id is not equal to event.client_order_id.
ValueError – If self.venue_order_id and event.venue_order_id are both not
None, and are not equal.InvalidStateTrigger – If event is not a valid trigger from the current order.status.
KeyError – If event is OrderFilled and event.trade_id already applied to the order.
- avg_px¶
The order average fill price.
- Returns:
double
- client_order_id¶
The client order ID.
- Returns:
ClientOrderId
- static closing_side(PositionSide position_side) OrderSide¶
Return the order side needed to close a position with the given side.
- Parameters:
position_side (PositionSide {
LONG,SHORT}) – The side of the position to close.- Return type:
OrderSide
- Raises:
ValueError – If position_side is
FLATor invalid.
- commissions(self) list¶
Return the total commissions generated by the order.
- Return type:
list[Money]
- contingency_type¶
The orders contingency type.
- Returns:
ContingencyType
- static create(OrderInitialized init)¶
- display_qty¶
The quantity of the order to display on the public book (iceberg).
- Returns:
Quantity or
None
- emulation_trigger¶
The order emulation trigger type.
- Returns:
TriggerType
- event_count¶
Return the count of events applied to the order.
- Return type:
int
- events¶
Return the order events.
- Return type:
list[OrderEvent]
- exec_algorithm_id¶
The execution algorithm ID for the order.
- Returns:
ExecAlgorithmId or
None
- exec_algorithm_params¶
The execution algorithm parameters for the order.
- Returns:
dict[str, Any] or
None
- exec_spawn_id¶
The execution algorithm spawning client order ID.
- Returns:
ClientOrderId or
None
- expire_time¶
Return the expire time for the order (UTC).
- Return type:
datetime or
None
- expire_time_ns¶
The order expiration (UNIX epoch nanoseconds), zero for no expiration.
- Returns:
uint64_t
- filled_qty¶
The order total filled quantity.
- Returns:
Quantity
- static from_pyo3(pyo3_order)¶
- has_activation_price¶
Return whether the order has a activation_price property.
- Return type:
bool
- has_price¶
Return whether the order has a price property.
- Return type:
bool
- has_trigger_price¶
Return whether the order has a trigger_price property.
- Return type:
bool
- info(self) str¶
Return a summary description of the order.
- Return type:
str
- init_event¶
Return the initialization event for the order.
- Return type:
- init_id¶
The event ID of the OrderInitialized event.
- Returns:
UUID4
- instrument_id¶
The order instrument ID.
- Returns:
InstrumentId
- is_active_local¶
Return whether the order is active and held in the local system.
An order is considered active local when its status is any of: -
INITIALIZED-EMULATED-RELEASED- Return type:
bool
- is_aggressive¶
Return whether the order is aggressive (order_type is
MARKET).- Return type:
bool
- is_buy¶
Return whether the order side is
BUY.- Return type:
bool
- is_canceled¶
Return whether current status is
CANCELED.- Return type:
bool
- is_child_order¶
Return whether the order has a parent order.
- Return type:
bool
- is_closed¶
Return whether the order is closed (lifecycle completed).
An order is considered closed when its status can no longer change. The possible statuses of closed orders include;
DENIEDREJECTEDCANCELEDEXPIREDFILLED
- Return type:
bool
- is_contingency¶
Return whether the order has a contingency (contingency_type is not
NO_CONTINGENCY).- Return type:
bool
- is_duplicate_fill(self, OrderFilled fill) bool¶
Return whether a fill with matching trade_id, side, qty, and price already exists.
- Parameters:
fill (OrderFilled) – The fill event to check.
- Return type:
bool
- is_emulated¶
Return whether the order is emulated and held in the local system.
- Return type:
bool
- is_inflight¶
Return whether the order is in-flight (order request sent to the trading venue).
An order is considered in-flight when its status is any of: -
SUBMITTED-PENDING_UPDATE-PENDING_CANCEL- Return type:
bool
Warning
An emulated order is never considered in-flight.
- is_open¶
Return whether the order is open at the trading venue.
An order is considered open when its status is any of: -
ACCEPTED-TRIGGERED-PENDING_UPDATE-PENDING_CANCEL-PARTIALLY_FILLED- Return type:
bool
Warning
An emulated order is never considered open.
- is_parent_order¶
Return whether the order has at least one child order.
- Return type:
bool
- is_passive¶
Return whether the order is passive (order_type not
MARKET).- Return type:
bool
- is_pending_cancel¶
Return whether the current status is
PENDING_CANCEL.- Return type:
bool
- is_pending_update¶
Return whether the current status is
PENDING_UPDATE.- Return type:
bool
- is_post_only¶
If the order will only provide liquidity (make a market).
- Returns:
bool
- is_primary¶
Return whether the order is the primary for an execution algorithm sequence.
- Return type:
bool
- is_quote_quantity¶
If the order quantity is denominated in the quote currency.
- Returns:
bool
- is_reduce_only¶
If the order carries the ‘reduce-only’ execution instruction.
- Returns:
bool
- is_sell¶
Return whether the order side is
SELL.- Return type:
bool
- is_spawned¶
Return whether the order was spawned as part of an execution algorithm sequence.
- Return type:
bool
- last_event¶
Return the last event applied to the order.
- Return type:
- last_trade_id¶
The orders last trade match ID.
- Returns:
TradeId or
None
- leaves_qty¶
The order total leaves quantity.
- Returns:
Quantity
- linked_order_ids¶
The orders linked client order ID(s).
- Returns:
list[ClientOrderId] or
None
- liquidity_side¶
The order liquidity side.
- Returns:
LiquiditySide
- static opposite_side(OrderSide side) OrderSide¶
Return the opposite order side from the given side.
- Parameters:
side (OrderSide {
BUY,SELL}) – The original order side.- Return type:
OrderSide
- Raises:
ValueError – If side is invalid.
- order_list_id¶
The order list ID associated with the order.
- Returns:
OrderListId or
None
- order_type¶
The order type.
- Returns:
OrderType
- overfill_qty¶
The order total overfill quantity (filled beyond original quantity).
- Returns:
Quantity
- parent_order_id¶
The parent client order ID.
- Returns:
ClientOrderId or
None
- position_id¶
The position ID associated with the order.
- Returns:
PositionId or
None
- price¶
The order price (LIMIT).
- Returns:
Price
- quantity¶
The order quantity.
- Returns:
Quantity
- set_quote_quantity(self, bool value) void¶
- side¶
The order side.
- Returns:
OrderSide
- side_string(self) str¶
Return the orders side as a string.
- Return type:
str
- signed_decimal_qty(self)¶
Return a signed decimal representation of the remaining quantity.
If the order is a BUY, the value is positive (e.g. Decimal(‘10.25’))
If the order is a SELL, the value is negative (e.g. Decimal(‘-10.25’))
- Return type:
Decimal
- slippage¶
The order total price slippage.
- Returns:
double
- status¶
Return the orders current status.
- Return type:
OrderStatus
- status_string(self) str¶
Return the orders current status as a string.
- Return type:
str
- strategy_id¶
The strategy ID associated with the order.
- Returns:
StrategyId
- tags¶
The order custom user tags.
- Returns:
list[str] or
None
- tif_string(self) str¶
Return the orders time in force as a string.
- Return type:
str
- time_in_force¶
The order time in force.
- Returns:
TimeInForce
- to_dict(self) dict¶
Return a dictionary representation of this object.
- Return type:
dict[str, object]
- to_own_book_order(self) nautilus_pyo3.OwnBookOrder¶
Returns an own/user order representation of this order.
- Return type:
nautilus_pyo3.OwnBookOrder
- trader_id¶
The trader ID associated with the position.
- Returns:
TraderId
- static transform_py(Order order, uint64_t ts_init, Price price=None) LimitOrder¶
- trigger_instrument_id¶
The order emulation trigger instrument ID (will be instrument_id if
None).- Returns:
InstrumentId or
None
- ts_accepted¶
UNIX timestamp (nanoseconds) when the order was accepted or first filled (zero unless accepted or filled).
- Returns:
uint64_t
- ts_closed¶
UNIX timestamp (nanoseconds) when the order closed / lifecycle completed (zero unless closed).
- Returns:
uint64_t
- ts_init¶
UNIX timestamp (nanoseconds) when the order was initialized.
- Returns:
uint64_t
- ts_last¶
UNIX timestamp (nanoseconds) when the last order event occurred.
- Returns:
uint64_t
- ts_submitted¶
UNIX timestamp (nanoseconds) when the order was submitted (zero unless submitted).
- Returns:
uint64_t
- type_string(self) str¶
Return the orders type as a string.
- Return type:
str
- venue_order_id¶
The venue assigned order ID.
- Returns:
VenueOrderId or
None
- venue_order_ids¶
Return the venue order IDs.
- Return type:
list[VenueOrderId]
- would_reduce_only(self, PositionSide position_side, Quantity position_qty) bool¶
Whether the current order would only reduce the given position if applied in full.
- Parameters:
position_side (PositionSide {
FLAT,LONG,SHORT}) – The side of the position to check against.position_qty (Quantity) – The quantity of the position to check against.
- Return type:
bool
- class StopMarketOrder¶
Bases:
OrderStopMarketOrder(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, OrderSide order_side, Quantity quantity, Price trigger_price, TriggerType trigger_type, UUID4 init_id, uint64_t ts_init, TimeInForce time_in_force=TimeInForce.GTC, uint64_t expire_time_ns=0, bool reduce_only=False, bool quote_quantity=False, TriggerType emulation_trigger=TriggerType.NO_TRIGGER, InstrumentId trigger_instrument_id=None, ContingencyType contingency_type=ContingencyType.NO_CONTINGENCY, OrderListId order_list_id=None, list linked_order_ids=None, ClientOrderId parent_order_id=None, ExecAlgorithmId exec_algorithm_id=None, dict exec_algorithm_params=None, ClientOrderId exec_spawn_id=None, list tags=None)
Represents a Stop-Market conditional order.
A Stop-Market order is an instruction to submit a BUY (or SELL) market order if and when the specified stop trigger price is attained or penetrated. A Stop-Market order is not guaranteed a specific execution price and may execute significantly away from its stop price.
A SELL Stop-Market order is always placed below the current market price, and is typically used to limit a loss or protect a profit on a long position.
A BUY Stop-Market order is always placed above the current market price, and is typically used to limit a loss or protect a profit on a short position.
- Parameters:
trader_id (TraderId) – The trader ID associated with the order.
strategy_id (StrategyId) – The strategy ID associated with the order.
instrument_id (InstrumentId) – The order instrument ID.
client_order_id (ClientOrderId) – The client order ID.
order_side (OrderSide {
BUY,SELL}) – The order side.quantity (Quantity) – The order quantity (> 0).
trigger_price (Price) – The order trigger price (STOP).
trigger_type (TriggerType) – The order trigger type.
init_id (UUID4) – The order initialization event ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
time_in_force (TimeInForce {
GTC,IOC,FOK,GTD,DAY}, defaultGTC) – The order time in force.expire_time_ns (uint64_t, default 0 (no expiry)) – UNIX timestamp (nanoseconds) when the order will expire.
reduce_only (bool, default False) – If the order carries the ‘reduce-only’ execution instruction.
quote_quantity (bool, default False) – If the order quantity is denominated in the quote currency.
emulation_trigger (TriggerType, default
NO_TRIGGER) – The type of market price trigger to use for local order emulation. -NO_TRIGGER(default): Disables local emulation; orders are sent directly to the venue. -DEFAULT(the same asBID_ASK): Enables local order emulation by triggering orders based on bid/ask prices. Additional trigger types are available. See the “Emulated Orders” section in the documentation for more details.trigger_instrument_id (InstrumentId, optional) – The emulation trigger instrument ID for the order (if
Nonethen will be the instrument_id).contingency_type (ContingencyType, default
NO_CONTINGENCY) – The order contingency type.order_list_id (OrderListId, optional) – The order list ID associated with the order.
linked_order_ids (list[ClientOrderId], optional) – The order linked client order ID(s).
parent_order_id (ClientOrderId, optional) – The order parent client order ID.
exec_algorithm_id (ExecAlgorithmId, optional) – The execution algorithm ID for the order.
exec_algorithm_params (dict[str, Any], optional) – The execution algorithm parameters for the order.
exec_spawn_id (ClientOrderId, optional) – The execution algorithm spawning primary client order ID.
tags (list[str], optional) – The custom user tags for the order.
- Raises:
ValueError – If order_side is
NO_ORDER_SIDE.ValueError – If quantity is not positive (> 0).
ValueError – If trigger_type is
NO_TRIGGER.ValueError – If time_in_force is
AT_THE_OPENorAT_THE_CLOSE.ValueError – If time_in_force is
GTDand expire_time_ns <= UNIX epoch.
- account_id¶
The account ID associated with the order.
- Returns:
AccountId or
None
- apply(self, OrderEvent event) void¶
Apply the given order event to the order.
- Parameters:
event (OrderEvent) – The order event to apply.
- Raises:
ValueError – If self.client_order_id is not equal to event.client_order_id.
ValueError – If self.venue_order_id and event.venue_order_id are both not
None, and are not equal.InvalidStateTrigger – If event is not a valid trigger from the current order.status.
KeyError – If event is OrderFilled and event.trade_id already applied to the order.
- avg_px¶
The order average fill price.
- Returns:
double
- client_order_id¶
The client order ID.
- Returns:
ClientOrderId
- static closing_side(PositionSide position_side) OrderSide¶
Return the order side needed to close a position with the given side.
- Parameters:
position_side (PositionSide {
LONG,SHORT}) – The side of the position to close.- Return type:
OrderSide
- Raises:
ValueError – If position_side is
FLATor invalid.
- commissions(self) list¶
Return the total commissions generated by the order.
- Return type:
list[Money]
- contingency_type¶
The orders contingency type.
- Returns:
ContingencyType
- static create(init)¶
- emulation_trigger¶
The order emulation trigger type.
- Returns:
TriggerType
- event_count¶
Return the count of events applied to the order.
- Return type:
int
- events¶
Return the order events.
- Return type:
list[OrderEvent]
- exec_algorithm_id¶
The execution algorithm ID for the order.
- Returns:
ExecAlgorithmId or
None
- exec_algorithm_params¶
The execution algorithm parameters for the order.
- Returns:
dict[str, Any] or
None
- exec_spawn_id¶
The execution algorithm spawning client order ID.
- Returns:
ClientOrderId or
None
- expire_time¶
Return the expire time for the order (UTC).
- Return type:
datetime or
None
- expire_time_ns¶
The order expiration (UNIX epoch nanoseconds), zero for no expiration.
- Returns:
uint64_t
- filled_qty¶
The order total filled quantity.
- Returns:
Quantity
- has_activation_price¶
Return whether the order has a activation_price property.
- Return type:
bool
- has_price¶
Return whether the order has a price property.
- Return type:
bool
- has_trigger_price¶
Return whether the order has a trigger_price property.
- Return type:
bool
- info(self) str¶
Return a summary description of the order.
- Return type:
str
- init_event¶
Return the initialization event for the order.
- Return type:
- init_id¶
The event ID of the OrderInitialized event.
- Returns:
UUID4
- instrument_id¶
The order instrument ID.
- Returns:
InstrumentId
- is_active_local¶
Return whether the order is active and held in the local system.
An order is considered active local when its status is any of: -
INITIALIZED-EMULATED-RELEASED- Return type:
bool
- is_aggressive¶
Return whether the order is aggressive (order_type is
MARKET).- Return type:
bool
- is_buy¶
Return whether the order side is
BUY.- Return type:
bool
- is_canceled¶
Return whether current status is
CANCELED.- Return type:
bool
- is_child_order¶
Return whether the order has a parent order.
- Return type:
bool
- is_closed¶
Return whether the order is closed (lifecycle completed).
An order is considered closed when its status can no longer change. The possible statuses of closed orders include;
DENIEDREJECTEDCANCELEDEXPIREDFILLED
- Return type:
bool
- is_contingency¶
Return whether the order has a contingency (contingency_type is not
NO_CONTINGENCY).- Return type:
bool
- is_duplicate_fill(self, OrderFilled fill) bool¶
Return whether a fill with matching trade_id, side, qty, and price already exists.
- Parameters:
fill (OrderFilled) – The fill event to check.
- Return type:
bool
- is_emulated¶
Return whether the order is emulated and held in the local system.
- Return type:
bool
- is_inflight¶
Return whether the order is in-flight (order request sent to the trading venue).
An order is considered in-flight when its status is any of: -
SUBMITTED-PENDING_UPDATE-PENDING_CANCEL- Return type:
bool
Warning
An emulated order is never considered in-flight.
- is_open¶
Return whether the order is open at the trading venue.
An order is considered open when its status is any of: -
ACCEPTED-TRIGGERED-PENDING_UPDATE-PENDING_CANCEL-PARTIALLY_FILLED- Return type:
bool
Warning
An emulated order is never considered open.
- is_parent_order¶
Return whether the order has at least one child order.
- Return type:
bool
- is_passive¶
Return whether the order is passive (order_type not
MARKET).- Return type:
bool
- is_pending_cancel¶
Return whether the current status is
PENDING_CANCEL.- Return type:
bool
- is_pending_update¶
Return whether the current status is
PENDING_UPDATE.- Return type:
bool
- is_post_only¶
If the order will only provide liquidity (make a market).
- Returns:
bool
- is_primary¶
Return whether the order is the primary for an execution algorithm sequence.
- Return type:
bool
- is_quote_quantity¶
If the order quantity is denominated in the quote currency.
- Returns:
bool
- is_reduce_only¶
If the order carries the ‘reduce-only’ execution instruction.
- Returns:
bool
- is_sell¶
Return whether the order side is
SELL.- Return type:
bool
- is_spawned¶
Return whether the order was spawned as part of an execution algorithm sequence.
- Return type:
bool
- last_event¶
Return the last event applied to the order.
- Return type:
- last_trade_id¶
The orders last trade match ID.
- Returns:
TradeId or
None
- leaves_qty¶
The order total leaves quantity.
- Returns:
Quantity
- linked_order_ids¶
The orders linked client order ID(s).
- Returns:
list[ClientOrderId] or
None
- liquidity_side¶
The order liquidity side.
- Returns:
LiquiditySide
- static opposite_side(OrderSide side) OrderSide¶
Return the opposite order side from the given side.
- Parameters:
side (OrderSide {
BUY,SELL}) – The original order side.- Return type:
OrderSide
- Raises:
ValueError – If side is invalid.
- order_list_id¶
The order list ID associated with the order.
- Returns:
OrderListId or
None
- order_type¶
The order type.
- Returns:
OrderType
- overfill_qty¶
The order total overfill quantity (filled beyond original quantity).
- Returns:
Quantity
- parent_order_id¶
The parent client order ID.
- Returns:
ClientOrderId or
None
- position_id¶
The position ID associated with the order.
- Returns:
PositionId or
None
- quantity¶
The order quantity.
- Returns:
Quantity
- set_quote_quantity(self, bool value) void¶
- side¶
The order side.
- Returns:
OrderSide
- side_string(self) str¶
Return the orders side as a string.
- Return type:
str
- signed_decimal_qty(self)¶
Return a signed decimal representation of the remaining quantity.
If the order is a BUY, the value is positive (e.g. Decimal(‘10.25’))
If the order is a SELL, the value is negative (e.g. Decimal(‘-10.25’))
- Return type:
Decimal
- slippage¶
The order total price slippage.
- Returns:
double
- status¶
Return the orders current status.
- Return type:
OrderStatus
- status_string(self) str¶
Return the orders current status as a string.
- Return type:
str
- strategy_id¶
The strategy ID associated with the order.
- Returns:
StrategyId
- tags¶
The order custom user tags.
- Returns:
list[str] or
None
- tif_string(self) str¶
Return the orders time in force as a string.
- Return type:
str
- time_in_force¶
The order time in force.
- Returns:
TimeInForce
- to_dict(self) dict¶
Return a dictionary representation of this object.
- Return type:
dict[str, object]
- to_own_book_order(self) nautilus_pyo3.OwnBookOrder¶
Returns an own/user order representation of this order.
- Return type:
nautilus_pyo3.OwnBookOrder
- trader_id¶
The trader ID associated with the position.
- Returns:
TraderId
- trigger_instrument_id¶
The order emulation trigger instrument ID (will be instrument_id if
None).- Returns:
InstrumentId or
None
- trigger_price¶
The order trigger price (STOP).
- Returns:
Price
- trigger_type¶
The trigger type for the order.
- Returns:
TriggerType
- ts_accepted¶
UNIX timestamp (nanoseconds) when the order was accepted or first filled (zero unless accepted or filled).
- Returns:
uint64_t
- ts_closed¶
UNIX timestamp (nanoseconds) when the order closed / lifecycle completed (zero unless closed).
- Returns:
uint64_t
- ts_init¶
UNIX timestamp (nanoseconds) when the order was initialized.
- Returns:
uint64_t
- ts_last¶
UNIX timestamp (nanoseconds) when the last order event occurred.
- Returns:
uint64_t
- ts_submitted¶
UNIX timestamp (nanoseconds) when the order was submitted (zero unless submitted).
- Returns:
uint64_t
- type_string(self) str¶
Return the orders type as a string.
- Return type:
str
- venue_order_id¶
The venue assigned order ID.
- Returns:
VenueOrderId or
None
- venue_order_ids¶
Return the venue order IDs.
- Return type:
list[VenueOrderId]
- would_reduce_only(self, PositionSide position_side, Quantity position_qty) bool¶
Whether the current order would only reduce the given position if applied in full.
- Parameters:
position_side (PositionSide {
FLAT,LONG,SHORT}) – The side of the position to check against.position_qty (Quantity) – The quantity of the position to check against.
- Return type:
bool
- class StopLimitOrder¶
Bases:
OrderStopLimitOrder(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, OrderSide order_side, Quantity quantity, Price price, Price trigger_price, TriggerType trigger_type, UUID4 init_id, uint64_t ts_init, TimeInForce time_in_force=TimeInForce.GTC, uint64_t expire_time_ns=0, bool post_only=False, bool reduce_only=False, bool quote_quantity=False, Quantity display_qty=None, TriggerType emulation_trigger=TriggerType.NO_TRIGGER, InstrumentId trigger_instrument_id=None, ContingencyType contingency_type=ContingencyType.NO_CONTINGENCY, OrderListId order_list_id=None, list linked_order_ids=None, ClientOrderId parent_order_id=None, ExecAlgorithmId exec_algorithm_id=None, dict exec_algorithm_params=None, ClientOrderId exec_spawn_id=None, list tags=None)
Represents a Stop-Limit conditional order.
A Stop-Limit order is an instruction to submit a BUY (or SELL) limit order when the specified stop trigger price is attained or penetrated. The order has two basic components: the stop price and the limit price. When a trade has occurred at or through the stop price, the order becomes executable and enters the market as a limit order, which is an order to BUY (or SELL) at a specified price or better.
A Stop-Limit eliminates the price risk associated with a stop order where the execution price cannot be guaranteed, but exposes the trader to the risk that the order may never fill, even if the stop price is reached.
- Parameters:
trader_id (TraderId) – The trader ID associated with the order.
strategy_id (StrategyId) – The strategy ID associated with the order.
instrument_id (InstrumentId) – The order instrument ID.
client_order_id (ClientOrderId) – The client order ID.
order_side (OrderSide {
BUY,SELL}) – The order side.quantity (Quantity) – The order quantity (> 0).
price (Price) – The order price (LIMIT).
trigger_price (Price) – The order trigger price (STOP).
trigger_type (TriggerType) – The order trigger type.
init_id (UUID4) – The order initialization event ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
time_in_force (TimeInForce {
GTC,IOC,FOK,GTD,DAY}, defaultGTC) – The order time in force.expire_time_ns (uint64_t, default 0 (no expiry)) – UNIX timestamp (nanoseconds) when the order will expire.
post_only (bool, default False) – If the
LIMITorder will only provide liquidity (once triggered).reduce_only (bool, default False) – If the
LIMITorder carries the ‘reduce-only’ execution instruction.quote_quantity (bool, default False) – If the order quantity is denominated in the quote currency.
display_qty (Quantity, optional) – The quantity of the
LIMITorder to display on the public book (iceberg).emulation_trigger (EmulationTrigger, default
NO_TRIGGER) – The emulation trigger for the order.trigger_instrument_id (InstrumentId, optional) – The emulation trigger instrument ID for the order (if
Nonethen will be the instrument_id).contingency_type (ContingencyType, default
NO_CONTINGENCY) – The order contingency type.order_list_id (OrderListId, optional) – The order list ID associated with the order.
linked_order_ids (list[ClientOrderId], optional) – The order linked client order ID(s).
parent_order_id (ClientOrderId, optional) – The order parent client order ID.
exec_algorithm_id (ExecAlgorithmId, optional) – The execution algorithm ID for the order.
exec_algorithm_params (dict[str, Any], optional) – The execution algorithm parameters for the order.
exec_spawn_id (ClientOrderId, optional) – The execution algorithm spawning primary client order ID.
tags (list[str], optional) – The custom user tags for the order.
- Raises:
ValueError – If order_side is
NO_ORDER_SIDE.ValueError – If quantity is not positive (> 0).
ValueError – If trigger_type is
NO_TRIGGER.ValueError – If time_in_force is
AT_THE_OPENorAT_THE_CLOSE.ValueError – If time_in_force is
GTDand expire_time_ns <= UNIX epoch.ValueError – If display_qty is negative (< 0) or greater than quantity.
- account_id¶
The account ID associated with the order.
- Returns:
AccountId or
None
- apply(self, OrderEvent event) void¶
Apply the given order event to the order.
- Parameters:
event (OrderEvent) – The order event to apply.
- Raises:
ValueError – If self.client_order_id is not equal to event.client_order_id.
ValueError – If self.venue_order_id and event.venue_order_id are both not
None, and are not equal.InvalidStateTrigger – If event is not a valid trigger from the current order.status.
KeyError – If event is OrderFilled and event.trade_id already applied to the order.
- avg_px¶
The order average fill price.
- Returns:
double
- client_order_id¶
The client order ID.
- Returns:
ClientOrderId
- static closing_side(PositionSide position_side) OrderSide¶
Return the order side needed to close a position with the given side.
- Parameters:
position_side (PositionSide {
LONG,SHORT}) – The side of the position to close.- Return type:
OrderSide
- Raises:
ValueError – If position_side is
FLATor invalid.
- commissions(self) list¶
Return the total commissions generated by the order.
- Return type:
list[Money]
- contingency_type¶
The orders contingency type.
- Returns:
ContingencyType
- static create(init)¶
- display_qty¶
The quantity of the
LIMITorder to display on the public book (iceberg).- Returns:
Quantity or
None
- emulation_trigger¶
The order emulation trigger type.
- Returns:
TriggerType
- event_count¶
Return the count of events applied to the order.
- Return type:
int
- events¶
Return the order events.
- Return type:
list[OrderEvent]
- exec_algorithm_id¶
The execution algorithm ID for the order.
- Returns:
ExecAlgorithmId or
None
- exec_algorithm_params¶
The execution algorithm parameters for the order.
- Returns:
dict[str, Any] or
None
- exec_spawn_id¶
The execution algorithm spawning client order ID.
- Returns:
ClientOrderId or
None
- expire_time¶
Return the expire time for the order (UTC).
- Return type:
datetime or
None
- expire_time_ns¶
The order expiration (UNIX epoch nanoseconds), zero for no expiration.
- Returns:
uint64_t
- filled_qty¶
The order total filled quantity.
- Returns:
Quantity
- static from_pyo3(pyo3_order)¶
- has_activation_price¶
Return whether the order has a activation_price property.
- Return type:
bool
- has_price¶
Return whether the order has a price property.
- Return type:
bool
- has_trigger_price¶
Return whether the order has a trigger_price property.
- Return type:
bool
- info(self) str¶
Return a summary description of the order.
- Return type:
str
- init_event¶
Return the initialization event for the order.
- Return type:
- init_id¶
The event ID of the OrderInitialized event.
- Returns:
UUID4
- instrument_id¶
The order instrument ID.
- Returns:
InstrumentId
- is_active_local¶
Return whether the order is active and held in the local system.
An order is considered active local when its status is any of: -
INITIALIZED-EMULATED-RELEASED- Return type:
bool
- is_aggressive¶
Return whether the order is aggressive (order_type is
MARKET).- Return type:
bool
- is_buy¶
Return whether the order side is
BUY.- Return type:
bool
- is_canceled¶
Return whether current status is
CANCELED.- Return type:
bool
- is_child_order¶
Return whether the order has a parent order.
- Return type:
bool
- is_closed¶
Return whether the order is closed (lifecycle completed).
An order is considered closed when its status can no longer change. The possible statuses of closed orders include;
DENIEDREJECTEDCANCELEDEXPIREDFILLED
- Return type:
bool
- is_contingency¶
Return whether the order has a contingency (contingency_type is not
NO_CONTINGENCY).- Return type:
bool
- is_duplicate_fill(self, OrderFilled fill) bool¶
Return whether a fill with matching trade_id, side, qty, and price already exists.
- Parameters:
fill (OrderFilled) – The fill event to check.
- Return type:
bool
- is_emulated¶
Return whether the order is emulated and held in the local system.
- Return type:
bool
- is_inflight¶
Return whether the order is in-flight (order request sent to the trading venue).
An order is considered in-flight when its status is any of: -
SUBMITTED-PENDING_UPDATE-PENDING_CANCEL- Return type:
bool
Warning
An emulated order is never considered in-flight.
- is_open¶
Return whether the order is open at the trading venue.
An order is considered open when its status is any of: -
ACCEPTED-TRIGGERED-PENDING_UPDATE-PENDING_CANCEL-PARTIALLY_FILLED- Return type:
bool
Warning
An emulated order is never considered open.
- is_parent_order¶
Return whether the order has at least one child order.
- Return type:
bool
- is_passive¶
Return whether the order is passive (order_type not
MARKET).- Return type:
bool
- is_pending_cancel¶
Return whether the current status is
PENDING_CANCEL.- Return type:
bool
- is_pending_update¶
Return whether the current status is
PENDING_UPDATE.- Return type:
bool
- is_post_only¶
If the order will only provide liquidity (make a market).
- Returns:
bool
- is_primary¶
Return whether the order is the primary for an execution algorithm sequence.
- Return type:
bool
- is_quote_quantity¶
If the order quantity is denominated in the quote currency.
- Returns:
bool
- is_reduce_only¶
If the order carries the ‘reduce-only’ execution instruction.
- Returns:
bool
- is_sell¶
Return whether the order side is
SELL.- Return type:
bool
- is_spawned¶
Return whether the order was spawned as part of an execution algorithm sequence.
- Return type:
bool
- is_triggered¶
If the order has been triggered.
- Returns:
bool
- last_event¶
Return the last event applied to the order.
- Return type:
- last_trade_id¶
The orders last trade match ID.
- Returns:
TradeId or
None
- leaves_qty¶
The order total leaves quantity.
- Returns:
Quantity
- linked_order_ids¶
The orders linked client order ID(s).
- Returns:
list[ClientOrderId] or
None
- liquidity_side¶
The order liquidity side.
- Returns:
LiquiditySide
- static opposite_side(OrderSide side) OrderSide¶
Return the opposite order side from the given side.
- Parameters:
side (OrderSide {
BUY,SELL}) – The original order side.- Return type:
OrderSide
- Raises:
ValueError – If side is invalid.
- order_list_id¶
The order list ID associated with the order.
- Returns:
OrderListId or
None
- order_type¶
The order type.
- Returns:
OrderType
- overfill_qty¶
The order total overfill quantity (filled beyond original quantity).
- Returns:
Quantity
- parent_order_id¶
The parent client order ID.
- Returns:
ClientOrderId or
None
- position_id¶
The position ID associated with the order.
- Returns:
PositionId or
None
- price¶
The order price (LIMIT).
- Returns:
Price
- quantity¶
The order quantity.
- Returns:
Quantity
- set_quote_quantity(self, bool value) void¶
- side¶
The order side.
- Returns:
OrderSide
- side_string(self) str¶
Return the orders side as a string.
- Return type:
str
- signed_decimal_qty(self)¶
Return a signed decimal representation of the remaining quantity.
If the order is a BUY, the value is positive (e.g. Decimal(‘10.25’))
If the order is a SELL, the value is negative (e.g. Decimal(‘-10.25’))
- Return type:
Decimal
- slippage¶
The order total price slippage.
- Returns:
double
- status¶
Return the orders current status.
- Return type:
OrderStatus
- status_string(self) str¶
Return the orders current status as a string.
- Return type:
str
- strategy_id¶
The strategy ID associated with the order.
- Returns:
StrategyId
- tags¶
The order custom user tags.
- Returns:
list[str] or
None
- tif_string(self) str¶
Return the orders time in force as a string.
- Return type:
str
- time_in_force¶
The order time in force.
- Returns:
TimeInForce
- to_dict(self) dict¶
Return a dictionary representation of this object.
- Return type:
dict[str, object]
- to_own_book_order(self) nautilus_pyo3.OwnBookOrder¶
Returns an own/user order representation of this order.
- Return type:
nautilus_pyo3.OwnBookOrder
- trader_id¶
The trader ID associated with the position.
- Returns:
TraderId
- trigger_instrument_id¶
The order emulation trigger instrument ID (will be instrument_id if
None).- Returns:
InstrumentId or
None
- trigger_price¶
The order trigger price (STOP).
- Returns:
Price
- trigger_type¶
The trigger type for the order.
- Returns:
TriggerType
- ts_accepted¶
UNIX timestamp (nanoseconds) when the order was accepted or first filled (zero unless accepted or filled).
- Returns:
uint64_t
- ts_closed¶
UNIX timestamp (nanoseconds) when the order closed / lifecycle completed (zero unless closed).
- Returns:
uint64_t
- ts_init¶
UNIX timestamp (nanoseconds) when the order was initialized.
- Returns:
uint64_t
- ts_last¶
UNIX timestamp (nanoseconds) when the last order event occurred.
- Returns:
uint64_t
- ts_submitted¶
UNIX timestamp (nanoseconds) when the order was submitted (zero unless submitted).
- Returns:
uint64_t
- ts_triggered¶
UNIX timestamp (nanoseconds) when the order was triggered (0 if not triggered).
- Returns:
uint64_t
- type_string(self) str¶
Return the orders type as a string.
- Return type:
str
- venue_order_id¶
The venue assigned order ID.
- Returns:
VenueOrderId or
None
- venue_order_ids¶
Return the venue order IDs.
- Return type:
list[VenueOrderId]
- would_reduce_only(self, PositionSide position_side, Quantity position_qty) bool¶
Whether the current order would only reduce the given position if applied in full.
- Parameters:
position_side (PositionSide {
FLAT,LONG,SHORT}) – The side of the position to check against.position_qty (Quantity) – The quantity of the position to check against.
- Return type:
bool
- class MarketToLimitOrder¶
Bases:
OrderMarketToLimitOrder(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, OrderSide order_side, Quantity quantity, UUID4 init_id, uint64_t ts_init, TimeInForce time_in_force=TimeInForce.GTC, uint64_t expire_time_ns=0, bool reduce_only=False, bool quote_quantity=False, Quantity display_qty=None, ContingencyType contingency_type=ContingencyType.NO_CONTINGENCY, OrderListId order_list_id=None, list linked_order_ids=None, ClientOrderId parent_order_id=None, ExecAlgorithmId exec_algorithm_id=None, dict exec_algorithm_params=None, ClientOrderId exec_spawn_id=None, list tags=None)
Represents a Market-To-Limit (MTL) order.
A Market-to-Limit (MTL) order is submitted as a market order to execute at the current best market price. If the order is only partially filled, the remainder of the order is canceled and re-submitted as a Limit order with the limit price equal to the price at which the filled portion of the order executed.
- Parameters:
trader_id (TraderId) – The trader ID associated with the order.
strategy_id (StrategyId) – The strategy ID associated with the order.
instrument_id (InstrumentId) – The order instrument ID.
client_order_id (ClientOrderId) – The client order ID.
order_side (OrderSide {
BUY,SELL}) – The order side.quantity (Quantity) – The order quantity (> 0).
init_id (UUID4) – The order initialization event ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
time_in_force (TimeInForce {
GTC,IOC,FOK,GTD,DAY}, defaultGTC) – The order time in force.expire_time_ns (uint64_t, default 0 (no expiry)) – UNIX timestamp (nanoseconds) when the order will expire.
reduce_only (bool, default False) – If the order carries the ‘reduce-only’ execution instruction.
quote_quantity (bool, default False) – If the order quantity is denominated in the quote currency.
display_qty (Quantity, optional) – The quantity of the limit order to display on the public book (iceberg).
contingency_type (ContingencyType, default
NO_CONTINGENCY) – The order contingency type.order_list_id (OrderListId, optional) – The order list ID associated with the order.
linked_order_ids (list[ClientOrderId], optional) – The order linked client order ID(s).
parent_order_id (ClientOrderId, optional) – The order parent client order ID.
exec_algorithm_id (ExecAlgorithmId, optional) – The execution algorithm ID for the order.
exec_algorithm_params (dict[str, Any], optional) – The execution algorithm parameters for the order.
exec_spawn_id (ClientOrderId, optional) – The execution algorithm spawning primary client order ID.
tags (list[str], optional) – The custom user tags for the order.
- Raises:
ValueError – If order_side is
NO_ORDER_SIDE.ValueError – If quantity is not positive (> 0).
ValueError – If time_in_force is
AT_THE_OPENorAT_THE_CLOSE.
- account_id¶
The account ID associated with the order.
- Returns:
AccountId or
None
- apply(self, OrderEvent event) void¶
Apply the given order event to the order.
- Parameters:
event (OrderEvent) – The order event to apply.
- Raises:
ValueError – If self.client_order_id is not equal to event.client_order_id.
ValueError – If self.venue_order_id and event.venue_order_id are both not
None, and are not equal.InvalidStateTrigger – If event is not a valid trigger from the current order.status.
KeyError – If event is OrderFilled and event.trade_id already applied to the order.
- avg_px¶
The order average fill price.
- Returns:
double
- client_order_id¶
The client order ID.
- Returns:
ClientOrderId
- static closing_side(PositionSide position_side) OrderSide¶
Return the order side needed to close a position with the given side.
- Parameters:
position_side (PositionSide {
LONG,SHORT}) – The side of the position to close.- Return type:
OrderSide
- Raises:
ValueError – If position_side is
FLATor invalid.
- commissions(self) list¶
Return the total commissions generated by the order.
- Return type:
list[Money]
- contingency_type¶
The orders contingency type.
- Returns:
ContingencyType
- static create(init)¶
- display_qty¶
The quantity of the limit order to display on the public book (iceberg).
- Returns:
Quantity or
None
- emulation_trigger¶
The order emulation trigger type.
- Returns:
TriggerType
- event_count¶
Return the count of events applied to the order.
- Return type:
int
- events¶
Return the order events.
- Return type:
list[OrderEvent]
- exec_algorithm_id¶
The execution algorithm ID for the order.
- Returns:
ExecAlgorithmId or
None
- exec_algorithm_params¶
The execution algorithm parameters for the order.
- Returns:
dict[str, Any] or
None
- exec_spawn_id¶
The execution algorithm spawning client order ID.
- Returns:
ClientOrderId or
None
- expire_time¶
Return the expire time for the order (UTC).
- Return type:
datetime or
None
- expire_time_ns¶
The order expiration (UNIX epoch nanoseconds), zero for no expiration.
- Returns:
uint64_t
- filled_qty¶
The order total filled quantity.
- Returns:
Quantity
- has_activation_price¶
Return whether the order has a activation_price property.
- Return type:
bool
- has_price¶
Return whether the order has a price property.
- Return type:
bool
- has_trigger_price¶
Return whether the order has a trigger_price property.
- Return type:
bool
- info(self) str¶
Return a summary description of the order.
- Return type:
str
- init_event¶
Return the initialization event for the order.
- Return type:
- init_id¶
The event ID of the OrderInitialized event.
- Returns:
UUID4
- instrument_id¶
The order instrument ID.
- Returns:
InstrumentId
- is_active_local¶
Return whether the order is active and held in the local system.
An order is considered active local when its status is any of: -
INITIALIZED-EMULATED-RELEASED- Return type:
bool
- is_aggressive¶
Return whether the order is aggressive (order_type is
MARKET).- Return type:
bool
- is_buy¶
Return whether the order side is
BUY.- Return type:
bool
- is_canceled¶
Return whether current status is
CANCELED.- Return type:
bool
- is_child_order¶
Return whether the order has a parent order.
- Return type:
bool
- is_closed¶
Return whether the order is closed (lifecycle completed).
An order is considered closed when its status can no longer change. The possible statuses of closed orders include;
DENIEDREJECTEDCANCELEDEXPIREDFILLED
- Return type:
bool
- is_contingency¶
Return whether the order has a contingency (contingency_type is not
NO_CONTINGENCY).- Return type:
bool
- is_duplicate_fill(self, OrderFilled fill) bool¶
Return whether a fill with matching trade_id, side, qty, and price already exists.
- Parameters:
fill (OrderFilled) – The fill event to check.
- Return type:
bool
- is_emulated¶
Return whether the order is emulated and held in the local system.
- Return type:
bool
- is_inflight¶
Return whether the order is in-flight (order request sent to the trading venue).
An order is considered in-flight when its status is any of: -
SUBMITTED-PENDING_UPDATE-PENDING_CANCEL- Return type:
bool
Warning
An emulated order is never considered in-flight.
- is_open¶
Return whether the order is open at the trading venue.
An order is considered open when its status is any of: -
ACCEPTED-TRIGGERED-PENDING_UPDATE-PENDING_CANCEL-PARTIALLY_FILLED- Return type:
bool
Warning
An emulated order is never considered open.
- is_parent_order¶
Return whether the order has at least one child order.
- Return type:
bool
- is_passive¶
Return whether the order is passive (order_type not
MARKET).- Return type:
bool
- is_pending_cancel¶
Return whether the current status is
PENDING_CANCEL.- Return type:
bool
- is_pending_update¶
Return whether the current status is
PENDING_UPDATE.- Return type:
bool
- is_post_only¶
If the order will only provide liquidity (make a market).
- Returns:
bool
- is_primary¶
Return whether the order is the primary for an execution algorithm sequence.
- Return type:
bool
- is_quote_quantity¶
If the order quantity is denominated in the quote currency.
- Returns:
bool
- is_reduce_only¶
If the order carries the ‘reduce-only’ execution instruction.
- Returns:
bool
- is_sell¶
Return whether the order side is
SELL.- Return type:
bool
- is_spawned¶
Return whether the order was spawned as part of an execution algorithm sequence.
- Return type:
bool
- last_event¶
Return the last event applied to the order.
- Return type:
- last_trade_id¶
The orders last trade match ID.
- Returns:
TradeId or
None
- leaves_qty¶
The order total leaves quantity.
- Returns:
Quantity
- linked_order_ids¶
The orders linked client order ID(s).
- Returns:
list[ClientOrderId] or
None
- liquidity_side¶
The order liquidity side.
- Returns:
LiquiditySide
- static opposite_side(OrderSide side) OrderSide¶
Return the opposite order side from the given side.
- Parameters:
side (OrderSide {
BUY,SELL}) – The original order side.- Return type:
OrderSide
- Raises:
ValueError – If side is invalid.
- order_list_id¶
The order list ID associated with the order.
- Returns:
OrderListId or
None
- order_type¶
The order type.
- Returns:
OrderType
- overfill_qty¶
The order total overfill quantity (filled beyond original quantity).
- Returns:
Quantity
- parent_order_id¶
The parent client order ID.
- Returns:
ClientOrderId or
None
- position_id¶
The position ID associated with the order.
- Returns:
PositionId or
None
- price¶
The order price (LIMIT).
- Returns:
Price or
None
- quantity¶
The order quantity.
- Returns:
Quantity
- set_quote_quantity(self, bool value) void¶
- side¶
The order side.
- Returns:
OrderSide
- side_string(self) str¶
Return the orders side as a string.
- Return type:
str
- signed_decimal_qty(self)¶
Return a signed decimal representation of the remaining quantity.
If the order is a BUY, the value is positive (e.g. Decimal(‘10.25’))
If the order is a SELL, the value is negative (e.g. Decimal(‘-10.25’))
- Return type:
Decimal
- slippage¶
The order total price slippage.
- Returns:
double
- status¶
Return the orders current status.
- Return type:
OrderStatus
- status_string(self) str¶
Return the orders current status as a string.
- Return type:
str
- strategy_id¶
The strategy ID associated with the order.
- Returns:
StrategyId
- tags¶
The order custom user tags.
- Returns:
list[str] or
None
- tif_string(self) str¶
Return the orders time in force as a string.
- Return type:
str
- time_in_force¶
The order time in force.
- Returns:
TimeInForce
- to_dict(self) dict¶
Return a dictionary representation of this object.
- Return type:
dict[str, object]
- to_own_book_order(self) nautilus_pyo3.OwnBookOrder¶
Returns an own/user order representation of this order.
- Return type:
nautilus_pyo3.OwnBookOrder
- trader_id¶
The trader ID associated with the position.
- Returns:
TraderId
- trigger_instrument_id¶
The order emulation trigger instrument ID (will be instrument_id if
None).- Returns:
InstrumentId or
None
- ts_accepted¶
UNIX timestamp (nanoseconds) when the order was accepted or first filled (zero unless accepted or filled).
- Returns:
uint64_t
- ts_closed¶
UNIX timestamp (nanoseconds) when the order closed / lifecycle completed (zero unless closed).
- Returns:
uint64_t
- ts_init¶
UNIX timestamp (nanoseconds) when the order was initialized.
- Returns:
uint64_t
- ts_last¶
UNIX timestamp (nanoseconds) when the last order event occurred.
- Returns:
uint64_t
- ts_submitted¶
UNIX timestamp (nanoseconds) when the order was submitted (zero unless submitted).
- Returns:
uint64_t
- type_string(self) str¶
Return the orders type as a string.
- Return type:
str
- venue_order_id¶
The venue assigned order ID.
- Returns:
VenueOrderId or
None
- venue_order_ids¶
Return the venue order IDs.
- Return type:
list[VenueOrderId]
- would_reduce_only(self, PositionSide position_side, Quantity position_qty) bool¶
Whether the current order would only reduce the given position if applied in full.
- Parameters:
position_side (PositionSide {
FLAT,LONG,SHORT}) – The side of the position to check against.position_qty (Quantity) – The quantity of the position to check against.
- Return type:
bool
- class MarketIfTouchedOrder¶
Bases:
OrderMarketIfTouchedOrder(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, OrderSide order_side, Quantity quantity, Price trigger_price, TriggerType trigger_type, UUID4 init_id, uint64_t ts_init, TimeInForce time_in_force=TimeInForce.GTC, uint64_t expire_time_ns=0, bool reduce_only=False, bool quote_quantity=False, TriggerType emulation_trigger=TriggerType.NO_TRIGGER, InstrumentId trigger_instrument_id=None, ContingencyType contingency_type=ContingencyType.NO_CONTINGENCY, OrderListId order_list_id=None, list linked_order_ids=None, ClientOrderId parent_order_id=None, ExecAlgorithmId exec_algorithm_id=None, dict exec_algorithm_params=None, ClientOrderId exec_spawn_id=None, list tags=None)
Represents a Market-If-Touched (MIT) conditional order.
A Market-If-Touched (MIT) is an order to BUY (or SELL) an instrument below (or above) the market. This order is held in the system until the trigger price is touched, and is then submitted as a market order. An MIT order is similar to a Stop-Order, except that an MIT SELL order is placed above the current market price, and a stop SELL order is placed below.
- Parameters:
trader_id (TraderId) – The trader ID associated with the order.
strategy_id (StrategyId) – The strategy ID associated with the order.
instrument_id (InstrumentId) – The order instrument ID.
client_order_id (ClientOrderId) – The client order ID.
order_side (OrderSide {
BUY,SELL}) – The order side.quantity (Quantity) – The order quantity (> 0).
trigger_price (Price) – The order trigger price (STOP).
trigger_type (TriggerType) – The order trigger type.
init_id (UUID4) – The order initialization event ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
time_in_force (TimeInForce {
GTC,IOC,FOK,GTD,DAY}, defaultGTC) – The order time in force.expire_time_ns (uint64_t, default 0 (no expiry)) – UNIX timestamp (nanoseconds) when the order will expire.
reduce_only (bool, default False) – If the order carries the ‘reduce-only’ execution instruction.
quote_quantity (bool, default False) – If the order quantity is denominated in the quote currency.
emulation_trigger (TriggerType, default
NO_TRIGGER) – The type of market price trigger to use for local order emulation. -NO_TRIGGER(default): Disables local emulation; orders are sent directly to the venue. -DEFAULT(the same asBID_ASK): Enables local order emulation by triggering orders based on bid/ask prices. Additional trigger types are available. See the “Emulated Orders” section in the documentation for more details.trigger_instrument_id (InstrumentId, optional) – The emulation trigger instrument ID for the order (if
Nonethen will be the instrument_id).contingency_type (ContingencyType, default
NO_CONTINGENCY) – The order contingency type.order_list_id (OrderListId, optional) – The order list ID associated with the order.
linked_order_ids (list[ClientOrderId], optional) – The order linked client order ID(s).
parent_order_id (ClientOrderId, optional) – The order parent client order ID.
exec_algorithm_id (ExecAlgorithmId, optional) – The execution algorithm ID for the order.
exec_algorithm_params (dict[str, Any], optional) – The execution algorithm parameters for the order.
exec_spawn_id (ClientOrderId, optional) – The execution algorithm spawning primary client order ID.
tags (list[str], optional) – The custom user tags for the order.
- Raises:
ValueError – If order_side is
NO_ORDER_SIDE.ValueError – If quantity is not positive (> 0).
ValueError – If trigger_type is
NO_TRIGGER.ValueError – If time_in_force is
AT_THE_OPENorAT_THE_CLOSE.ValueError – If time_in_force is
GTDand expire_time_ns <= UNIX epoch.
- account_id¶
The account ID associated with the order.
- Returns:
AccountId or
None
- apply(self, OrderEvent event) void¶
Apply the given order event to the order.
- Parameters:
event (OrderEvent) – The order event to apply.
- Raises:
ValueError – If self.client_order_id is not equal to event.client_order_id.
ValueError – If self.venue_order_id and event.venue_order_id are both not
None, and are not equal.InvalidStateTrigger – If event is not a valid trigger from the current order.status.
KeyError – If event is OrderFilled and event.trade_id already applied to the order.
- avg_px¶
The order average fill price.
- Returns:
double
- client_order_id¶
The client order ID.
- Returns:
ClientOrderId
- static closing_side(PositionSide position_side) OrderSide¶
Return the order side needed to close a position with the given side.
- Parameters:
position_side (PositionSide {
LONG,SHORT}) – The side of the position to close.- Return type:
OrderSide
- Raises:
ValueError – If position_side is
FLATor invalid.
- commissions(self) list¶
Return the total commissions generated by the order.
- Return type:
list[Money]
- contingency_type¶
The orders contingency type.
- Returns:
ContingencyType
- static create(init)¶
- emulation_trigger¶
The order emulation trigger type.
- Returns:
TriggerType
- event_count¶
Return the count of events applied to the order.
- Return type:
int
- events¶
Return the order events.
- Return type:
list[OrderEvent]
- exec_algorithm_id¶
The execution algorithm ID for the order.
- Returns:
ExecAlgorithmId or
None
- exec_algorithm_params¶
The execution algorithm parameters for the order.
- Returns:
dict[str, Any] or
None
- exec_spawn_id¶
The execution algorithm spawning client order ID.
- Returns:
ClientOrderId or
None
- expire_time¶
Return the expire time for the order (UTC).
- Return type:
datetime or
None
- expire_time_ns¶
The order expiration (UNIX epoch nanoseconds), zero for no expiration.
- Returns:
uint64_t
- filled_qty¶
The order total filled quantity.
- Returns:
Quantity
- has_activation_price¶
Return whether the order has a activation_price property.
- Return type:
bool
- has_price¶
Return whether the order has a price property.
- Return type:
bool
- has_trigger_price¶
Return whether the order has a trigger_price property.
- Return type:
bool
- info(self) str¶
Return a summary description of the order.
- Return type:
str
- init_event¶
Return the initialization event for the order.
- Return type:
- init_id¶
The event ID of the OrderInitialized event.
- Returns:
UUID4
- instrument_id¶
The order instrument ID.
- Returns:
InstrumentId
- is_active_local¶
Return whether the order is active and held in the local system.
An order is considered active local when its status is any of: -
INITIALIZED-EMULATED-RELEASED- Return type:
bool
- is_aggressive¶
Return whether the order is aggressive (order_type is
MARKET).- Return type:
bool
- is_buy¶
Return whether the order side is
BUY.- Return type:
bool
- is_canceled¶
Return whether current status is
CANCELED.- Return type:
bool
- is_child_order¶
Return whether the order has a parent order.
- Return type:
bool
- is_closed¶
Return whether the order is closed (lifecycle completed).
An order is considered closed when its status can no longer change. The possible statuses of closed orders include;
DENIEDREJECTEDCANCELEDEXPIREDFILLED
- Return type:
bool
- is_contingency¶
Return whether the order has a contingency (contingency_type is not
NO_CONTINGENCY).- Return type:
bool
- is_duplicate_fill(self, OrderFilled fill) bool¶
Return whether a fill with matching trade_id, side, qty, and price already exists.
- Parameters:
fill (OrderFilled) – The fill event to check.
- Return type:
bool
- is_emulated¶
Return whether the order is emulated and held in the local system.
- Return type:
bool
- is_inflight¶
Return whether the order is in-flight (order request sent to the trading venue).
An order is considered in-flight when its status is any of: -
SUBMITTED-PENDING_UPDATE-PENDING_CANCEL- Return type:
bool
Warning
An emulated order is never considered in-flight.
- is_open¶
Return whether the order is open at the trading venue.
An order is considered open when its status is any of: -
ACCEPTED-TRIGGERED-PENDING_UPDATE-PENDING_CANCEL-PARTIALLY_FILLED- Return type:
bool
Warning
An emulated order is never considered open.
- is_parent_order¶
Return whether the order has at least one child order.
- Return type:
bool
- is_passive¶
Return whether the order is passive (order_type not
MARKET).- Return type:
bool
- is_pending_cancel¶
Return whether the current status is
PENDING_CANCEL.- Return type:
bool
- is_pending_update¶
Return whether the current status is
PENDING_UPDATE.- Return type:
bool
- is_post_only¶
If the order will only provide liquidity (make a market).
- Returns:
bool
- is_primary¶
Return whether the order is the primary for an execution algorithm sequence.
- Return type:
bool
- is_quote_quantity¶
If the order quantity is denominated in the quote currency.
- Returns:
bool
- is_reduce_only¶
If the order carries the ‘reduce-only’ execution instruction.
- Returns:
bool
- is_sell¶
Return whether the order side is
SELL.- Return type:
bool
- is_spawned¶
Return whether the order was spawned as part of an execution algorithm sequence.
- Return type:
bool
- last_event¶
Return the last event applied to the order.
- Return type:
- last_trade_id¶
The orders last trade match ID.
- Returns:
TradeId or
None
- leaves_qty¶
The order total leaves quantity.
- Returns:
Quantity
- linked_order_ids¶
The orders linked client order ID(s).
- Returns:
list[ClientOrderId] or
None
- liquidity_side¶
The order liquidity side.
- Returns:
LiquiditySide
- static opposite_side(OrderSide side) OrderSide¶
Return the opposite order side from the given side.
- Parameters:
side (OrderSide {
BUY,SELL}) – The original order side.- Return type:
OrderSide
- Raises:
ValueError – If side is invalid.
- order_list_id¶
The order list ID associated with the order.
- Returns:
OrderListId or
None
- order_type¶
The order type.
- Returns:
OrderType
- overfill_qty¶
The order total overfill quantity (filled beyond original quantity).
- Returns:
Quantity
- parent_order_id¶
The parent client order ID.
- Returns:
ClientOrderId or
None
- position_id¶
The position ID associated with the order.
- Returns:
PositionId or
None
- quantity¶
The order quantity.
- Returns:
Quantity
- set_quote_quantity(self, bool value) void¶
- side¶
The order side.
- Returns:
OrderSide
- side_string(self) str¶
Return the orders side as a string.
- Return type:
str
- signed_decimal_qty(self)¶
Return a signed decimal representation of the remaining quantity.
If the order is a BUY, the value is positive (e.g. Decimal(‘10.25’))
If the order is a SELL, the value is negative (e.g. Decimal(‘-10.25’))
- Return type:
Decimal
- slippage¶
The order total price slippage.
- Returns:
double
- status¶
Return the orders current status.
- Return type:
OrderStatus
- status_string(self) str¶
Return the orders current status as a string.
- Return type:
str
- strategy_id¶
The strategy ID associated with the order.
- Returns:
StrategyId
- tags¶
The order custom user tags.
- Returns:
list[str] or
None
- tif_string(self) str¶
Return the orders time in force as a string.
- Return type:
str
- time_in_force¶
The order time in force.
- Returns:
TimeInForce
- to_dict(self) dict¶
Return a dictionary representation of this object.
- Return type:
dict[str, object]
- to_own_book_order(self) nautilus_pyo3.OwnBookOrder¶
Returns an own/user order representation of this order.
- Return type:
nautilus_pyo3.OwnBookOrder
- trader_id¶
The trader ID associated with the position.
- Returns:
TraderId
- trigger_instrument_id¶
The order emulation trigger instrument ID (will be instrument_id if
None).- Returns:
InstrumentId or
None
- trigger_price¶
The order trigger price (STOP).
- Returns:
Price
- trigger_type¶
The trigger type for the order.
- Returns:
TriggerType
- ts_accepted¶
UNIX timestamp (nanoseconds) when the order was accepted or first filled (zero unless accepted or filled).
- Returns:
uint64_t
- ts_closed¶
UNIX timestamp (nanoseconds) when the order closed / lifecycle completed (zero unless closed).
- Returns:
uint64_t
- ts_init¶
UNIX timestamp (nanoseconds) when the order was initialized.
- Returns:
uint64_t
- ts_last¶
UNIX timestamp (nanoseconds) when the last order event occurred.
- Returns:
uint64_t
- ts_submitted¶
UNIX timestamp (nanoseconds) when the order was submitted (zero unless submitted).
- Returns:
uint64_t
- type_string(self) str¶
Return the orders type as a string.
- Return type:
str
- venue_order_id¶
The venue assigned order ID.
- Returns:
VenueOrderId or
None
- venue_order_ids¶
Return the venue order IDs.
- Return type:
list[VenueOrderId]
- would_reduce_only(self, PositionSide position_side, Quantity position_qty) bool¶
Whether the current order would only reduce the given position if applied in full.
- Parameters:
position_side (PositionSide {
FLAT,LONG,SHORT}) – The side of the position to check against.position_qty (Quantity) – The quantity of the position to check against.
- Return type:
bool
- class LimitIfTouchedOrder¶
Bases:
OrderLimitIfTouchedOrder(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, OrderSide order_side, Quantity quantity, Price price, Price trigger_price, TriggerType trigger_type, UUID4 init_id, uint64_t ts_init, TimeInForce time_in_force=TimeInForce.GTC, uint64_t expire_time_ns=0, bool post_only=False, bool reduce_only=False, bool quote_quantity=False, Quantity display_qty=None, TriggerType emulation_trigger=TriggerType.NO_TRIGGER, InstrumentId trigger_instrument_id=None, ContingencyType contingency_type=ContingencyType.NO_CONTINGENCY, OrderListId order_list_id=None, list linked_order_ids=None, ClientOrderId parent_order_id=None, ExecAlgorithmId exec_algorithm_id=None, dict exec_algorithm_params=None, ClientOrderId exec_spawn_id=None, list tags=None)
Represents a Limit-If-Touched (LIT) conditional order.
A Limit-If-Touched (LIT) is an order to BUY (or SELL) an instrument at a specified price or better, below (or above) the market. This order is held in the system until the trigger price is touched. A LIT order is similar to a Stop-Limit order, except that a LIT SELL order is placed above the current market price, and a Stop-Limit SELL order is placed below.
Using a LIT order helps to ensure that, if the order does execute, the order will not execute at a price less favorable than the limit price.
- Parameters:
trader_id (TraderId) – The trader ID associated with the order.
strategy_id (StrategyId) – The strategy ID associated with the order.
instrument_id (InstrumentId) – The order instrument ID.
client_order_id (ClientOrderId) – The client order ID.
order_side (OrderSide {
BUY,SELL}) – The order side.quantity (Quantity) – The order quantity (> 0).
price (Price) – The order price (LIMIT).
trigger_price (Price) – The order trigger price (STOP).
trigger_type (TriggerType) – The order trigger type.
init_id (UUID4) – The order initialization event ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
time_in_force (TimeInForce {
GTC,IOC,FOK,GTD,DAY}, defaultGTC) – The order time in force.expire_time_ns (uint64_t, default 0 (no expiry)) – UNIX timestamp (nanoseconds) when the order will expire.
post_only (bool, default False) – If the
LIMITorder will only provide liquidity (once triggered).reduce_only (bool, default False) – If the
LIMITorder carries the ‘reduce-only’ execution instruction.quote_quantity (bool, default False) – If the order quantity is denominated in the quote currency.
display_qty (Quantity, optional) – The quantity of the
LIMITorder to display on the public book (iceberg).emulation_trigger (TriggerType, default
NO_TRIGGER) – The type of market price trigger to use for local order emulation. -NO_TRIGGER(default): Disables local emulation; orders are sent directly to the venue. -DEFAULT(the same asBID_ASK): Enables local order emulation by triggering orders based on bid/ask prices. Additional trigger types are available. See the “Emulated Orders” section in the documentation for more details.trigger_instrument_id (InstrumentId, optional) – The emulation trigger instrument ID for the order (if
Nonethen will be the instrument_id).contingency_type (ContingencyType, default
NO_CONTINGENCY) – The order contingency type.order_list_id (OrderListId, optional) – The order list ID associated with the order.
linked_order_ids (list[ClientOrderId], optional) – The order linked client order ID(s).
parent_order_id (ClientOrderId, optional) – The order parent client order ID.
exec_algorithm_id (ExecAlgorithmId, optional) – The execution algorithm ID for the order.
exec_algorithm_params (dict[str, Any], optional) – The execution algorithm parameters for the order.
exec_spawn_id (ClientOrderId, optional) – The execution algorithm spawning primary client order ID.
tags (list[str], optional) – The custom user tags for the order.
- Raises:
ValueError – If order_side is
NO_ORDER_SIDE.ValueError – If quantity is not positive (> 0).
ValueError – If trigger_type is
NO_TRIGGER.ValueError – If time_in_force is
AT_THE_OPENorAT_THE_CLOSE.ValueError – If time_in_force is
GTDand expire_time_ns <= UNIX epoch.ValueError – If display_qty is negative (< 0) or greater than quantity.
- account_id¶
The account ID associated with the order.
- Returns:
AccountId or
None
- apply(self, OrderEvent event) void¶
Apply the given order event to the order.
- Parameters:
event (OrderEvent) – The order event to apply.
- Raises:
ValueError – If self.client_order_id is not equal to event.client_order_id.
ValueError – If self.venue_order_id and event.venue_order_id are both not
None, and are not equal.InvalidStateTrigger – If event is not a valid trigger from the current order.status.
KeyError – If event is OrderFilled and event.trade_id already applied to the order.
- avg_px¶
The order average fill price.
- Returns:
double
- client_order_id¶
The client order ID.
- Returns:
ClientOrderId
- static closing_side(PositionSide position_side) OrderSide¶
Return the order side needed to close a position with the given side.
- Parameters:
position_side (PositionSide {
LONG,SHORT}) – The side of the position to close.- Return type:
OrderSide
- Raises:
ValueError – If position_side is
FLATor invalid.
- commissions(self) list¶
Return the total commissions generated by the order.
- Return type:
list[Money]
- contingency_type¶
The orders contingency type.
- Returns:
ContingencyType
- static create(init)¶
- display_qty¶
The quantity of the
LIMITorder to display on the public book (iceberg).- Returns:
Quantity or
None
- emulation_trigger¶
The order emulation trigger type.
- Returns:
TriggerType
- event_count¶
Return the count of events applied to the order.
- Return type:
int
- events¶
Return the order events.
- Return type:
list[OrderEvent]
- exec_algorithm_id¶
The execution algorithm ID for the order.
- Returns:
ExecAlgorithmId or
None
- exec_algorithm_params¶
The execution algorithm parameters for the order.
- Returns:
dict[str, Any] or
None
- exec_spawn_id¶
The execution algorithm spawning client order ID.
- Returns:
ClientOrderId or
None
- expire_time¶
Return the expire time for the order (UTC).
- Return type:
datetime or
None
- expire_time_ns¶
The order expiration (UNIX epoch nanoseconds), zero for no expiration.
- Returns:
uint64_t
- filled_qty¶
The order total filled quantity.
- Returns:
Quantity
- has_activation_price¶
Return whether the order has a activation_price property.
- Return type:
bool
- has_price¶
Return whether the order has a price property.
- Return type:
bool
- has_trigger_price¶
Return whether the order has a trigger_price property.
- Return type:
bool
- info(self) str¶
Return a summary description of the order.
- Return type:
str
- init_event¶
Return the initialization event for the order.
- Return type:
- init_id¶
The event ID of the OrderInitialized event.
- Returns:
UUID4
- instrument_id¶
The order instrument ID.
- Returns:
InstrumentId
- is_active_local¶
Return whether the order is active and held in the local system.
An order is considered active local when its status is any of: -
INITIALIZED-EMULATED-RELEASED- Return type:
bool
- is_aggressive¶
Return whether the order is aggressive (order_type is
MARKET).- Return type:
bool
- is_buy¶
Return whether the order side is
BUY.- Return type:
bool
- is_canceled¶
Return whether current status is
CANCELED.- Return type:
bool
- is_child_order¶
Return whether the order has a parent order.
- Return type:
bool
- is_closed¶
Return whether the order is closed (lifecycle completed).
An order is considered closed when its status can no longer change. The possible statuses of closed orders include;
DENIEDREJECTEDCANCELEDEXPIREDFILLED
- Return type:
bool
- is_contingency¶
Return whether the order has a contingency (contingency_type is not
NO_CONTINGENCY).- Return type:
bool
- is_duplicate_fill(self, OrderFilled fill) bool¶
Return whether a fill with matching trade_id, side, qty, and price already exists.
- Parameters:
fill (OrderFilled) – The fill event to check.
- Return type:
bool
- is_emulated¶
Return whether the order is emulated and held in the local system.
- Return type:
bool
- is_inflight¶
Return whether the order is in-flight (order request sent to the trading venue).
An order is considered in-flight when its status is any of: -
SUBMITTED-PENDING_UPDATE-PENDING_CANCEL- Return type:
bool
Warning
An emulated order is never considered in-flight.
- is_open¶
Return whether the order is open at the trading venue.
An order is considered open when its status is any of: -
ACCEPTED-TRIGGERED-PENDING_UPDATE-PENDING_CANCEL-PARTIALLY_FILLED- Return type:
bool
Warning
An emulated order is never considered open.
- is_parent_order¶
Return whether the order has at least one child order.
- Return type:
bool
- is_passive¶
Return whether the order is passive (order_type not
MARKET).- Return type:
bool
- is_pending_cancel¶
Return whether the current status is
PENDING_CANCEL.- Return type:
bool
- is_pending_update¶
Return whether the current status is
PENDING_UPDATE.- Return type:
bool
- is_post_only¶
If the order will only provide liquidity (make a market).
- Returns:
bool
- is_primary¶
Return whether the order is the primary for an execution algorithm sequence.
- Return type:
bool
- is_quote_quantity¶
If the order quantity is denominated in the quote currency.
- Returns:
bool
- is_reduce_only¶
If the order carries the ‘reduce-only’ execution instruction.
- Returns:
bool
- is_sell¶
Return whether the order side is
SELL.- Return type:
bool
- is_spawned¶
Return whether the order was spawned as part of an execution algorithm sequence.
- Return type:
bool
- is_triggered¶
If the order has been triggered.
- Returns:
bool
- last_event¶
Return the last event applied to the order.
- Return type:
- last_trade_id¶
The orders last trade match ID.
- Returns:
TradeId or
None
- leaves_qty¶
The order total leaves quantity.
- Returns:
Quantity
- linked_order_ids¶
The orders linked client order ID(s).
- Returns:
list[ClientOrderId] or
None
- liquidity_side¶
The order liquidity side.
- Returns:
LiquiditySide
- static opposite_side(OrderSide side) OrderSide¶
Return the opposite order side from the given side.
- Parameters:
side (OrderSide {
BUY,SELL}) – The original order side.- Return type:
OrderSide
- Raises:
ValueError – If side is invalid.
- order_list_id¶
The order list ID associated with the order.
- Returns:
OrderListId or
None
- order_type¶
The order type.
- Returns:
OrderType
- overfill_qty¶
The order total overfill quantity (filled beyond original quantity).
- Returns:
Quantity
- parent_order_id¶
The parent client order ID.
- Returns:
ClientOrderId or
None
- position_id¶
The position ID associated with the order.
- Returns:
PositionId or
None
- price¶
The order price (LIMIT).
- Returns:
Price
- quantity¶
The order quantity.
- Returns:
Quantity
- set_quote_quantity(self, bool value) void¶
- side¶
The order side.
- Returns:
OrderSide
- side_string(self) str¶
Return the orders side as a string.
- Return type:
str
- signed_decimal_qty(self)¶
Return a signed decimal representation of the remaining quantity.
If the order is a BUY, the value is positive (e.g. Decimal(‘10.25’))
If the order is a SELL, the value is negative (e.g. Decimal(‘-10.25’))
- Return type:
Decimal
- slippage¶
The order total price slippage.
- Returns:
double
- status¶
Return the orders current status.
- Return type:
OrderStatus
- status_string(self) str¶
Return the orders current status as a string.
- Return type:
str
- strategy_id¶
The strategy ID associated with the order.
- Returns:
StrategyId
- tags¶
The order custom user tags.
- Returns:
list[str] or
None
- tif_string(self) str¶
Return the orders time in force as a string.
- Return type:
str
- time_in_force¶
The order time in force.
- Returns:
TimeInForce
- to_dict(self) dict¶
Return a dictionary representation of this object.
- Return type:
dict[str, object]
- to_own_book_order(self) nautilus_pyo3.OwnBookOrder¶
Returns an own/user order representation of this order.
- Return type:
nautilus_pyo3.OwnBookOrder
- trader_id¶
The trader ID associated with the position.
- Returns:
TraderId
- trigger_instrument_id¶
The order emulation trigger instrument ID (will be instrument_id if
None).- Returns:
InstrumentId or
None
- trigger_price¶
The order trigger price (STOP).
- Returns:
Price
- trigger_type¶
The trigger type for the order.
- Returns:
TriggerType
- ts_accepted¶
UNIX timestamp (nanoseconds) when the order was accepted or first filled (zero unless accepted or filled).
- Returns:
uint64_t
- ts_closed¶
UNIX timestamp (nanoseconds) when the order closed / lifecycle completed (zero unless closed).
- Returns:
uint64_t
- ts_init¶
UNIX timestamp (nanoseconds) when the order was initialized.
- Returns:
uint64_t
- ts_last¶
UNIX timestamp (nanoseconds) when the last order event occurred.
- Returns:
uint64_t
- ts_submitted¶
UNIX timestamp (nanoseconds) when the order was submitted (zero unless submitted).
- Returns:
uint64_t
- ts_triggered¶
UNIX timestamp (nanoseconds) when the order was triggered (0 if not triggered).
- Returns:
uint64_t
- type_string(self) str¶
Return the orders type as a string.
- Return type:
str
- venue_order_id¶
The venue assigned order ID.
- Returns:
VenueOrderId or
None
- venue_order_ids¶
Return the venue order IDs.
- Return type:
list[VenueOrderId]
- would_reduce_only(self, PositionSide position_side, Quantity position_qty) bool¶
Whether the current order would only reduce the given position if applied in full.
- Parameters:
position_side (PositionSide {
FLAT,LONG,SHORT}) – The side of the position to check against.position_qty (Quantity) – The quantity of the position to check against.
- Return type:
bool
- class TrailingStopMarketOrder¶
Bases:
OrderTrailingStopMarketOrder(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, OrderSide order_side, Quantity quantity, Price trigger_price: Price | None, TriggerType trigger_type, trailing_offset: Decimal, TrailingOffsetType trailing_offset_type, UUID4 init_id, uint64_t ts_init, Price activation_price: Price | None = None, TimeInForce time_in_force=TimeInForce.GTC, uint64_t expire_time_ns=0, bool reduce_only=False, bool quote_quantity=False, TriggerType emulation_trigger=TriggerType.NO_TRIGGER, InstrumentId trigger_instrument_id=None, ContingencyType contingency_type=ContingencyType.NO_CONTINGENCY, OrderListId order_list_id=None, list linked_order_ids=None, ClientOrderId parent_order_id=None, ExecAlgorithmId exec_algorithm_id=None, dict exec_algorithm_params=None, ClientOrderId exec_spawn_id=None, list tags=None)
Represents a Trailing-Stop-Market conditional order.
- Parameters:
trader_id (TraderId) – The trader ID associated with the order.
strategy_id (StrategyId) – The strategy ID associated with the order.
instrument_id (InstrumentId) – The order instrument ID.
client_order_id (ClientOrderId) – The client order ID.
order_side (OrderSide {
BUY,SELL}) – The order side.quantity (Quantity) – The order quantity (> 0).
trigger_price (Price or
None) – The order trigger price (STOP). IfNonethen will typically default to the delta of market price and trailing_offset.trigger_type (TriggerType) – The order trigger type.
trailing_offset (Decimal) – The trailing offset for the trigger price (STOP).
trailing_offset_type (TrailingOffsetType) – The order trailing offset type.
init_id (UUID4) – The order initialization event ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
activation_price (Price, optional) – The price for the order to become active. If
Nonethen the order will be activated right after the order is accepted.time_in_force (TimeInForce {
GTC,IOC,FOK,GTD,DAY}, defaultGTC) – The order time in force.expire_time_ns (uint64_t, default 0 (no expiry)) – UNIX timestamp (nanoseconds) when the order will expire.
reduce_only (bool, default False) – If the order carries the ‘reduce-only’ execution instruction.
quote_quantity (bool, default False) – If the order quantity is denominated in the quote currency.
emulation_trigger (TriggerType, default
NO_TRIGGER) – The type of market price trigger to use for local order emulation. -NO_TRIGGER(default): Disables local emulation; orders are sent directly to the venue. -DEFAULT(the same asBID_ASK): Enables local order emulation by triggering orders based on bid/ask prices. Additional trigger types are available. See the “Emulated Orders” section in the documentation for more details.trigger_instrument_id (InstrumentId, optional) – The emulation trigger instrument ID for the order (if
Nonethen will be the instrument_id).contingency_type (ContingencyType, default
NO_CONTINGENCY) – The order contingency type.order_list_id (OrderListId, optional) – The order list ID associated with the order.
linked_order_ids (list[ClientOrderId], optional) – The order linked client order ID(s).
parent_order_id (ClientOrderId, optional) – The order parent client order ID.
exec_algorithm_id (ExecAlgorithmId, optional) – The execution algorithm ID for the order.
exec_algorithm_params (dict[str, Any], optional) – The execution algorithm parameters for the order.
exec_spawn_id (ClientOrderId, optional) – The execution algorithm spawning primary client order ID.
tags (list[str], optional) – The custom user tags for the order.
- Raises:
ValueError – If order_side is
NO_ORDER_SIDE.ValueError – If quantity is not positive (> 0).
ValueError – If trigger_type is
NO_TRIGGER.ValueError – If trailing_offset_type is
NO_TRAILING_OFFSET.ValueError – If time_in_force is
AT_THE_OPENorAT_THE_CLOSE.ValueError – If time_in_force is
GTDand expire_time_ns <= UNIX epoch.
- account_id¶
The account ID associated with the order.
- Returns:
AccountId or
None
- activation_price¶
The order activation price (STOP).
- Returns:
Price or
None
- apply(self, OrderEvent event) void¶
Apply the given order event to the order.
- Parameters:
event (OrderEvent) – The order event to apply.
- Raises:
ValueError – If self.client_order_id is not equal to event.client_order_id.
ValueError – If self.venue_order_id and event.venue_order_id are both not
None, and are not equal.InvalidStateTrigger – If event is not a valid trigger from the current order.status.
KeyError – If event is OrderFilled and event.trade_id already applied to the order.
- avg_px¶
The order average fill price.
- Returns:
double
- client_order_id¶
The client order ID.
- Returns:
ClientOrderId
- static closing_side(PositionSide position_side) OrderSide¶
Return the order side needed to close a position with the given side.
- Parameters:
position_side (PositionSide {
LONG,SHORT}) – The side of the position to close.- Return type:
OrderSide
- Raises:
ValueError – If position_side is
FLATor invalid.
- commissions(self) list¶
Return the total commissions generated by the order.
- Return type:
list[Money]
- contingency_type¶
The orders contingency type.
- Returns:
ContingencyType
- static create(init)¶
- emulation_trigger¶
The order emulation trigger type.
- Returns:
TriggerType
- event_count¶
Return the count of events applied to the order.
- Return type:
int
- events¶
Return the order events.
- Return type:
list[OrderEvent]
- exec_algorithm_id¶
The execution algorithm ID for the order.
- Returns:
ExecAlgorithmId or
None
- exec_algorithm_params¶
The execution algorithm parameters for the order.
- Returns:
dict[str, Any] or
None
- exec_spawn_id¶
The execution algorithm spawning client order ID.
- Returns:
ClientOrderId or
None
- expire_time¶
Return the expire time for the order (UTC).
- Return type:
datetime or
None
- expire_time_ns¶
The order expiration (UNIX epoch nanoseconds), zero for no expiration.
- Returns:
uint64_t
- filled_qty¶
The order total filled quantity.
- Returns:
Quantity
- has_activation_price¶
Return whether the order has a activation_price property.
- Return type:
bool
- has_price¶
Return whether the order has a price property.
- Return type:
bool
- has_trigger_price¶
Return whether the order has a trigger_price property.
- Return type:
bool
- info(self) str¶
Return a summary description of the order.
- Return type:
str
- init_event¶
Return the initialization event for the order.
- Return type:
- init_id¶
The event ID of the OrderInitialized event.
- Returns:
UUID4
- instrument_id¶
The order instrument ID.
- Returns:
InstrumentId
- is_activated¶
If the order has been activated.
- Returns:
bool
- is_active_local¶
Return whether the order is active and held in the local system.
An order is considered active local when its status is any of: -
INITIALIZED-EMULATED-RELEASED- Return type:
bool
- is_aggressive¶
Return whether the order is aggressive (order_type is
MARKET).- Return type:
bool
- is_buy¶
Return whether the order side is
BUY.- Return type:
bool
- is_canceled¶
Return whether current status is
CANCELED.- Return type:
bool
- is_child_order¶
Return whether the order has a parent order.
- Return type:
bool
- is_closed¶
Return whether the order is closed (lifecycle completed).
An order is considered closed when its status can no longer change. The possible statuses of closed orders include;
DENIEDREJECTEDCANCELEDEXPIREDFILLED
- Return type:
bool
- is_contingency¶
Return whether the order has a contingency (contingency_type is not
NO_CONTINGENCY).- Return type:
bool
- is_duplicate_fill(self, OrderFilled fill) bool¶
Return whether a fill with matching trade_id, side, qty, and price already exists.
- Parameters:
fill (OrderFilled) – The fill event to check.
- Return type:
bool
- is_emulated¶
Return whether the order is emulated and held in the local system.
- Return type:
bool
- is_inflight¶
Return whether the order is in-flight (order request sent to the trading venue).
An order is considered in-flight when its status is any of: -
SUBMITTED-PENDING_UPDATE-PENDING_CANCEL- Return type:
bool
Warning
An emulated order is never considered in-flight.
- is_open¶
Return whether the order is open at the trading venue.
An order is considered open when its status is any of: -
ACCEPTED-TRIGGERED-PENDING_UPDATE-PENDING_CANCEL-PARTIALLY_FILLED- Return type:
bool
Warning
An emulated order is never considered open.
- is_parent_order¶
Return whether the order has at least one child order.
- Return type:
bool
- is_passive¶
Return whether the order is passive (order_type not
MARKET).- Return type:
bool
- is_pending_cancel¶
Return whether the current status is
PENDING_CANCEL.- Return type:
bool
- is_pending_update¶
Return whether the current status is
PENDING_UPDATE.- Return type:
bool
- is_post_only¶
If the order will only provide liquidity (make a market).
- Returns:
bool
- is_primary¶
Return whether the order is the primary for an execution algorithm sequence.
- Return type:
bool
- is_quote_quantity¶
If the order quantity is denominated in the quote currency.
- Returns:
bool
- is_reduce_only¶
If the order carries the ‘reduce-only’ execution instruction.
- Returns:
bool
- is_sell¶
Return whether the order side is
SELL.- Return type:
bool
- is_spawned¶
Return whether the order was spawned as part of an execution algorithm sequence.
- Return type:
bool
- last_event¶
Return the last event applied to the order.
- Return type:
- last_trade_id¶
The orders last trade match ID.
- Returns:
TradeId or
None
- leaves_qty¶
The order total leaves quantity.
- Returns:
Quantity
- linked_order_ids¶
The orders linked client order ID(s).
- Returns:
list[ClientOrderId] or
None
- liquidity_side¶
The order liquidity side.
- Returns:
LiquiditySide
- static opposite_side(OrderSide side) OrderSide¶
Return the opposite order side from the given side.
- Parameters:
side (OrderSide {
BUY,SELL}) – The original order side.- Return type:
OrderSide
- Raises:
ValueError – If side is invalid.
- order_list_id¶
The order list ID associated with the order.
- Returns:
OrderListId or
None
- order_type¶
The order type.
- Returns:
OrderType
- overfill_qty¶
The order total overfill quantity (filled beyond original quantity).
- Returns:
Quantity
- parent_order_id¶
The parent client order ID.
- Returns:
ClientOrderId or
None
- position_id¶
The position ID associated with the order.
- Returns:
PositionId or
None
- quantity¶
The order quantity.
- Returns:
Quantity
- set_quote_quantity(self, bool value) void¶
- side¶
The order side.
- Returns:
OrderSide
- side_string(self) str¶
Return the orders side as a string.
- Return type:
str
- signed_decimal_qty(self)¶
Return a signed decimal representation of the remaining quantity.
If the order is a BUY, the value is positive (e.g. Decimal(‘10.25’))
If the order is a SELL, the value is negative (e.g. Decimal(‘-10.25’))
- Return type:
Decimal
- slippage¶
The order total price slippage.
- Returns:
double
- status¶
Return the orders current status.
- Return type:
OrderStatus
- status_string(self) str¶
Return the orders current status as a string.
- Return type:
str
- strategy_id¶
The strategy ID associated with the order.
- Returns:
StrategyId
- tags¶
The order custom user tags.
- Returns:
list[str] or
None
- tif_string(self) str¶
Return the orders time in force as a string.
- Return type:
str
- time_in_force¶
The order time in force.
- Returns:
TimeInForce
- to_dict(self) dict¶
Return a dictionary representation of this object.
- Return type:
dict[str, object]
- to_own_book_order(self) nautilus_pyo3.OwnBookOrder¶
Returns an own/user order representation of this order.
- Return type:
nautilus_pyo3.OwnBookOrder
- trader_id¶
The trader ID associated with the position.
- Returns:
TraderId
- trailing_offset¶
The trailing offset for the orders trigger price (STOP).
- Returns:
Decimal
- trailing_offset_type¶
The trailing offset type.
- Returns:
TrailingOffsetType
- trigger_instrument_id¶
The order emulation trigger instrument ID (will be instrument_id if
None).- Returns:
InstrumentId or
None
- trigger_price¶
The order trigger price (STOP).
- Returns:
Price or
None
- trigger_type¶
The trigger type for the order.
- Returns:
TriggerType
- ts_accepted¶
UNIX timestamp (nanoseconds) when the order was accepted or first filled (zero unless accepted or filled).
- Returns:
uint64_t
- ts_closed¶
UNIX timestamp (nanoseconds) when the order closed / lifecycle completed (zero unless closed).
- Returns:
uint64_t
- ts_init¶
UNIX timestamp (nanoseconds) when the order was initialized.
- Returns:
uint64_t
- ts_last¶
UNIX timestamp (nanoseconds) when the last order event occurred.
- Returns:
uint64_t
- ts_submitted¶
UNIX timestamp (nanoseconds) when the order was submitted (zero unless submitted).
- Returns:
uint64_t
- type_string(self) str¶
Return the orders type as a string.
- Return type:
str
- venue_order_id¶
The venue assigned order ID.
- Returns:
VenueOrderId or
None
- venue_order_ids¶
Return the venue order IDs.
- Return type:
list[VenueOrderId]
- would_reduce_only(self, PositionSide position_side, Quantity position_qty) bool¶
Whether the current order would only reduce the given position if applied in full.
- Parameters:
position_side (PositionSide {
FLAT,LONG,SHORT}) – The side of the position to check against.position_qty (Quantity) – The quantity of the position to check against.
- Return type:
bool
- class TrailingStopLimitOrder¶
Bases:
OrderTrailingStopLimitOrder(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, OrderSide order_side, Quantity quantity, Price price: Price | None, Price trigger_price: Price | None, TriggerType trigger_type, limit_offset: Decimal, trailing_offset: Decimal, TrailingOffsetType trailing_offset_type, UUID4 init_id, uint64_t ts_init, Price activation_price: Price | None = None, TimeInForce time_in_force=TimeInForce.GTC, uint64_t expire_time_ns=0, bool post_only=False, bool reduce_only=False, bool quote_quantity=False, Quantity display_qty=None, TriggerType emulation_trigger=TriggerType.NO_TRIGGER, InstrumentId trigger_instrument_id=None, ContingencyType contingency_type=ContingencyType.NO_CONTINGENCY, OrderListId order_list_id=None, list linked_order_ids=None, ClientOrderId parent_order_id=None, ExecAlgorithmId exec_algorithm_id=None, dict exec_algorithm_params=None, ClientOrderId exec_spawn_id=None, list tags=None)
Represents a Trailing-Stop-Limit conditional order.
- Parameters:
trader_id (TraderId) – The trader ID associated with the order.
strategy_id (StrategyId) – The strategy ID associated with the order.
instrument_id (InstrumentId) – The order instrument ID.
client_order_id (ClientOrderId) – The client order ID.
order_side (OrderSide {
BUY,SELL}) – The order side.quantity (Quantity) – The order quantity (> 0).
price (Price or
None) – The order price (LIMIT). IfNonethen will typically default to the delta of market price and limit_offset.trigger_price (Price or
None) – The order trigger price (STOP). IfNonethen will typically default to the delta of market price and trailing_offset.trigger_type (TriggerType) – The order trigger type.
limit_offset (Decimal) – The trailing offset for the order price (LIMIT).
trailing_offset (Decimal) – The trailing offset for the order trigger price (STOP).
trailing_offset_type (TrailingOffsetType) – The order trailing offset type.
init_id (UUID4) – The order initialization event ID.
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
activation_price (Price, optional) – The price for the order to become active. If
Nonethen the order will be activated right after the order is accepted.time_in_force (TimeInForce {
GTC,IOC,FOK,GTD,DAY}, defaultGTC) – The order time in force.expire_time_ns (uint64_t, default 0 (no expiry)) – UNIX timestamp (nanoseconds) when the order will expire.
post_only (bool, default False) – If the
LIMITorder will only provide liquidity (once triggered).reduce_only (bool, default False) – If the
LIMITorder carries the ‘reduce-only’ execution instruction.quote_quantity (bool, default False) – If the order quantity is denominated in the quote currency.
display_qty (Quantity, optional) – The quantity of the
LIMITorder to display on the public book (iceberg).emulation_trigger (TriggerType, default
NO_TRIGGER) – The type of market price trigger to use for local order emulation. -NO_TRIGGER(default): Disables local emulation; orders are sent directly to the venue. -DEFAULT(the same asBID_ASK): Enables local order emulation by triggering orders based on bid/ask prices. Additional trigger types are available. See the “Emulated Orders” section in the documentation for more details.trigger_instrument_id (InstrumentId, optional) – The emulation trigger instrument ID for the order (if
Nonethen will be the instrument_id).contingency_type (ContingencyType, default
NO_CONTINGENCY) – The order contingency type.order_list_id (OrderListId, optional) – The order list ID associated with the order.
linked_order_ids (list[ClientOrderId], optional) – The order linked client order ID(s).
parent_order_id (ClientOrderId, optional) – The order parent client order ID.
exec_algorithm_id (ExecAlgorithmId, optional) – The execution algorithm ID for the order.
exec_algorithm_params (dict[str, Any], optional) – The execution algorithm parameters for the order.
exec_spawn_id (ClientOrderId, optional) – The execution algorithm spawning primary client order ID.
tags (list[str], optional) – The custom user tags for the order.
- Raises:
ValueError – If order_side is
NO_ORDER_SIDE.ValueError – If quantity is not positive (> 0).
ValueError – If trigger_type is
NO_TRIGGER.ValueError – If trailing_offset_type is
NO_TRAILING_OFFSET.ValueError – If time_in_force is
AT_THE_OPENorAT_THE_CLOSE.ValueError – If time_in_force is
GTDand expire_time_ns <= UNIX epoch.ValueError – If display_qty is negative (< 0) or greater than quantity.
- account_id¶
The account ID associated with the order.
- Returns:
AccountId or
None
- activation_price¶
The order activation price (STOP).
- Returns:
Price or
None
- apply(self, OrderEvent event) void¶
Apply the given order event to the order.
- Parameters:
event (OrderEvent) – The order event to apply.
- Raises:
ValueError – If self.client_order_id is not equal to event.client_order_id.
ValueError – If self.venue_order_id and event.venue_order_id are both not
None, and are not equal.InvalidStateTrigger – If event is not a valid trigger from the current order.status.
KeyError – If event is OrderFilled and event.trade_id already applied to the order.
- avg_px¶
The order average fill price.
- Returns:
double
- client_order_id¶
The client order ID.
- Returns:
ClientOrderId
- static closing_side(PositionSide position_side) OrderSide¶
Return the order side needed to close a position with the given side.
- Parameters:
position_side (PositionSide {
LONG,SHORT}) – The side of the position to close.- Return type:
OrderSide
- Raises:
ValueError – If position_side is
FLATor invalid.
- commissions(self) list¶
Return the total commissions generated by the order.
- Return type:
list[Money]
- contingency_type¶
The orders contingency type.
- Returns:
ContingencyType
- static create(init)¶
- display_qty¶
The quantity of the
LIMITorder to display on the public book (iceberg).- Returns:
Quantity or
None
- emulation_trigger¶
The order emulation trigger type.
- Returns:
TriggerType
- event_count¶
Return the count of events applied to the order.
- Return type:
int
- events¶
Return the order events.
- Return type:
list[OrderEvent]
- exec_algorithm_id¶
The execution algorithm ID for the order.
- Returns:
ExecAlgorithmId or
None
- exec_algorithm_params¶
The execution algorithm parameters for the order.
- Returns:
dict[str, Any] or
None
- exec_spawn_id¶
The execution algorithm spawning client order ID.
- Returns:
ClientOrderId or
None
- expire_time¶
Return the expire time for the order (UTC).
- Return type:
datetime or
None
- expire_time_ns¶
The order expiration (UNIX epoch nanoseconds), zero for no expiration.
- Returns:
uint64_t
- filled_qty¶
The order total filled quantity.
- Returns:
Quantity
- has_activation_price¶
Return whether the order has a activation_price property.
- Return type:
bool
- has_price¶
Return whether the order has a price property.
- Return type:
bool
- has_trigger_price¶
Return whether the order has a trigger_price property.
- Return type:
bool
- info(self) str¶
Return a summary description of the order.
- Return type:
str
- init_event¶
Return the initialization event for the order.
- Return type:
- init_id¶
The event ID of the OrderInitialized event.
- Returns:
UUID4
- instrument_id¶
The order instrument ID.
- Returns:
InstrumentId
- is_activated¶
If the order has been activated.
- Returns:
bool
- is_active_local¶
Return whether the order is active and held in the local system.
An order is considered active local when its status is any of: -
INITIALIZED-EMULATED-RELEASED- Return type:
bool
- is_aggressive¶
Return whether the order is aggressive (order_type is
MARKET).- Return type:
bool
- is_buy¶
Return whether the order side is
BUY.- Return type:
bool
- is_canceled¶
Return whether current status is
CANCELED.- Return type:
bool
- is_child_order¶
Return whether the order has a parent order.
- Return type:
bool
- is_closed¶
Return whether the order is closed (lifecycle completed).
An order is considered closed when its status can no longer change. The possible statuses of closed orders include;
DENIEDREJECTEDCANCELEDEXPIREDFILLED
- Return type:
bool
- is_contingency¶
Return whether the order has a contingency (contingency_type is not
NO_CONTINGENCY).- Return type:
bool
- is_duplicate_fill(self, OrderFilled fill) bool¶
Return whether a fill with matching trade_id, side, qty, and price already exists.
- Parameters:
fill (OrderFilled) – The fill event to check.
- Return type:
bool
- is_emulated¶
Return whether the order is emulated and held in the local system.
- Return type:
bool
- is_inflight¶
Return whether the order is in-flight (order request sent to the trading venue).
An order is considered in-flight when its status is any of: -
SUBMITTED-PENDING_UPDATE-PENDING_CANCEL- Return type:
bool
Warning
An emulated order is never considered in-flight.
- is_open¶
Return whether the order is open at the trading venue.
An order is considered open when its status is any of: -
ACCEPTED-TRIGGERED-PENDING_UPDATE-PENDING_CANCEL-PARTIALLY_FILLED- Return type:
bool
Warning
An emulated order is never considered open.
- is_parent_order¶
Return whether the order has at least one child order.
- Return type:
bool
- is_passive¶
Return whether the order is passive (order_type not
MARKET).- Return type:
bool
- is_pending_cancel¶
Return whether the current status is
PENDING_CANCEL.- Return type:
bool
- is_pending_update¶
Return whether the current status is
PENDING_UPDATE.- Return type:
bool
- is_post_only¶
If the order will only provide liquidity (make a market).
- Returns:
bool
- is_primary¶
Return whether the order is the primary for an execution algorithm sequence.
- Return type:
bool
- is_quote_quantity¶
If the order quantity is denominated in the quote currency.
- Returns:
bool
- is_reduce_only¶
If the order carries the ‘reduce-only’ execution instruction.
- Returns:
bool
- is_sell¶
Return whether the order side is
SELL.- Return type:
bool
- is_spawned¶
Return whether the order was spawned as part of an execution algorithm sequence.
- Return type:
bool
- is_triggered¶
If the order has been triggered.
- Returns:
bool
- last_event¶
Return the last event applied to the order.
- Return type:
- last_trade_id¶
The orders last trade match ID.
- Returns:
TradeId or
None
- leaves_qty¶
The order total leaves quantity.
- Returns:
Quantity
- limit_offset¶
The trailing offset for the orders limit price.
- Returns:
Decimal
- linked_order_ids¶
The orders linked client order ID(s).
- Returns:
list[ClientOrderId] or
None
- liquidity_side¶
The order liquidity side.
- Returns:
LiquiditySide
- static opposite_side(OrderSide side) OrderSide¶
Return the opposite order side from the given side.
- Parameters:
side (OrderSide {
BUY,SELL}) – The original order side.- Return type:
OrderSide
- Raises:
ValueError – If side is invalid.
- order_list_id¶
The order list ID associated with the order.
- Returns:
OrderListId or
None
- order_type¶
The order type.
- Returns:
OrderType
- overfill_qty¶
The order total overfill quantity (filled beyond original quantity).
- Returns:
Quantity
- parent_order_id¶
The parent client order ID.
- Returns:
ClientOrderId or
None
- position_id¶
The position ID associated with the order.
- Returns:
PositionId or
None
- price¶
The order price (LIMIT).
- Returns:
Price or
None
- quantity¶
The order quantity.
- Returns:
Quantity
- set_quote_quantity(self, bool value) void¶
- side¶
The order side.
- Returns:
OrderSide
- side_string(self) str¶
Return the orders side as a string.
- Return type:
str
- signed_decimal_qty(self)¶
Return a signed decimal representation of the remaining quantity.
If the order is a BUY, the value is positive (e.g. Decimal(‘10.25’))
If the order is a SELL, the value is negative (e.g. Decimal(‘-10.25’))
- Return type:
Decimal
- slippage¶
The order total price slippage.
- Returns:
double
- status¶
Return the orders current status.
- Return type:
OrderStatus
- status_string(self) str¶
Return the orders current status as a string.
- Return type:
str
- strategy_id¶
The strategy ID associated with the order.
- Returns:
StrategyId
- tags¶
The order custom user tags.
- Returns:
list[str] or
None
- tif_string(self) str¶
Return the orders time in force as a string.
- Return type:
str
- time_in_force¶
The order time in force.
- Returns:
TimeInForce
- to_dict(self) dict¶
Return a dictionary representation of this object.
- Return type:
dict[str, object]
- to_own_book_order(self) nautilus_pyo3.OwnBookOrder¶
Returns an own/user order representation of this order.
- Return type:
nautilus_pyo3.OwnBookOrder
- trader_id¶
The trader ID associated with the position.
- Returns:
TraderId
- trailing_offset¶
The trailing offset for the orders trigger price (STOP).
- Returns:
Decimal
- trailing_offset_type¶
The trailing offset type.
- Returns:
TrailingOffsetType
- trigger_instrument_id¶
The order emulation trigger instrument ID (will be instrument_id if
None).- Returns:
InstrumentId or
None
- trigger_price¶
The order trigger price (STOP).
- Returns:
Price or
None
- trigger_type¶
The trigger type for the order.
- Returns:
TriggerType
- ts_accepted¶
UNIX timestamp (nanoseconds) when the order was accepted or first filled (zero unless accepted or filled).
- Returns:
uint64_t
- ts_closed¶
UNIX timestamp (nanoseconds) when the order closed / lifecycle completed (zero unless closed).
- Returns:
uint64_t
- ts_init¶
UNIX timestamp (nanoseconds) when the order was initialized.
- Returns:
uint64_t
- ts_last¶
UNIX timestamp (nanoseconds) when the last order event occurred.
- Returns:
uint64_t
- ts_submitted¶
UNIX timestamp (nanoseconds) when the order was submitted (zero unless submitted).
- Returns:
uint64_t
- ts_triggered¶
UNIX timestamp (nanoseconds) when the order was triggered (0 if not triggered).
- Returns:
uint64_t
- type_string(self) str¶
Return the orders type as a string.
- Return type:
str
- venue_order_id¶
The venue assigned order ID.
- Returns:
VenueOrderId or
None
- venue_order_ids¶
Return the venue order IDs.
- Return type:
list[VenueOrderId]
- would_reduce_only(self, PositionSide position_side, Quantity position_qty) bool¶
Whether the current order would only reduce the given position if applied in full.
- Parameters:
position_side (PositionSide {
FLAT,LONG,SHORT}) – The side of the position to check against.position_qty (Quantity) – The quantity of the position to check against.
- Return type:
bool
- class OrderList¶
Bases:
objectOrderList(OrderListId order_list_id, list orders) -> None
Represents a list of bulk or related contingent orders.
All orders must be for the same instrument ID.
- Parameters:
order_list_id (OrderListId) – The order list ID.
orders (list[Order]) – The contained orders list.
- Raises:
ValueError – If orders is empty.
ValueError – If orders contains a type other than Order.
ValueError – If orders contain different instrument IDs (must all be the same instrument).
- first¶
The first order in the list (typically the parent).
- Returns:
list[Order]
- id¶
The order list ID.
- Returns:
OrderListId
- instrument_id¶
The instrument ID associated with the list.
- Returns:
InstrumentId
- is_bracket(self) bool¶
Return whether this order list represents a bracket order.
A bracket order has exactly 3 orders: an entry order (OTO contingency) with exactly 2 child orders (OUO contingency, not OCO) that are reduce-only TP/SL orders.
- Return type:
bool
- orders¶
The contained orders list.
- Returns:
list[Order]
- strategy_id¶
The strategy ID associated with the list.
- Returns:
StrategyId
- ts_init¶
UNIX timestamp (nanoseconds) when the object was initialized.
- Returns:
uint64_t
- class Order¶
Bases:
objectOrder(OrderInitialized init)
The base class for all orders.
- Parameters:
init (OrderInitialized) – The order initialized event.
Warning
This class should not be used directly, but through a concrete subclass.
- account_id¶
The account ID associated with the order.
- Returns:
AccountId or
None
- apply(self, OrderEvent event) void¶
Apply the given order event to the order.
- Parameters:
event (OrderEvent) – The order event to apply.
- Raises:
ValueError – If self.client_order_id is not equal to event.client_order_id.
ValueError – If self.venue_order_id and event.venue_order_id are both not
None, and are not equal.InvalidStateTrigger – If event is not a valid trigger from the current order.status.
KeyError – If event is OrderFilled and event.trade_id already applied to the order.
- avg_px¶
The order average fill price.
- Returns:
double
- client_order_id¶
The client order ID.
- Returns:
ClientOrderId
- static closing_side(PositionSide position_side) OrderSide¶
Return the order side needed to close a position with the given side.
- Parameters:
position_side (PositionSide {
LONG,SHORT}) – The side of the position to close.- Return type:
OrderSide
- Raises:
ValueError – If position_side is
FLATor invalid.
- commissions(self) list¶
Return the total commissions generated by the order.
- Return type:
list[Money]
- contingency_type¶
The orders contingency type.
- Returns:
ContingencyType
- emulation_trigger¶
The order emulation trigger type.
- Returns:
TriggerType
- event_count¶
Return the count of events applied to the order.
- Return type:
int
- events¶
Return the order events.
- Return type:
list[OrderEvent]
- exec_algorithm_id¶
The execution algorithm ID for the order.
- Returns:
ExecAlgorithmId or
None
- exec_algorithm_params¶
The execution algorithm parameters for the order.
- Returns:
dict[str, Any] or
None
- exec_spawn_id¶
The execution algorithm spawning client order ID.
- Returns:
ClientOrderId or
None
- filled_qty¶
The order total filled quantity.
- Returns:
Quantity
- has_activation_price¶
Return whether the order has a activation_price property.
- Return type:
bool
- has_price¶
Return whether the order has a price property.
- Return type:
bool
- has_trigger_price¶
Return whether the order has a trigger_price property.
- Return type:
bool
- info(self) str¶
Return a summary description of the order.
- Return type:
str
- init_event¶
Return the initialization event for the order.
- Return type:
- init_id¶
The event ID of the OrderInitialized event.
- Returns:
UUID4
- instrument_id¶
The order instrument ID.
- Returns:
InstrumentId
- is_active_local¶
Return whether the order is active and held in the local system.
An order is considered active local when its status is any of: -
INITIALIZED-EMULATED-RELEASED- Return type:
bool
- is_aggressive¶
Return whether the order is aggressive (order_type is
MARKET).- Return type:
bool
- is_buy¶
Return whether the order side is
BUY.- Return type:
bool
- is_canceled¶
Return whether current status is
CANCELED.- Return type:
bool
- is_child_order¶
Return whether the order has a parent order.
- Return type:
bool
- is_closed¶
Return whether the order is closed (lifecycle completed).
An order is considered closed when its status can no longer change. The possible statuses of closed orders include;
DENIEDREJECTEDCANCELEDEXPIREDFILLED
- Return type:
bool
- is_contingency¶
Return whether the order has a contingency (contingency_type is not
NO_CONTINGENCY).- Return type:
bool
- is_duplicate_fill(self, OrderFilled fill) bool¶
Return whether a fill with matching trade_id, side, qty, and price already exists.
- Parameters:
fill (OrderFilled) – The fill event to check.
- Return type:
bool
- is_emulated¶
Return whether the order is emulated and held in the local system.
- Return type:
bool
- is_inflight¶
Return whether the order is in-flight (order request sent to the trading venue).
An order is considered in-flight when its status is any of: -
SUBMITTED-PENDING_UPDATE-PENDING_CANCEL- Return type:
bool
Warning
An emulated order is never considered in-flight.
- is_open¶
Return whether the order is open at the trading venue.
An order is considered open when its status is any of: -
ACCEPTED-TRIGGERED-PENDING_UPDATE-PENDING_CANCEL-PARTIALLY_FILLED- Return type:
bool
Warning
An emulated order is never considered open.
- is_parent_order¶
Return whether the order has at least one child order.
- Return type:
bool
- is_passive¶
Return whether the order is passive (order_type not
MARKET).- Return type:
bool
- is_pending_cancel¶
Return whether the current status is
PENDING_CANCEL.- Return type:
bool
- is_pending_update¶
Return whether the current status is
PENDING_UPDATE.- Return type:
bool
- is_post_only¶
If the order will only provide liquidity (make a market).
- Returns:
bool
- is_primary¶
Return whether the order is the primary for an execution algorithm sequence.
- Return type:
bool
- is_quote_quantity¶
If the order quantity is denominated in the quote currency.
- Returns:
bool
- is_reduce_only¶
If the order carries the ‘reduce-only’ execution instruction.
- Returns:
bool
- is_sell¶
Return whether the order side is
SELL.- Return type:
bool
- is_spawned¶
Return whether the order was spawned as part of an execution algorithm sequence.
- Return type:
bool
- last_event¶
Return the last event applied to the order.
- Return type:
- last_trade_id¶
The orders last trade match ID.
- Returns:
TradeId or
None
- leaves_qty¶
The order total leaves quantity.
- Returns:
Quantity
- linked_order_ids¶
The orders linked client order ID(s).
- Returns:
list[ClientOrderId] or
None
- liquidity_side¶
The order liquidity side.
- Returns:
LiquiditySide
- static opposite_side(OrderSide side) OrderSide¶
Return the opposite order side from the given side.
- Parameters:
side (OrderSide {
BUY,SELL}) – The original order side.- Return type:
OrderSide
- Raises:
ValueError – If side is invalid.
- order_list_id¶
The order list ID associated with the order.
- Returns:
OrderListId or
None
- order_type¶
The order type.
- Returns:
OrderType
- overfill_qty¶
The order total overfill quantity (filled beyond original quantity).
- Returns:
Quantity
- parent_order_id¶
The parent client order ID.
- Returns:
ClientOrderId or
None
- position_id¶
The position ID associated with the order.
- Returns:
PositionId or
None
- quantity¶
The order quantity.
- Returns:
Quantity
- set_quote_quantity(self, bool value) void¶
- side¶
The order side.
- Returns:
OrderSide
- side_string(self) str¶
Return the orders side as a string.
- Return type:
str
- signed_decimal_qty(self)¶
Return a signed decimal representation of the remaining quantity.
If the order is a BUY, the value is positive (e.g. Decimal(‘10.25’))
If the order is a SELL, the value is negative (e.g. Decimal(‘-10.25’))
- Return type:
Decimal
- slippage¶
The order total price slippage.
- Returns:
double
- status¶
Return the orders current status.
- Return type:
OrderStatus
- status_string(self) str¶
Return the orders current status as a string.
- Return type:
str
- strategy_id¶
The strategy ID associated with the order.
- Returns:
StrategyId
- tags¶
The order custom user tags.
- Returns:
list[str] or
None
- tif_string(self) str¶
Return the orders time in force as a string.
- Return type:
str
- time_in_force¶
The order time in force.
- Returns:
TimeInForce
- to_dict(self) dict¶
Return a dictionary representation of this object.
- Return type:
dict[str, object]
- to_own_book_order(self) nautilus_pyo3.OwnBookOrder¶
Returns an own/user order representation of this order.
- Return type:
nautilus_pyo3.OwnBookOrder
- trader_id¶
The trader ID associated with the position.
- Returns:
TraderId
- trigger_instrument_id¶
The order emulation trigger instrument ID (will be instrument_id if
None).- Returns:
InstrumentId or
None
- ts_accepted¶
UNIX timestamp (nanoseconds) when the order was accepted or first filled (zero unless accepted or filled).
- Returns:
uint64_t
- ts_closed¶
UNIX timestamp (nanoseconds) when the order closed / lifecycle completed (zero unless closed).
- Returns:
uint64_t
- ts_init¶
UNIX timestamp (nanoseconds) when the order was initialized.
- Returns:
uint64_t
- ts_last¶
UNIX timestamp (nanoseconds) when the last order event occurred.
- Returns:
uint64_t
- ts_submitted¶
UNIX timestamp (nanoseconds) when the order was submitted (zero unless submitted).
- Returns:
uint64_t
- type_string(self) str¶
Return the orders type as a string.
- Return type:
str
- venue_order_id¶
The venue assigned order ID.
- Returns:
VenueOrderId or
None
- venue_order_ids¶
Return the venue order IDs.
- Return type:
list[VenueOrderId]
- would_reduce_only(self, PositionSide position_side, Quantity position_qty) bool¶
Whether the current order would only reduce the given position if applied in full.
- Parameters:
position_side (PositionSide {
FLAT,LONG,SHORT}) – The side of the position to check against.position_qty (Quantity) – The quantity of the position to check against.
- Return type:
bool