Events
Defines the fundamental event types represented within the trading domain.
class AccountState
Bases: Event
AccountState(AccountId account_id, AccountType account_type, Currency base_currency, bool reported, list balances, list margins, dict info, UUID4 event_id, uint64_t ts_event, uint64_t ts_init)
Represents an event which includes information on the state of the account.
- Parameters:
- account_id (AccountId) – The account ID (with the venue).
- account_type (AccountType) – The account type for the event.
- base_currency (Currency , optional) – The account base currency. Use None for multi-currency accounts.
- reported (bool) – If the state is reported from the exchange (otherwise system calculated).
- balances (list [AccountBalance ]) – The account balances.
- margins (list [MarginBalance ]) – The margin balances (can be empty).
- info (dict *[*str , object ]) – The additional implementation specific account information.
- event_id (UUID4) – The event ID.
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the account state event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
- Raises: ValueError – If balances is empty.
account_id
The account ID associated with the event.
- Returns: AccountId
account_type
The account type for the event.
- Returns: AccountType
balances
The account balances.
- Returns: list[AccountBalance]
base_currency
The account type for the event.
- Returns:
Currency or
None
static from_dict(dict values) → AccountState
Return an account state event from the given dict values.
- Parameters: values (dict *[*str , object ]) – The values for initialization.
- Return type: AccountState
id
UUID4
The event message identifier.
- Return type: UUID4
- Type: AccountState.id
info
The additional implementation specific account information.
- Returns: dict[str, object]
is_reported
If the state is reported from the exchange (otherwise system calculated).
- Returns: bool
margins
The margin balances.
- Returns: list[MarginBalance]
static to_dict(AccountState obj)
Return a dictionary representation of this object.
- Return type: dict[str, object]
ts_event
int
UNIX timestamp (nanoseconds) when the event occurred.
- Return type: int
- Type: AccountState.ts_event
ts_init
int
UNIX timestamp (nanoseconds) when the object was initialized.
- Return type: int
- Type: AccountState.ts_init
class OrderAccepted
Bases: OrderEvent
OrderAccepted(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, VenueOrderId venue_order_id, AccountId account_id, UUID4 event_id, uint64_t ts_event, uint64_t ts_init, bool reconciliation=False)
Represents an event where an order has been accepted by the trading venue.
This event often corresponds to a NEW OrdStatus <39> field in FIX execution reports.
- Parameters:
- trader_id (TraderId) – The trader ID.
- strategy_id (StrategyId) – The strategy ID.
- instrument_id (InstrumentId) – The instrument ID.
- client_order_id (ClientOrderId) – The client order ID.
- venue_order_id (VenueOrderId) – The venue order ID (assigned by the venue).
- account_id (AccountId) – The account ID (with the venue).
- event_id (UUID4) – The event ID.
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the order accepted event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
- reconciliation (bool , default False) – If the event was generated during reconciliation.
account_id
AccountId | None
The account ID associated with the event.
- Return type:
AccountId or
None
- Type: OrderAccepted.account_id
client_order_id
ClientOrderId
The client order ID associated with the event.
- Return type: ClientOrderId
- Type: OrderAccepted.client_order_id
static from_dict(dict values) → OrderAccepted
Return an order accepted event from the given dict values.
- Parameters: values (dict *[*str , object ]) – The values for initialization.
- Return type: OrderAccepted
id
UUID4
The event message identifier.
- Return type: UUID4
- Type: OrderAccepted.id
instrument_id
InstrumentId
The instrument ID associated with the event.
- Return type: InstrumentId
- Type: OrderAccepted.instrument_id
reconciliation
bool
If the event was generated during reconciliation.
- Return type: bool
- Type: OrderAccepted.reconciliation
set_client_order_id(self, ClientOrderId client_order_id)
strategy_id
TraderId
The strategy ID associated with the event.
- Return type: StrategyId
- Type: OrderAccepted.strategy_id
static to_dict(OrderAccepted obj)
Return a dictionary representation of this object.
- Return type: dict[str, object]
trader_id
TraderId
The trader ID associated with the event.
- Return type: TraderId
- Type: OrderAccepted.trader_id
ts_event
int
UNIX timestamp (nanoseconds) when the event occurred.
- Return type: int
- Type: OrderAccepted.ts_event
ts_init
int
UNIX timestamp (nanoseconds) when the object was initialized.
- Return type: int
- Type: OrderAccepted.ts_init
venue_order_id
VenueOrderId | None
The venue order ID associated with the event.
- Return type:
VenueOrderId or
None
- Type: OrderAccepted.venue_order_id
class OrderCanceled
Bases: OrderEvent
OrderCanceled(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, VenueOrderId venue_order_id: VenueOrderId | None, AccountId account_id: AccountId | None, UUID4 event_id, uint64_t ts_event, uint64_t ts_init, bool reconciliation=False)
Represents an event where an order has been canceled at the trading venue.
- Parameters:
- trader_id (TraderId) – The trader ID.
- strategy_id (StrategyId) – The strategy ID.
- instrument_id (InstrumentId) – The instrument ID.
- client_order_id (ClientOrderId) – The client order ID.
- venue_order_id (VenueOrderId or
None
) – The venue order ID (assigned by the venue). - account_id (AccountId or
None
) – The account ID (with the venue). - event_id (UUID4) – The event ID.
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when order canceled event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
- reconciliation (bool , default False) – If the event was generated during reconciliation.
account_id
AccountId | None
The account ID associated with the event.
- Return type:
AccountId or
None
- Type: OrderCanceled.account_id
client_order_id
ClientOrderId
The client order ID associated with the event.
- Return type: ClientOrderId
- Type: OrderCanceled.client_order_id
static from_dict(dict values) → OrderCanceled
Return an order canceled event from the given dict values.
- Parameters: values (dict *[*str , object ]) – The values for initialization.
- Return type: OrderCanceled
id
UUID4
The event message identifier.
- Return type: UUID4
- Type: OrderCanceled.id
instrument_id
InstrumentId
The instrument ID associated with the event.
- Return type: InstrumentId
- Type: OrderCanceled.instrument_id
reconciliation
bool
If the event was generated during reconciliation.
- Return type: bool
- Type: OrderCanceled.reconciliation
set_client_order_id(self, ClientOrderId client_order_id)
strategy_id
TraderId
The strategy ID associated with the event.
- Return type: StrategyId
- Type: OrderCanceled.strategy_id
static to_dict(OrderCanceled obj)
Return a dictionary representation of this object.
- Return type: dict[str, object]
trader_id
TraderId
The trader ID associated with the event.
- Return type: TraderId
- Type: OrderCanceled.trader_id
ts_event
int
UNIX timestamp (nanoseconds) when the event occurred.
- Return type: int
- Type: OrderCanceled.ts_event
ts_init
int
UNIX timestamp (nanoseconds) when the object was initialized.
- Return type: int
- Type: OrderCanceled.ts_init
venue_order_id
VenueOrderId | None
The venue order ID associated with the event.
- Return type:
VenueOrderId or
None
- Type: OrderCanceled.venue_order_id
class OrderCancelRejected
Bases: OrderEvent
OrderCancelRejected(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, VenueOrderId venue_order_id: VenueOrderId | None, AccountId account_id: AccountId | None, unicode reason, UUID4 event_id, uint64_t ts_event, uint64_t ts_init, bool reconciliation=False)
Represents an event where a CancelOrder command has been rejected by the trading venue.
- Parameters:
- trader_id (TraderId) – The trader ID.
- strategy_id (StrategyId) – The strategy ID.
- instrument_id (InstrumentId) – The instrument ID.
- client_order_id (ClientOrderId) – The client order ID.
- venue_order_id (VenueOrderId or
None
) – The venue order ID (assigned by the venue). - account_id (AccountId or
None
) – The account ID (with the venue). - reason (str) – The order cancel rejected reason.
- event_id (UUID4) – The event ID.
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the order cancel rejected event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
- reconciliation (bool , default False) – If the event was generated during reconciliation.
account_id
AccountId | None
The account ID associated with the event.
- Return type:
AccountId or
None
- Type: OrderCancelRejected.account_id
client_order_id
ClientOrderId
The client order ID associated with the event.
- Return type: ClientOrderId
- Type: OrderCancelRejected.client_order_id
static from_dict(dict values) → OrderCancelRejected
Return an order cancel rejected event from the given dict values.
- Parameters: values (dict *[*str , object ]) – The values for initialization.
- Return type: OrderCancelRejected
id
UUID4
The event message identifier.
- Return type: UUID4
- Type: OrderCancelRejected.id
instrument_id
InstrumentId
The instrument ID associated with the event.
- Return type: InstrumentId
- Type: OrderCancelRejected.instrument_id
reason
str
Return the reason the order was rejected.
- Return type: str
- Type: OrderCancelRejected.reason
reconciliation
bool
If the event was generated during reconciliation.
- Return type: bool
- Type: OrderCancelRejected.reconciliation
set_client_order_id(self, ClientOrderId client_order_id)
strategy_id
TraderId
The strategy ID associated with the event.
- Return type: StrategyId
- Type: OrderCancelRejected.strategy_id
static to_dict(OrderCancelRejected obj)
Return a dictionary representation of this object.
- Return type: dict[str, object]
trader_id
TraderId
The trader ID associated with the event.
- Return type: TraderId
- Type: OrderCancelRejected.trader_id
ts_event
int
UNIX timestamp (nanoseconds) when the event occurred.
- Return type: int
- Type: OrderCancelRejected.ts_event
ts_init
int
UNIX timestamp (nanoseconds) when the object was initialized.
- Return type: int
- Type: OrderCancelRejected.ts_init
venue_order_id
VenueOrderId | None
The venue order ID associated with the event.
- Return type:
VenueOrderId or
None
- Type: OrderCancelRejected.venue_order_id
class OrderDenied
Bases: OrderEvent
OrderDenied(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, unicode reason, UUID4 event_id, uint64_t ts_init)
Represents an event where an order has been denied by the Nautilus system.
This could be due an unsupported feature, a risk limit exceedance, or for any other reason that an otherwise valid order is not able to be submitted.
- Parameters:
- trader_id (TraderId) – The trader ID.
- strategy_id (StrategyId) – The strategy ID.
- instrument_id (InstrumentId) – The instrument ID.
- client_order_id (ClientOrderId) – The client order ID.
- reason (str) – The order denied reason.
- event_id (UUID4) – The event ID.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
account_id
AccountId | None
The account ID associated with the event.
- Return type:
AccountId or
None
- Type: OrderDenied.account_id
client_order_id
ClientOrderId
The client order ID associated with the event.
- Return type: ClientOrderId
- Type: OrderDenied.client_order_id
static from_dict(dict values) → OrderDenied
Return an order denied event from the given dict values.
- Parameters: values (dict *[*str , object ]) – The values for initialization.
- Return type: OrderDenied
id
UUID4
The event message identifier.
- Return type: UUID4
- Type: OrderDenied.id
instrument_id
InstrumentId
The instrument ID associated with the event.
- Return type: InstrumentId
- Type: OrderDenied.instrument_id
reason
str
Return the reason the order was denied.
- Return type: str
- Type: OrderDenied.reason
reconciliation
bool
If the event was generated during reconciliation.
- Return type: bool
- Type: OrderDenied.reconciliation
set_client_order_id(self, ClientOrderId client_order_id)
strategy_id
TraderId
The strategy ID associated with the event.
- Return type: StrategyId
- Type: OrderDenied.strategy_id
static to_dict(OrderDenied obj)
Return a dictionary representation of this object.
- Return type: dict[str, object]
trader_id
TraderId
The trader ID associated with the event.
- Return type: TraderId
- Type: OrderDenied.trader_id
ts_event
int
UNIX timestamp (nanoseconds) when the event occurred.
- Return type: int
- Type: OrderDenied.ts_event
ts_init
int
UNIX timestamp (nanoseconds) when the object was initialized.
- Return type: int
- Type: OrderDenied.ts_init
venue_order_id
VenueOrderId | None
The venue order ID associated with the event.
- Return type:
VenueOrderId or
None
- Type: OrderDenied.venue_order_id
class OrderEmulated
Bases: OrderEvent
OrderEmulated(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, UUID4 event_id, uint64_t ts_init)
Represents an event where an order has become emulated by the Nautilus system.
- Parameters:
- trader_id (TraderId) – The trader ID.
- strategy_id (StrategyId) – The strategy ID.
- instrument_id (InstrumentId) – The instrument ID.
- client_order_id (ClientOrderId) – The client order ID.
- event_id (UUID4) – The event ID.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
account_id
AccountId | None
The account ID associated with the event.
- Return type:
AccountId or
None
- Type: OrderEmulated.account_id
client_order_id
ClientOrderId
The client order ID associated with the event.
- Return type: ClientOrderId
- Type: OrderEmulated.client_order_id
static from_dict(dict values) → OrderEmulated
Return an order emulated event from the given dict values.
- Parameters: values (dict *[*str , object ]) – The values for initialization.
- Return type: OrderEmulated
id
UUID4
The event message identifier.
- Return type: UUID4
- Type: OrderEmulated.id
instrument_id
InstrumentId
The instrument ID associated with the event.
- Return type: InstrumentId
- Type: OrderEmulated.instrument_id
reconciliation
bool
If the event was generated during reconciliation.
- Return type: bool
- Type: OrderEmulated.reconciliation
set_client_order_id(self, ClientOrderId client_order_id)
strategy_id
TraderId
The strategy ID associated with the event.
- Return type: StrategyId
- Type: OrderEmulated.strategy_id
static to_dict(OrderEmulated obj)
Return a dictionary representation of this object.
- Return type: dict[str, object]
trader_id
TraderId
The trader ID associated with the event.
- Return type: TraderId
- Type: OrderEmulated.trader_id
ts_event
int
UNIX timestamp (nanoseconds) when the event occurred.
- Return type: int
- Type: OrderEmulated.ts_event
ts_init
int
UNIX timestamp (nanoseconds) when the object was initialized.
- Return type: int
- Type: OrderEmulated.ts_init
venue_order_id
VenueOrderId | None
The venue order ID associated with the event.
- Return type:
VenueOrderId or
None
- Type: OrderEmulated.venue_order_id
class OrderEvent
Bases: Event
The abstract base class for all order events.
WARNING
This class should not be used directly, but through a concrete subclass.
account_id
AccountId | None
The account ID associated with the event.
- Return type:
AccountId or
None
- Type: OrderEvent.account_id
client_order_id
ClientOrderId
The client order ID associated with the event.
- Return type: ClientOrderId
- Type: OrderEvent.client_order_id
id
UUID4
The event message identifier.
- Return type: UUID4
- Type: OrderEvent.id
instrument_id
InstrumentId
The instrument ID associated with the event.
- Return type: InstrumentId
- Type: OrderEvent.instrument_id
reconciliation
bool
If the event was generated during reconciliation.
- Return type: bool
- Type: OrderEvent.reconciliation
set_client_order_id(self, ClientOrderId client_order_id)
strategy_id
TraderId
The strategy ID associated with the event.
- Return type: StrategyId
- Type: OrderEvent.strategy_id
trader_id
TraderId
The trader ID associated with the event.
- Return type: TraderId
- Type: OrderEvent.trader_id
ts_event
int
UNIX timestamp (nanoseconds) when the event occurred.
- Return type: int
- Type: OrderEvent.ts_event
ts_init
int
UNIX timestamp (nanoseconds) when the object was initialized.
- Return type: int
- Type: OrderEvent.ts_init
venue_order_id
VenueOrderId | None
The venue order ID associated with the event.
- Return type:
VenueOrderId or
None
- Type: OrderEvent.venue_order_id
class OrderExpired
Bases: OrderEvent
OrderExpired(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, VenueOrderId venue_order_id: VenueOrderId | None, AccountId account_id: AccountId | None, UUID4 event_id, uint64_t ts_event, uint64_t ts_init, bool reconciliation=False)
Represents an event where an order has expired at the trading venue.
- Parameters:
- trader_id (TraderId) – The trader ID.
- strategy_id (StrategyId) – The strategy ID.
- instrument_id (InstrumentId) – The instrument ID.
- client_order_id (ClientOrderId) – The client order ID.
- venue_order_id (VenueOrderId or
None
) – The venue order ID (assigned by the venue). - account_id (AccountId or
None
) – The account ID (with the venue). - event_id (UUID4) – The event ID.
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the order expired event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
- reconciliation (bool , default False) – If the event was generated during reconciliation.
account_id
AccountId | None
The account ID associated with the event.
- Return type:
AccountId or
None
- Type: OrderExpired.account_id
client_order_id
ClientOrderId
The client order ID associated with the event.
- Return type: ClientOrderId
- Type: OrderExpired.client_order_id
static from_dict(dict values) → OrderExpired
Return an order expired event from the given dict values.
- Parameters: values (dict *[*str , object ]) – The values for initialization.
- Return type: OrderExpired
id
UUID4
The event message identifier.
- Return type: UUID4
- Type: OrderExpired.id
instrument_id
InstrumentId
The instrument ID associated with the event.
- Return type: InstrumentId
- Type: OrderExpired.instrument_id
reconciliation
bool
If the event was generated during reconciliation.
- Return type: bool
- Type: OrderExpired.reconciliation
set_client_order_id(self, ClientOrderId client_order_id)
strategy_id
TraderId
The strategy ID associated with the event.
- Return type: StrategyId
- Type: OrderExpired.strategy_id
static to_dict(OrderExpired obj)
Return a dictionary representation of this object.
- Return type: dict[str, object]
trader_id
TraderId
The trader ID associated with the event.
- Return type: TraderId
- Type: OrderExpired.trader_id
ts_event
int
UNIX timestamp (nanoseconds) when the event occurred.
- Return type: int
- Type: OrderExpired.ts_event
ts_init
int
UNIX timestamp (nanoseconds) when the object was initialized.
- Return type: int
- Type: OrderExpired.ts_init
venue_order_id
VenueOrderId | None
The venue order ID associated with the event.
- Return type:
VenueOrderId or
None
- Type: OrderExpired.venue_order_id
class OrderFilled
Bases: OrderEvent
OrderFilled(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, VenueOrderId venue_order_id, AccountId account_id, TradeId trade_id, PositionId position_id: PositionId | None, OrderSide order_side, OrderType order_type, Quantity last_qty, Price last_px, Currency currency, Money commission, LiquiditySide liquidity_side, UUID4 event_id, uint64_t ts_event, uint64_t ts_init, bool reconciliation=False, dict info=None)
Represents an event where an order has been filled at the exchange.
- Parameters:
- trader_id (TraderId) – The trader ID.
- strategy_id (StrategyId) – The strategy ID.
- instrument_id (InstrumentId) – The instrument ID.
- client_order_id (ClientOrderId) – The client order ID.
- venue_order_id (VenueOrderId) – The venue order ID (assigned by the venue).
- account_id (AccountId) – The account ID (with the venue).
- trade_id (TradeId) – The trade match ID (assigned by the venue).
- position_id (PositionId or
None
) – The position ID associated with the order fill (assigned by the venue). - order_side (OrderSide {
BUY
,SELL
}) – The execution order side. - order_type (OrderType) – The execution order type.
- last_qty (Quantity) – The fill quantity for this execution.
- last_px (Price) – The fill price for this execution (not average price).
- currency (Currency) – The currency of the price.
- commission (Money) – The fill commission.
- liquidity_side (LiquiditySide {
NO_LIQUIDITY_SIDE
,MAKER
,TAKER
}) – The execution liquidity side. - event_id (UUID4) – The event ID.
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the order filled event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
- info (dict *[*str , object ] , optional) – The additional fill information.
- reconciliation (bool , default False) – If the event was generated during reconciliation.
- Raises:
- ValueError – If order_side is
NO_ORDER_SIDE
. - ValueError – If last_qty is not positive (> 0).
- ValueError – If order_side is
account_id
AccountId | None
The account ID associated with the event.
- Return type:
AccountId or
None
- Type: OrderFilled.account_id
client_order_id
ClientOrderId
The client order ID associated with the event.
- Return type: ClientOrderId
- Type: OrderFilled.client_order_id
commission
The commission generated from the fill.
- Returns: Money
currency
The currency of the price.
- Returns: Currency
static from_dict(dict values) → OrderFilled
Return an order filled event from the given dict values.
- Parameters: values (dict *[*str , object ]) – The values for initialization.
- Return type: OrderFilled
id
UUID4
The event message identifier.
- Return type: UUID4
- Type: OrderFilled.id
info
The additional fill information.
- Returns: dict[str, object]
instrument_id
InstrumentId
The instrument ID associated with the event.
- Return type: InstrumentId
- Type: OrderFilled.instrument_id
is_buy
Return whether the fill order side is BUY
.
- Return type: bool
is_sell
Return whether the fill order side is SELL
.
- Return type: bool
last_px
The fill price for this execution.
- Returns: Price
last_qty
The fill quantity.
- Returns: Quantity
liquidity_side
The liquidity side of the event {MAKER
, TAKER
}.
- Returns: LiquiditySide
order_side
The order side.
- Returns: OrderSide
order_type
The order type.
- Returns: OrderType
position_id
The position ID (assigned by the venue).
- Returns:
PositionId or
None
reconciliation
bool
If the event was generated during reconciliation.
- Return type: bool
- Type: OrderFilled.reconciliation
set_client_order_id(self, ClientOrderId client_order_id)
strategy_id
TraderId
The strategy ID associated with the event.
- Return type: StrategyId
- Type: OrderFilled.strategy_id
static to_dict(OrderFilled obj)
Return a dictionary representation of this object.
- Return type: dict[str, object]
trade_id
The trade match ID (assigned by the venue).
- Returns: TradeId
trader_id
TraderId
The trader ID associated with the event.
- Return type: TraderId
- Type: OrderFilled.trader_id
ts_event
int
UNIX timestamp (nanoseconds) when the event occurred.
- Return type: int
- Type: OrderFilled.ts_event
ts_init
int
UNIX timestamp (nanoseconds) when the object was initialized.
- Return type: int
- Type: OrderFilled.ts_init
venue_order_id
VenueOrderId | None
The venue order ID associated with the event.
- Return type:
VenueOrderId or
None
- Type: OrderFilled.venue_order_id
class OrderInitialized
Bases: OrderEvent
OrderInitialized(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, OrderSide order_side, OrderType order_type, Quantity quantity, TimeInForce time_in_force, bool post_only, bool reduce_only, bool quote_quantity, dict options, TriggerType emulation_trigger, InstrumentId trigger_instrument_id: InstrumentId | None, ContingencyType contingency_type, OrderListId order_list_id: OrderListId | None, list linked_order_ids: list[ClientOrderId] | None, ClientOrderId parent_order_id: ClientOrderId | None, ExecAlgorithmId exec_algorithm_id: ExecAlgorithmId | None, dict exec_algorithm_params: dict[str, object] | None, ClientOrderId exec_spawn_id: ClientOrderId | None, list tags: list[str] | None, UUID4 event_id, uint64_t ts_init, bool reconciliation=False)
Represents an event where an order has been initialized.
This is a seed event which can instantiate any order through a creation method. This event should contain enough information to be able to send it ‘over the wire’ and have a valid order created with exactly the same properties as if it had been instantiated locally.
- Parameters:
- trader_id (TraderId) – The trader ID.
- strategy_id (StrategyId) – The strategy ID.
- instrument_id (InstrumentId) – The instrument ID.
- client_order_id (ClientOrderId) – The client order ID.
- order_side (OrderSide {
BUY
,SELL
}) – The order side. - order_type (OrderType) – The order type.
- quantity (Quantity) – The order quantity.
- time_in_force (TimeInForce {
GTC
,IOC
,FOK
,GTD
,DAY
,AT_THE_OPEN
,AT_THE_CLOSE
}) – The order time in force. - post_only (bool) – If the order will only provide liquidity (make a market).
- reduce_only (bool) – If the order carries the ‘reduce-only’ execution instruction.
- quote_quantity (bool) – If the order quantity is denominated in the quote currency.
- options (dict *[*str , str ]) – The order initialization options. Contains mappings for specific order parameters.
- emulation_trigger (EmulationTrigger) – The emulation trigger for the order.
- trigger_instrument_id (InstrumentId or
None
) – The emulation trigger instrument ID for the order (ifNone
then will be the instrument_id). - contingency_type (ContingencyType) – The order contingency type.
- order_list_id (OrderListId or
None
) – The order list ID associated with the order. - linked_order_ids (list[ClientOrderId] or
None
) – The order linked client order ID(s). - parent_order_id (ClientOrderId or
None
) – The orders parent client order ID. - exec_algorithm_id (ExecAlgorithmId or
None
) – 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 or
None
) – The execution algorithm spawning primary client order ID. - tags (list[str] or
None
) – The custom user tags for the order. - event_id (UUID4) – The event ID.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
- reconciliation (bool , default False) – If the event was generated during reconciliation.
- Raises:
- ValueError – If order_side is
NO_ORDER_SIDE
. - ValueError – If exec_algorithm_id is not
None
, and exec_spawn_id isNone
.
- ValueError – If order_side is
account_id
AccountId | None
The account ID associated with the event.
- Return type:
AccountId or
None
- Type: OrderInitialized.account_id
client_order_id
ClientOrderId
The client order ID associated with the event.
- Return type: ClientOrderId
- Type: OrderInitialized.client_order_id
contingency_type
The orders contingency type.
- Returns: ContingencyType
emulation_trigger
The order emulation trigger type.
- Returns: TriggerType
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
static from_dict(dict values) → OrderInitialized
Return an order initialized event from the given dict values.
- Parameters: values (dict *[*str , object ]) – The values for initialization.
- Return type: OrderInitialized
id
UUID4
The event message identifier.
- Return type: UUID4
- Type: OrderInitialized.id
instrument_id
InstrumentId
The instrument ID associated with the event.
- Return type: InstrumentId
- Type: OrderInitialized.instrument_id
linked_order_ids
The orders linked client order ID(s).
- Returns:
list[ClientOrderId] or
None
options
The order initialization options.
- Returns: dict
order_list_id
The order list ID associated with the order.
- Returns:
OrderListId or
None
order_type
The order type.
- Returns: OrderType
parent_order_id
The orders parent client order ID.
- Returns:
ClientOrderId or
None
post_only
If the order will only provide liquidity (make a market).
- Returns: bool
quantity
The order quantity.
- Returns: Quantity
quote_quantity
If the order quantity is denominated in the quote currency.
- Returns: bool
reconciliation
bool
If the event was generated during reconciliation.
- Return type: bool
- Type: OrderInitialized.reconciliation
reduce_only
If the order carries the ‘reduce-only’ execution instruction.
- Returns: bool
set_client_order_id(self, ClientOrderId client_order_id)
side
The order side.
- Returns: OrderSide
strategy_id
TraderId
The strategy ID associated with the event.
- Return type: StrategyId
- Type: OrderInitialized.strategy_id
tags
The order custom user tags.
- Returns:
list[str] or
None
time_in_force
The order time in force.
- Returns: TimeInForce
static to_dict(OrderInitialized obj)
Return a dictionary representation of this object.
- Return type: dict[str, object]
trader_id
TraderId
The trader ID associated with the event.
- Return type: TraderId
- Type: OrderInitialized.trader_id
trigger_instrument_id
The order emulation trigger instrument ID (will be instrument_id if None
).
- Returns:
InstrumentId or
None
ts_event
int
UNIX timestamp (nanoseconds) when the event occurred.
- Return type: int
- Type: OrderInitialized.ts_event
ts_init
int
UNIX timestamp (nanoseconds) when the object was initialized.
- Return type: int
- Type: OrderInitialized.ts_init
venue_order_id
VenueOrderId | None
The venue order ID associated with the event.
- Return type:
VenueOrderId or
None
- Type: OrderInitialized.venue_order_id
class OrderModifyRejected
Bases: OrderEvent
OrderModifyRejected(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, VenueOrderId venue_order_id: VenueOrderId | None, AccountId account_id: AccountId | None, unicode reason, UUID4 event_id, uint64_t ts_event, uint64_t ts_init, bool reconciliation=False)
Represents an event where a ModifyOrder command has been rejected by the trading venue.
- Parameters:
- trader_id (TraderId) – The trader ID.
- strategy_id (StrategyId) – The strategy ID.
- instrument_id (InstrumentId) – The instrument ID.
- client_order_id (ClientOrderId) – The client order ID.
- venue_order_id (VenueOrderId or
None
) – The venue order ID (assigned by the venue). - account_id (AccountId or
None
) – The account ID (with the venue). - reason (str) – The order update rejected reason.
- event_id (UUID4) – The event ID.
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the order update rejected event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
- reconciliation (bool , default False) – If the event was generated during reconciliation.
account_id
AccountId | None
The account ID associated with the event.
- Return type:
AccountId or
None
- Type: OrderModifyRejected.account_id
client_order_id
ClientOrderId
The client order ID associated with the event.
- Return type: ClientOrderId
- Type: OrderModifyRejected.client_order_id