-
Notifications
You must be signed in to change notification settings - Fork 0
Events
Loren1166 edited this page Sep 24, 2024
·
1 revision
Defines the fundamental event types represented within the trading domain.
定义交易领域内表示的基本事件类型。
class AccountState(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_id (AccountId) - 账户 ID(包含交易场所)。
account_type (AccountType) – The account type for the event.
account_type (AccountType) - 事件的账户类型。
base_currency (Currency , optional) – The account base currency. Use None for multi-currency accounts.
base_currency (Currency,可选) - 账户基础货币。对于多币种账户,使用 None。
reported (bool) – If the state is reported from the exchange (otherwise system calculated).
reported (bool) - 如果状态是由交易所报告的(否则由系统计算)。
balances (list [AccountBalance ]) – The account balances.
balances (list [AccountBalance ]) - 账户余额。
margins (list [MarginBalance ]) – The margin balances (can be empty).
margins (list [MarginBalance ]) - 保证金余额(可以为空)。
info (dict *[*str , object ]) – The additional implementation specific account information.
info (dict *[*str , object ]) - 附加的实现特定账户信息。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the account state event occurred.
ts_event (uint64_t) - 账户状态事件发生时的 UNIX 时间戳(纳秒)。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
Raises:
ValueError – If balances is empty.
ValueError - 如果余额为空。
"""
@property
def account_id(self) -> "AccountId":
"""
The account ID associated with the event.
与事件关联的账户 ID。
Returns:
AccountId
"""
...
@property
def account_type(self) -> "AccountType":
"""
The account type for the event.
事件的账户类型。
Returns:
AccountType
"""
...
@property
def balances(self) -> list["AccountBalance"]:
"""
The account balances.
账户余额。
Returns:
list[AccountBalance]
"""
...
@property
def base_currency(self) -> "Currency" or None:
"""
The account type for the event.
事件的账户类型。
Returns:
Currency or None
"""
...
@staticmethod
def from_dict(values: dict) -> "AccountState":
"""
Return an account state event from the given dict values.
从给定的字典值返回账户状态事件。
Parameters:
values (dict *[*str , object ]) – The values for initialization.
values (dict *[*str , object ]) - 初始化的值。
Return type:
AccountState
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
AccountState.id
"""
...
@property
def info(self) -> dict[str, object]:
"""
The additional implementation specific account information.
附加的实现特定账户信息。
Returns:
dict[str, object]
"""
...
@property
def is_reported(self) -> bool:
"""
If the state is reported from the exchange (otherwise system calculated).
如果状态是由交易所报告的(否则由系统计算)。
Returns:
bool
"""
...
@property
def margins(self) -> list["MarginBalance"]:
"""
The margin balances.
保证金余额。
Returns:
list[MarginBalance]
"""
...
@staticmethod
def to_dict(obj: "AccountState"):
"""
Return a dictionary representation of this object.
返回此对象的字典表示形式。
Return type:
dict[str, object]
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
AccountState.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
AccountState.ts_init
"""
...
class OrderAccepted(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.
此事件通常对应于 FIX 执行报告中的 NEW OrdStatus <39> 字段。
Parameters:
trader_id (TraderId) – The trader ID.
trader_id (TraderId) - 交易者 ID。
strategy_id (StrategyId) – The strategy ID.
strategy_id (StrategyId) - 策略 ID。
instrument_id (InstrumentId) – The instrument ID.
instrument_id (InstrumentId) - 金融工具 ID。
client_order_id (ClientOrderId) – The client order ID.
client_order_id (ClientOrderId) - 客户订单 ID。
venue_order_id (VenueOrderId) – The venue order ID (assigned by the venue).
venue_order_id (VenueOrderId) - 交易场所订单 ID(由交易场所分配)。
account_id (AccountId) – The account ID (with the venue).
account_id (AccountId) - 账户 ID(包含交易场所)。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the order accepted event occurred.
ts_event (uint64_t) - 订单接受事件发生时的 UNIX 时间戳(纳秒)。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
reconciliation (bool , default False) – If the event was generated during reconciliation.
reconciliation (bool,默认 False) - 如果事件是在对账期间生成的。
"""
@property
def account_id(self) -> "AccountId" | None:
"""
AccountId | None
The account ID associated with the event.
与事件关联的账户 ID。
Return type:
AccountId or None
Type:
OrderAccepted.account_id
"""
...
@property
def client_order_id(self) -> "ClientOrderId":
"""
ClientOrderId
The client order ID associated with the event.
与事件关联的客户订单 ID。
Return type:
ClientOrderId
Type:
OrderAccepted.client_order_id
"""
...
@staticmethod
def from_dict(values: dict) -> "OrderAccepted":
"""
Return an order accepted event from the given dict values.
从给定的字典值返回订单接受事件。
Parameters:
values (dict *[*str , object ]) – The values for initialization.
values (dict *[*str , object ]) - 初始化的值。
Return type:
OrderAccepted
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
OrderAccepted.id
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
InstrumentId
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Return type:
InstrumentId
Type:
OrderAccepted.instrument_id
"""
...
@property
def reconciliation(self) -> bool:
"""
bool
If the event was generated during reconciliation.
如果事件是在对账期间生成的。
Return type:
bool
Type:
OrderAccepted.reconciliation
"""
...
def set_client_order_id(self, client_order_id: "ClientOrderId"):
...
@property
def strategy_id(self) -> "TraderId":
"""
TraderId
The strategy ID associated with the event.
与事件关联的策略 ID。
Return type:
StrategyId
Type:
OrderAccepted.strategy_id
"""
...
@staticmethod
def to_dict(obj: "OrderAccepted"):
"""
Return a dictionary representation of this object.
返回此对象的字典表示形式。
Return type:
dict[str, object]
"""
...
@property
def trader_id(self) -> "TraderId":
"""
TraderId
The trader ID associated with the event.
与事件关联的交易者 ID。
Return type:
TraderId
Type:
OrderAccepted.trader_id
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderAccepted.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderAccepted.ts_init
"""
...
@property
def venue_order_id(self) -> "VenueOrderId" | None:
"""
VenueOrderId | None
The venue order ID associated with the event.
与事件关联的交易场所订单 ID。
Return type:
VenueOrderId or None
Type:
OrderAccepted.venue_order_id
"""
...
class OrderCanceled(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.
trader_id (TraderId) - 交易者 ID。
strategy_id (StrategyId) – The strategy ID.
strategy_id (StrategyId) - 策略 ID。
instrument_id (InstrumentId) – The instrument ID.
instrument_id (InstrumentId) - 金融工具 ID。
client_order_id (ClientOrderId) – The client order ID.
client_order_id (ClientOrderId) - 客户订单 ID。
venue_order_id (VenueOrderId, optional with no default so None must be passed explicitly) – The venue order ID (assigned by the venue).
venue_order_id (VenueOrderId,可选,无默认值,因此必须显式传递 None) - 交易场所订单 ID(由交易场所分配)。
account_id (AccountId, optional with no default so None must be passed explicitly) – The account ID (with the venue).
account_id (AccountId,可选,无默认值,因此必须显式传递 None) - 账户 ID(包含交易场所)。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_event (uint64_t) – UNIX timestamp (nanoseconds) when order canceled event occurred.
ts_event (uint64_t) - 订单取消事件发生时的 UNIX 时间戳(纳秒)。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
reconciliation (bool , default False) – If the event was generated during reconciliation.
reconciliation (bool,默认 False) - 如果事件是在对账期间生成的。
"""
@property
def account_id(self) -> "AccountId" | None:
"""
AccountId | None
The account ID associated with the event.
与事件关联的账户 ID。
Return type:
AccountId or None
Type:
OrderCanceled.account_id
"""
...
@property
def client_order_id(self) -> "ClientOrderId":
"""
ClientOrderId
The client order ID associated with the event.
与事件关联的客户订单 ID。
Return type:
ClientOrderId
Type:
OrderCanceled.client_order_id
"""
...
@staticmethod
def from_dict(values: dict) -> "OrderCanceled":
"""
Return an order canceled event from the given dict values.
从给定的字典值返回订单取消事件。
Parameters:
values (dict *[*str , object ]) – The values for initialization.
values (dict *[*str , object ]) - 初始化的值。
Return type:
OrderCanceled
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
OrderCanceled.id
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
InstrumentId
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Return type:
InstrumentId
Type:
OrderCanceled.instrument_id
"""
...
@property
def reconciliation(self) -> bool:
"""
bool
If the event was generated during reconciliation.
如果事件是在对账期间生成的。
Return type:
bool
Type:
OrderCanceled.reconciliation
"""
...
def set_client_order_id(self, client_order_id: "ClientOrderId"):
...
@property
def strategy_id(self) -> "TraderId":
"""
TraderId
The strategy ID associated with the event.
与事件关联的策略 ID。
Return type:
StrategyId
Type:
OrderCanceled.strategy_id
"""
...
@staticmethod
def to_dict(obj: "OrderCanceled"):
"""
Return a dictionary representation of this object.
返回此对象的字典表示形式。
Return type:
dict[str, object]
"""
...
@property
def trader_id(self) -> "TraderId":
"""
TraderId
The trader ID associated with the event.
与事件关联的交易者 ID。
Return type:
TraderId
Type:
OrderCanceled.trader_id
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderCanceled.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderCanceled.ts_init
"""
...
@property
def venue_order_id(self) -> "VenueOrderId" | None:
"""
VenueOrderId | None
The venue order ID associated with the event.
与事件关联的交易场所订单 ID。
Return type:
VenueOrderId or None
Type:
OrderCanceled.venue_order_id
"""
...
class OrderCancelRejected(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.
表示 CancelOrder 命令被交易场所拒绝的事件。
Parameters:
trader_id (TraderId) – The trader ID.
trader_id (TraderId) - 交易者 ID。
strategy_id (StrategyId) – The strategy ID.
strategy_id (StrategyId) - 策略 ID。
instrument_id (InstrumentId) – The instrument ID.
instrument_id (InstrumentId) - 金融工具 ID。
client_order_id (ClientOrderId) – The client order ID.
client_order_id (ClientOrderId) - 客户订单 ID。
venue_order_id (VenueOrderId, optional with no default so None must be passed explicitly) – The venue order ID (assigned by the venue).
venue_order_id (VenueOrderId,可选,无默认值,因此必须显式传递 None) - 交易场所订单 ID(由交易场所分配)。
account_id (AccountId, optional with no default so None must be passed explicitly) – The account ID (with the venue).
account_id (AccountId,可选,无默认值,因此必须显式传递 None) - 账户 ID(包含交易场所)。
reason (str) – The order cancel rejected reason.
reason (str) - 订单取消被拒绝的原因。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the order cancel rejected event occurred.
ts_event (uint64_t) - 订单取消被拒绝事件发生时的 UNIX 时间戳(纳秒)。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
reconciliation (bool , default False) – If the event was generated during reconciliation.
reconciliation (bool,默认 False) - 如果事件是在对账期间生成的。
Raises:
ValueError – If reason is not a valid string.
ValueError - 如果 reason 不是有效的字符串。
"""
@property
def account_id(self) -> "AccountId" | None:
"""
AccountId | None
The account ID associated with the event.
与事件关联的账户 ID。
Return type:
AccountId or None
Type:
OrderCancelRejected.account_id
"""
...
@property
def client_order_id(self) -> "ClientOrderId":
"""
ClientOrderId
The client order ID associated with the event.
与事件关联的客户订单 ID。
Return type:
ClientOrderId
Type:
OrderCancelRejected.client_order_id
"""
...
@staticmethod
def from_dict(values: dict) -> "OrderCancelRejected":
"""
Return an order cancel rejected event from the given dict values.
从给定的字典值返回订单取消被拒绝事件。
Parameters:
values (dict *[*str , object ]) – The values for initialization.
values (dict *[*str , object ]) - 初始化的值。
Return type:
OrderCancelRejected
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
OrderCancelRejected.id
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
InstrumentId
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Return type:
InstrumentId
Type:
OrderCancelRejected.instrument_id
"""
...
@property
def reason(self) -> str:
"""
str
Return the reason the order was rejected.
返回订单被拒绝的原因。
Return type:
str
Type:
OrderCancelRejected.reason
"""
...
@property
def reconciliation(self) -> bool:
"""
bool
If the event was generated during reconciliation.
如果事件是在对账期间生成的。
Return type:
bool
Type:
OrderCancelRejected.reconciliation
"""
...
def set_client_order_id(self, client_order_id: "ClientOrderId"):
...
@property
def strategy_id(self) -> "TraderId":
"""
TraderId
The strategy ID associated with the event.
与事件关联的策略 ID。
Return type:
StrategyId
Type:
OrderCancelRejected.strategy_id
"""
...
@staticmethod
def to_dict(obj: "OrderCancelRejected"):
"""
Return a dictionary representation of this object.
返回此对象的字典表示形式。
Return type:
dict[str, object]
"""
...
@property
def trader_id(self) -> "TraderId":
"""
TraderId
The trader ID associated with the event.
与事件关联的交易者 ID。
Return type:
TraderId
Type:
OrderCancelRejected.trader_id
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderCancelRejected.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderCancelRejected.ts_init
"""
...
@property
def venue_order_id(self) -> "VenueOrderId" | None:
"""
VenueOrderId | None
The venue order ID associated with the event.
与事件关联的交易场所订单 ID。
Return type:
VenueOrderId or None
Type:
OrderCancelRejected.venue_order_id
"""
...
class OrderDenied(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.
表示一个订单被 Nautilus 系统拒绝的事件。
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.
trader_id (TraderId) - 交易者 ID。
strategy_id (StrategyId) – The strategy ID.
strategy_id (StrategyId) - 策略 ID。
instrument_id (InstrumentId) – The instrument ID.
instrument_id (InstrumentId) - 金融工具 ID。
client_order_id (ClientOrderId) – The client order ID.
client_order_id (ClientOrderId) - 客户订单 ID。
reason (str) – The order denied reason.
reason (str) - 订单被拒绝的原因。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
Raises:
ValueError – If denied_reason is not a valid_string.
ValueError - 如果 denied_reason 不是有效的字符串。
"""
@property
def account_id(self) -> "AccountId" | None:
"""
AccountId | None
The account ID associated with the event.
与事件关联的账户 ID。
Return type:
AccountId or None
Type:
OrderDenied.account_id
"""
...
@property
def client_order_id(self) -> "ClientOrderId":
"""
ClientOrderId
The client order ID associated with the event.
与事件关联的客户订单 ID。
Return type:
ClientOrderId
Type:
OrderDenied.client_order_id
"""
...
@staticmethod
def from_dict(values: dict) -> "OrderDenied":
"""
Return an order denied event from the given dict values.
从给定的字典值返回订单拒绝事件。
Parameters:
values (dict *[*str , object ]) – The values for initialization.
values (dict *[*str , object ]) - 初始化的值。
Return type:
OrderDenied
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
OrderDenied.id
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
InstrumentId
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Return type:
InstrumentId
Type:
OrderDenied.instrument_id
"""
...
@property
def reason(self) -> str:
"""
str
Return the reason the order was denied.
返回订单被拒绝的原因。
Return type:
str
Type:
OrderDenied.reason
"""
...
@property
def reconciliation(self) -> bool:
"""
bool
If the event was generated during reconciliation.
如果事件是在对账期间生成的。
Return type:
bool
Type:
OrderDenied.reconciliation
"""
...
def set_client_order_id(self, client_order_id: "ClientOrderId"):
...
@property
def strategy_id(self) -> "TraderId":
"""
TraderId
The strategy ID associated with the event.
与事件关联的策略 ID。
Return type:
StrategyId
Type:
OrderDenied.strategy_id
"""
...
@staticmethod
def to_dict(obj: "OrderDenied"):
"""
Return a dictionary representation of this object.
返回此对象的字典表示形式。
Return type:
dict[str, object]
"""
...
@property
def trader_id(self) -> "TraderId":
"""
TraderId
The trader ID associated with the event.
与事件关联的交易者 ID。
Return type:
TraderId
Type:
OrderDenied.trader_id
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderDenied.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderDenied.ts_init
"""
...
@property
def venue_order_id(self) -> "VenueOrderId" | None:
"""
VenueOrderId | None
The venue order ID associated with the event.
与事件关联的交易场所订单 ID。
Return type:
VenueOrderId or None
Type:
OrderDenied.venue_order_id
"""
...
class OrderEmulated(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.
表示一个订单已由 Nautilus 系统模拟的事件。
Parameters:
trader_id (TraderId) – The trader ID.
trader_id (TraderId) - 交易者 ID。
strategy_id (StrategyId) – The strategy ID.
strategy_id (StrategyId) - 策略 ID。
instrument_id (InstrumentId) – The instrument ID.
instrument_id (InstrumentId) - 金融工具 ID。
client_order_id (ClientOrderId) – The client order ID.
client_order_id (ClientOrderId) - 客户订单 ID。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
"""
@property
def account_id(self) -> "AccountId" | None:
"""
AccountId | None
The account ID associated with the event.
与事件关联的账户 ID。
Return type:
AccountId or None
Type:
OrderEmulated.account_id
"""
...
@property
def client_order_id(self) -> "ClientOrderId":
"""
ClientOrderId
The client order ID associated with the event.
与事件关联的客户订单 ID。
Return type:
ClientOrderId
Type:
OrderEmulated.client_order_id
"""
...
@staticmethod
def from_dict(values: dict) -> "OrderEmulated":
"""
Return an order emulated event from the given dict values.
从给定的字典值返回订单模拟事件。
Parameters:
values (dict *[*str , object ]) – The values for initialization.
values (dict *[*str , object ]) - 初始化的值。
Return type:
OrderEmulated
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
OrderEmulated.id
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
InstrumentId
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Return type:
InstrumentId
Type:
OrderEmulated.instrument_id
"""
...
@property
def reconciliation(self) -> bool:
"""
bool
If the event was generated during reconciliation.
如果事件是在对账期间生成的。
Return type:
bool
Type:
OrderEmulated.reconciliation
"""
...
def set_client_order_id(self, client_order_id: "ClientOrderId"):
...
@property
def strategy_id(self) -> "TraderId":
"""
TraderId
The strategy ID associated with the event.
与事件关联的策略 ID。
Return type:
StrategyId
Type:
OrderEmulated.strategy_id
"""
...
@staticmethod
def to_dict(obj: "OrderEmulated"):
"""
Return a dictionary representation of this object.
返回此对象的字典表示形式。
Return type:
dict[str, object]
"""
...
@property
def trader_id(self) -> "TraderId":
"""
TraderId
The trader ID associated with the event.
与事件关联的交易者 ID。
Return type:
TraderId
Type:
OrderEmulated.trader_id
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderEmulated.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderEmulated.ts_init
"""
...
@property
def venue_order_id(self) -> "VenueOrderId" | None:
"""
VenueOrderId | None
The venue order ID associated with the event.
与事件关联的交易场所订单 ID。
Return type:
VenueOrderId or None
Type:
OrderEmulated.venue_order_id
"""
...
class OrderEvent(Event):
"""
The abstract base class for all order events.
所有订单事件的抽象基类。
WARNING
This class should not be used directly, but through a concrete subclass.
此类不应直接使用,而应通过具体的子类使用。
"""
@property
def account_id(self) -> "AccountId" | None:
"""
AccountId | None
The account ID associated with the event.
与事件关联的账户 ID。
Return type:
AccountId or None
Type:
OrderEvent.account_id
"""
...
@property
def client_order_id(self) -> "ClientOrderId":
"""
ClientOrderId
The client order ID associated with the event.
与事件关联的客户订单 ID。
Return type:
ClientOrderId
Type:
OrderEvent.client_order_id
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
OrderEvent.id
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
InstrumentId
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Return type:
InstrumentId
Type:
OrderEvent.instrument_id
"""
...
@property
def reconciliation(self) -> bool:
"""
bool
If the event was generated during reconciliation.
如果事件是在对账期间生成的。
Return type:
bool
Type:
OrderEvent.reconciliation
"""
...
def set_client_order_id(self, client_order_id: "ClientOrderId"):
...
@property
def strategy_id(self) -> "TraderId":
"""
TraderId
The strategy ID associated with the event.
与事件关联的策略 ID。
Return type:
StrategyId
Type:
OrderEvent.strategy_id
"""
...
@property
def trader_id(self) -> "TraderId":
"""
TraderId
The trader ID associated with the event.
与事件关联的交易者 ID。
Return type:
TraderId
Type:
OrderEvent.trader_id
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderEvent.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderEvent.ts_init
"""
...
@property
def venue_order_id(self) -> "VenueOrderId" | None:
"""
VenueOrderId | None
The venue order ID associated with the event.
与事件关联的交易场所订单 ID。
Return type:
VenueOrderId or None
Type:
OrderEvent.venue_order_id
"""
...
class OrderExpired(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.
trader_id (TraderId) - 交易者 ID。
strategy_id (StrategyId) – The strategy ID.
strategy_id (StrategyId) - 策略 ID。
instrument_id (InstrumentId) – The instrument ID.
instrument_id (InstrumentId) - 金融工具 ID。
client_order_id (ClientOrderId) – The client order ID.
client_order_id (ClientOrderId) - 客户订单 ID。
venue_order_id (VenueOrderId, optional with no default so None must be passed explicitly) – The venue order ID (assigned by the venue).
venue_order_id (VenueOrderId,可选,无默认值,因此必须显式传递 None) - 交易场所订单 ID(由交易场所分配)。
account_id (AccountId, optional with no default so None must be passed explicitly) – The account ID (with the venue).
account_id (AccountId,可选,无默认值,因此必须显式传递 None) - 账户 ID(包含交易场所)。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the order expired event occurred.
ts_event (uint64_t) - 订单过期事件发生时的 UNIX 时间戳(纳秒)。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
reconciliation (bool , default False) – If the event was generated during reconciliation.
reconciliation (bool,默认 False) - 如果事件是在对账期间生成的。
"""
@property
def account_id(self) -> "AccountId" | None:
"""
AccountId | None
The account ID associated with the event.
与事件关联的账户 ID。
Return type:
AccountId or None
Type:
OrderExpired.account_id
"""
...
@property
def client_order_id(self) -> "ClientOrderId":
"""
ClientOrderId
The client order ID associated with the event.
与事件关联的客户订单 ID。
Return type:
ClientOrderId
Type:
OrderExpired.client_order_id
"""
...
@staticmethod
def from_dict(values: dict) -> "OrderExpired":
"""
Return an order expired event from the given dict values.
从给定的字典值返回订单过期事件。
Parameters:
values (dict *[*str , object ]) – The values for initialization.
values (dict *[*str , object ]) - 初始化的值。
Return type:
OrderExpired
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
OrderExpired.id
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
InstrumentId
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Return type:
InstrumentId
Type:
OrderExpired.instrument_id
"""
...
@property
def reconciliation(self) -> bool:
"""
bool
If the event was generated during reconciliation.
如果事件是在对账期间生成的。
Return type:
bool
Type:
OrderExpired.reconciliation
"""
...
def set_client_order_id(self, client_order_id: "ClientOrderId"):
...
@property
def strategy_id(self) -> "TraderId":
"""
TraderId
The strategy ID associated with the event.
与事件关联的策略 ID。
Return type:
StrategyId
Type:
OrderExpired.strategy_id
"""
...
@staticmethod
def to_dict(obj: "OrderExpired"):
"""
Return a dictionary representation of this object.
返回此对象的字典表示形式。
Return type:
dict[str, object]
"""
...
@property
def trader_id(self) -> "TraderId":
"""
TraderId
The trader ID associated with the event.
与事件关联的交易者 ID。
Return type:
TraderId
Type:
OrderExpired.trader_id
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderExpired.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderExpired.ts_init
"""
...
@property
def venue_order_id(self) -> "VenueOrderId" | None:
"""
VenueOrderId | None
The venue order ID associated with the event.
与事件关联的交易场所订单 ID。
Return type:
VenueOrderId or None
Type:
OrderExpired.venue_order_id
"""
...
class OrderFilled(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.
trader_id (TraderId) - 交易者 ID。
strategy_id (StrategyId) – The strategy ID.
strategy_id (StrategyId) - 策略 ID。
instrument_id (InstrumentId) – The instrument ID.
instrument_id (InstrumentId) - 金融工具 ID。
client_order_id (ClientOrderId) – The client order ID.
client_order_id (ClientOrderId) - 客户订单 ID。
venue_order_id (VenueOrderId) – The venue order ID (assigned by the venue).
venue_order_id (VenueOrderId) - 交易场所订单 ID(由交易场所分配)。
account_id (AccountId) – The account ID (with the venue).
account_id (AccountId) - 账户 ID(包含交易场所)。
trade_id (TradeId) – The trade match ID (assigned by the venue).
trade_id (TradeId) - 成交匹配 ID(由交易场所分配)。
position_id (PositionId, optional with no default so None must be passed explicitly) – The position ID associated with the order fill (assigned by the venue).
position_id (PositionId,可选,无默认值,因此必须显式传递 None) - 与订单成交关联的头寸 ID(由交易场所分配)。
order_side (OrderSide {BUY, SELL}) – The execution order side.
order_side (OrderSide {BUY, SELL}) - 执行订单方向。
order_type (OrderType) – The execution order type.
order_type (OrderType) - 执行订单类型。
last_qty (Quantity) – The fill quantity for this execution.
last_qty (Quantity) - 此执行的成交数量。
last_px (Price) – The fill price for this execution (not average price).
last_px (Price) - 此执行的成交价格(非平均价格)。
currency (Currency) – The currency of the price.
currency (Currency) - 价格的货币。
commission (Money) – The fill commission.
commission (Money) - 成交佣金。
liquidity_side (LiquiditySide {NO_LIQUIDITY_SIDE, MAKER, TAKER}) – The execution liquidity side.
liquidity_side (LiquiditySide {NO_LIQUIDITY_SIDE, MAKER, TAKER}) - 执行流动性方向。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the order filled event occurred.
ts_event (uint64_t) - 订单成交事件发生时的 UNIX 时间戳(纳秒)。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
info (dict *[*str , object ] , optional) – The additional fill information.
info (dict *[*str , object ],可选) - 附加成交信息。
reconciliation (bool , default False) – If the event was generated during reconciliation.
reconciliation (bool,默认 False) - 如果事件是在对账期间生成的。
Raises:
ValueError – If order_side is NO_ORDER_SIDE.
ValueError - 如果 order_side 为 NO_ORDER_SIDE。
ValueError – If last_qty is not positive (> 0).
ValueError - 如果 last_qty 不为正数 (> 0)。
"""
@property
def account_id(self) -> "AccountId" | None:
"""
AccountId | None
The account ID associated with the event.
与事件关联的账户 ID。
Return type:
AccountId or None
Type:
OrderFilled.account_id
"""
...
@property
def client_order_id(self) -> "ClientOrderId":
"""
ClientOrderId
The client order ID associated with the event.
与事件关联的客户订单 ID。
Return type:
ClientOrderId
Type:
OrderFilled.client_order_id
"""
...
@property
def commission(self) -> "Money":
"""
The commission generated from the fill.
成交产生的佣金。
Returns:
Money
"""
...
@property
def currency(self) -> "Currency":
"""
The currency of the price.
价格的货币。
Returns:
Currency
"""
...
@staticmethod
def from_dict(values: dict) -> "OrderFilled":
"""
Return an order filled event from the given dict values.
从给定的字典值返回订单成交事件。
Parameters:
values (dict *[*str , object ]) – The values for initialization.
values (dict *[*str , object ]) - 初始化的值。
Return type:
OrderFilled
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
OrderFilled.id
"""
...
@property
def info(self) -> dict[str, object]:
"""
The additional fill information.
附加成交信息。
Returns:
dict[str, object]
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
InstrumentId
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Return type:
InstrumentId
Type:
OrderFilled.instrument_id
"""
...
@property
def is_buy(self) -> bool:
"""
Return whether the fill order side is BUY.
返回成交订单方向是否为 BUY。
Return type:
bool
"""
...
@property
def is_sell(self) -> bool:
"""
Return whether the fill order side is SELL.
返回成交订单方向是否为 SELL。
Return type:
bool
"""
...
@property
def last_px(self) -> "Price":
"""
The fill price for this execution.
此执行的成交价格。
Returns:
Price
"""
...
@property
def last_qty(self) -> "Quantity":
"""
The fill quantity.
成交数量。
Returns:
Quantity
"""
...
@property
def liquidity_side(self) -> "LiquiditySide":
"""
The liquidity side of the event {MAKER, TAKER}.
事件的流动性方向 {MAKER, TAKER}。
Returns:
LiquiditySide
"""
...
@property
def order_side(self) -> "OrderSide":
"""
The order side.
订单方向。
Returns:
OrderSide
"""
...
@property
def order_type(self) -> "OrderType":
"""
The order type.
订单类型。
Returns:
OrderType
"""
...
@property
def position_id(self) -> "PositionId" or None:
"""
The position ID (assigned by the venue).
头寸 ID(由交易场所分配)。
Returns:
PositionId or None
"""
...
@property
def reconciliation(self) -> bool:
"""
bool
If the event was generated during reconciliation.
如果事件是在对账期间生成的。
Return type:
bool
Type:
OrderFilled.reconciliation
"""
...
def set_client_order_id(self, client_order_id: "ClientOrderId"):
...
@property
def strategy_id(self) -> "TraderId":
"""
TraderId
The strategy ID associated with the event.
与事件关联的策略 ID。
Return type:
StrategyId
Type:
OrderFilled.strategy_id
"""
...
@staticmethod
def to_dict(obj: "OrderFilled"):
"""
Return a dictionary representation of this object.
返回此对象的字典表示形式。
Return type:
dict[str, object]
"""
...
@property
def trade_id(self) -> "TradeId":
"""
The trade match ID (assigned by the venue).
成交匹配 ID(由交易场所分配)。
Returns:
TradeId
"""
...
@property
def trader_id(self) -> "TraderId":
"""
TraderId
The trader ID associated with the event.
与事件关联的交易者 ID。
Return type:
TraderId
Type:
OrderFilled.trader_id
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderFilled.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderFilled.ts_init
"""
...
@property
def venue_order_id(self) -> "VenueOrderId" | None:
"""
VenueOrderId | None
The venue order ID associated with the event.
与事件关联的交易场所订单 ID。
Return type:
VenueOrderId or None
Type:
OrderFilled.venue_order_id
"""
...
class OrderInitialized(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.
trader_id (TraderId) - 交易者 ID。
strategy_id (StrategyId) – The strategy ID.
strategy_id (StrategyId) - 策略 ID。
instrument_id (InstrumentId) – The instrument ID.
instrument_id (InstrumentId) - 金融工具 ID。
client_order_id (ClientOrderId) – The client order ID.
client_order_id (ClientOrderId) - 客户订单 ID。
order_side (OrderSide {BUY, SELL}) – The order side.
order_side (OrderSide {BUY, SELL}) - 订单方向。
order_type (OrderType) – The order type.
order_type (OrderType) - 订单类型。
quantity (Quantity) – The order quantity.
quantity (Quantity) - 订单数量。
time_in_force (TimeInForce {GTC, IOC, FOK, GTD, DAY, AT_THE_OPEN, AT_THE_CLOSE}) – The order time in force.
time_in_force (TimeInForce {GTC, IOC, FOK, GTD, DAY, AT_THE_OPEN, AT_THE_CLOSE}) - 订单有效时间。
post_only (bool) – If the order will only provide liquidity (make a market).
post_only (bool) - 如果订单只提供流动性(做市商)。
reduce_only (bool) – If the order carries the ‘reduce-only’ execution instruction.
reduce_only (bool) - 如果订单带有“仅减少”执行指令。
quote_quantity (bool) – If the order quantity is denominated in the quote currency.
quote_quantity (bool) - 如果订单数量以报价货币计价。
options (dict *[*str , str ]) – The order initialization options. Contains mappings for specific order parameters.
options (dict *[*str , str ]) - 订单初始化选项。包含特定订单参数的映射。
emulation_trigger (EmulationTrigger) – The emulation trigger for the order.
emulation_trigger (EmulationTrigger) - 订单的模拟触发器。
trigger_instrument_id (InstrumentId, optional with no default so None must be passed explicitly) – The emulation trigger instrument ID for the order (if None then will be the instrument_id).
trigger_instrument_id (InstrumentId,可选,无默认值,因此必须显式传递 None) - 订单的模拟触发器金融工具 ID(如果为 None,则将为 instrument_id)。
contingency_type (ContingencyType) – The order contingency type.
contingency_type (ContingencyType) - 订单意外事件类型。
order_list_id (OrderListId, optional with no default so None must be passed explicitly) – The order list ID associated with the order.
order_list_id (OrderListId,可选,无默认值,因此必须显式传递 None) - 与订单关联的订单列表 ID。
linked_order_ids (list[ClientOrderId], optional with no default so None must be passed explicitly) – The order linked client order ID(s).
linked_order_ids (list[ClientOrderId],可选,无默认值,因此必须显式传递 None) - 订单关联的客户订单 ID。
parent_order_id (ClientOrderId, optional with no default so None must be passed explicitly) – The orders parent client order ID.
parent_order_id (ClientOrderId,可选,无默认值,因此必须显式传递 None) - 订单的父客户订单 ID。
exec_algorithm_id (ExecAlgorithmId, optional with no default so None must be passed explicitly) – The execution algorithm ID for the order.
exec_algorithm_id (ExecAlgorithmId,可选,无默认值,因此必须显式传递 None) - 订单的执行算法 ID。
exec_algorithm_params (dict *[*str , Any ] , optional) – The execution algorithm parameters for the order.
exec_algorithm_params (dict *[*str , Any ],可选) - 订单的执行算法参数。
exec_spawn_id (ClientOrderId, optional with no default so None must be passed explicitly) – The execution algorithm spawning primary client order ID.
exec_spawn_id (ClientOrderId,可选,无默认值,因此必须显式传递 None) - 执行算法生成的原始客户订单 ID。
tags (list[str], optional with no default so None must be passed explicitly) – The custom user tags for the order.
tags (list[str],可选,无默认值,因此必须显式传递 None) - 订单的自定义用户标签。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
reconciliation (bool , default False) – If the event was generated during reconciliation.
reconciliation (bool,默认 False) - 如果事件是在对账期间生成的。
Raises:
ValueError – If order_side is NO_ORDER_SIDE.
ValueError - 如果 order_side 为 NO_ORDER_SIDE。
ValueError – If exec_algorithm_id is not None, and exec_spawn_id is None.
ValueError - 如果 exec_algorithm_id 不为 None,而 exec_spawn_id 为 None。
"""
@property
def account_id(self) -> "AccountId" | None:
"""
AccountId | None
The account ID associated with the event.
与事件关联的账户 ID。
Return type:
AccountId or None
Type:
OrderInitialized.account_id
"""
...
@property
def client_order_id(self) -> "ClientOrderId":
"""
ClientOrderId
The client order ID associated with the event.
与事件关联的客户订单 ID。
Return type:
ClientOrderId
Type:
OrderInitialized.client_order_id
"""
...
@property
def contingency_type(self) -> "ContingencyType":
"""
The orders contingency type.
订单的意外事件类型。
Returns:
ContingencyType
"""
...
@property
def emulation_trigger(self) -> "TriggerType":
"""
The order emulation trigger type.
订单模拟触发器类型。
Returns:
TriggerType
"""
...
@property
def exec_algorithm_id(self) -> "ExecAlgorithmId" or None:
"""
The execution algorithm ID for the order.
订单的执行算法 ID。
Returns:
ExecAlgorithmId or None
"""
...
@property
def exec_algorithm_params(self) -> dict[str, Any] or None:
"""
The execution algorithm parameters for the order.
订单的执行算法参数。
Returns:
dict[str, Any] or None
"""
...
@property
def exec_spawn_id(self) -> "ClientOrderId" or None:
"""
The execution algorithm spawning client order ID.
执行算法生成的客户订单 ID。
Returns:
ClientOrderId or None
"""
...
@staticmethod
def from_dict(values: dict) -> "OrderInitialized":
"""
Return an order initialized event from the given dict values.
从给定的字典值返回订单初始化事件。
Parameters:
values (dict *[*str , object ]) – The values for initialization.
values (dict *[*str , object ]) - 初始化的值。
Return type:
OrderInitialized
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
OrderInitialized.id
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
InstrumentId
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Return type:
InstrumentId
Type:
OrderInitialized.instrument_id
"""
...
@property
def linked_order_ids(self) -> list["ClientOrderId"] or None:
"""
The orders linked client order ID(s).
订单关联的客户订单 ID。
Returns:
list[ClientOrderId] or None
"""
...
@property
def options(self) -> dict:
"""
The order initialization options.
订单初始化选项。
Returns:
dict
"""
...
@property
def order_list_id(self) -> "OrderListId" or None:
"""
The order list ID associated with the order.
与订单关联的订单列表 ID。
Returns:
OrderListId or None
"""
...
@property
def order_type(self) -> "OrderType":
"""
The order type.
订单类型。
Returns:
OrderType
"""
...
@property
def parent_order_id(self) -> "ClientOrderId" or None:
"""
The orders parent client order ID.
订单的父客户订单 ID。
Returns:
ClientOrderId or None
"""
...
@property
def post_only(self) -> bool:
"""
If the order will only provide liquidity (make a market).
如果订单只提供流动性(做市商)。
Returns:
bool
"""
...
@property
def quantity(self) -> "Quantity":
"""
The order quantity.
订单数量。
Returns:
Quantity
"""
...
@property
def quote_quantity(self) -> bool:
"""
If the order quantity is denominated in the quote currency.
如果订单数量以报价货币计价。
Returns:
bool
"""
...
@property
def reconciliation(self) -> bool:
"""
bool
If the event was generated during reconciliation.
如果事件是在对账期间生成的。
Return type:
bool
Type:
OrderInitialized.reconciliation
"""
...
@property
def reduce_only(self) -> bool:
"""
If the order carries the ‘reduce-only’ execution instruction.
如果订单带有“仅减少”执行指令。
Returns:
bool
"""
...
def set_client_order_id(self, client_order_id: "ClientOrderId"):
...
@property
def side(self) -> "OrderSide":
"""
The order side.
订单方向。
Returns:
OrderSide
"""
...
@property
def strategy_id(self) -> "TraderId":
"""
TraderId
The strategy ID associated with the event.
与事件关联的策略 ID。
Return type:
StrategyId
Type:
OrderInitialized.strategy_id
"""
...
@property
def tags(self) -> list[str] or None:
"""
The order custom user tags.
订单的自定义用户标签。
Returns:
list[str] or None
"""
...
@property
def time_in_force(self) -> "TimeInForce":
"""
The order time in force.
订单有效时间。
Returns:
TimeInForce
"""
...
@staticmethod
def to_dict(obj: "OrderInitialized"):
"""
Return a dictionary representation of this object.
返回此对象的字典表示形式。
Return type:
dict[str, object]
"""
...
@property
def trader_id(self) -> "TraderId":
"""
TraderId
The trader ID associated with the event.
与事件关联的交易者 ID。
Return type:
TraderId
Type:
OrderInitialized.trader_id
"""
...
@property
def trigger_instrument_id(self) -> "InstrumentId" or None:
"""
The order emulation trigger instrument ID (will be instrument_id if None).
订单模拟触发器金融工具 ID(如果为 None,则将为 instrument_id)。
Returns:
InstrumentId or None
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderInitialized.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderInitialized.ts_init
"""
...
@property
def venue_order_id(self) -> "VenueOrderId" | None:
"""
VenueOrderId | None
The venue order ID associated with the event.
与事件关联的交易场所订单 ID。
Return type:
VenueOrderId or None
Type:
OrderInitialized.venue_order_id
"""
...
class OrderModifyRejected(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.
表示 ModifyOrder 命令被交易场所拒绝的事件。
Parameters:
trader_id (TraderId) – The trader ID.
trader_id (TraderId) - 交易者 ID。
strategy_id (StrategyId) – The strategy ID.
strategy_id (StrategyId) - 策略 ID。
instrument_id (InstrumentId) – The instrument ID.
instrument_id (InstrumentId) - 金融工具 ID。
client_order_id (ClientOrderId) – The client order ID.
client_order_id (ClientOrderId) - 客户订单 ID。
venue_order_id (VenueOrderId, optional with no default so None must be passed explicitly) – The venue order ID (assigned by the venue).
venue_order_id (VenueOrderId,可选,无默认值,因此必须显式传递 None) - 交易场所订单 ID(由交易场所分配)。
account_id (AccountId, optional with no default so None must be passed explicitly) – The account ID (with the venue).
account_id (AccountId,可选,无默认值,因此必须显式传递 None) - 账户 ID(包含交易场所)。
reason (str) – The order update rejected reason.
reason (str) - 订单更新被拒绝的原因。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the order update rejected event occurred.
ts_event (uint64_t) - 订单更新被拒绝事件发生时的 UNIX 时间戳(纳秒)。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
reconciliation (bool , default False) – If the event was generated during reconciliation.
reconciliation (bool,默认 False) - 如果事件是在对账期间生成的。
Raises:
ValueError – If reason is not a valid string.
ValueError - 如果 reason 不是有效的字符串。
"""
@property
def account_id(self) -> "AccountId" | None:
"""
AccountId | None
The account ID associated with the event.
与事件关联的账户 ID。
Return type:
AccountId or None
Type:
OrderModifyRejected.account_id
"""
...
@property
def client_order_id(self) -> "ClientOrderId":
"""
ClientOrderId
The client order ID associated with the event.
与事件关联的客户订单 ID。
Return type:
ClientOrderId
Type:
OrderModifyRejected.client_order_id
"""
...
@staticmethod
def from_dict(values: dict) -> "OrderModifyRejected":
"""
Return an order update rejected event from the given dict values.
从给定的字典值返回订单更新被拒绝事件。
Parameters:
values (dict *[*str , object ]) – The values for initialization.
values (dict *[*str , object ]) - 初始化的值。
Return type:
OrderModifyRejected
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
OrderModifyRejected.id
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
InstrumentId
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Return type:
InstrumentId
Type:
OrderModifyRejected.instrument_id
"""
...
@property
def reason(self) -> str:
"""
str
Return the reason the order was rejected.
返回订单被拒绝的原因。
Return type:
str
Type:
OrderModifyRejected.reason
"""
...
@property
def reconciliation(self) -> bool:
"""
bool
If the event was generated during reconciliation.
如果事件是在对账期间生成的。
Return type:
bool
Type:
OrderModifyRejected.reconciliation
"""
...
def set_client_order_id(self, client_order_id: "ClientOrderId"):
...
@property
def strategy_id(self) -> "TraderId":
"""
TraderId
The strategy ID associated with the event.
与事件关联的策略 ID。
Return type:
StrategyId
Type:
OrderModifyRejected.strategy_id
"""
...
@staticmethod
def to_dict(obj: "OrderModifyRejected"):
"""
Return a dictionary representation of this object.
返回此对象的字典表示形式。
Return type:
dict[str, object]
"""
...
@property
def trader_id(self) -> "TraderId":
"""
TraderId
The trader ID associated with the event.
与事件关联的交易者 ID。
Return type:
TraderId
Type:
OrderModifyRejected.trader_id
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderModifyRejected.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderModifyRejected.ts_init
"""
...
@property
def venue_order_id(self) -> "VenueOrderId" | None:
"""
VenueOrderId | None
The venue order ID associated with the event.
与事件关联的交易场所订单 ID。
Return type:
VenueOrderId or None
Type:
OrderModifyRejected.venue_order_id
"""
...
class OrderPendingCancel(OrderEvent):
"""
OrderPendingCancel(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 a CancelOrder command has been sent to the trading venue.
表示已将 CancelOrder 命令发送到交易场所的事件。
Parameters:
trader_id (TraderId) – The trader ID.
trader_id (TraderId) - 交易者 ID。
strategy_id (StrategyId) – The strategy ID.
strategy_id (StrategyId) - 策略 ID。
instrument_id (InstrumentId) – The instrument ID.
instrument_id (InstrumentId) - 金融工具 ID。
client_order_id (ClientOrderId) – The client order ID.
client_order_id (ClientOrderId) - 客户订单 ID。
venue_order_id (VenueOrderId, optional with no default so None must be passed explicitly) – The venue order ID (assigned by the venue).
venue_order_id (VenueOrderId,可选,无默认值,因此必须显式传递 None) - 交易场所订单 ID(由交易场所分配)。
account_id (AccountId, optional with no default so None must be passed explicitly) – The account ID (with the venue).
account_id (AccountId,可选,无默认值,因此必须显式传递 None) - 账户 ID(包含交易场所)。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the order pending cancel event occurred.
ts_event (uint64_t) - 订单待取消事件发生时的 UNIX 时间戳(纳秒)。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
reconciliation (bool , default False) – If the event was generated during reconciliation.
reconciliation (bool,默认 False) - 如果事件是在对账期间生成的。
"""
@property
def account_id(self) -> "AccountId" | None:
"""
AccountId | None
The account ID associated with the event.
与事件关联的账户 ID。
Return type:
AccountId or None
Type:
OrderPendingCancel.account_id
"""
...
@property
def client_order_id(self) -> "ClientOrderId":
"""
ClientOrderId
The client order ID associated with the event.
与事件关联的客户订单 ID。
Return type:
ClientOrderId
Type:
OrderPendingCancel.client_order_id
"""
...
@staticmethod
def from_dict(values: dict) -> "OrderPendingCancel":
"""
Return an order pending cancel event from the given dict values.
从给定的字典值返回订单待取消事件。
Parameters:
values (dict *[*str , object ]) – The values for initialization.
values (dict *[*str , object ]) - 初始化的值。
Return type:
OrderPendingCancel
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
OrderPendingCancel.id
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
InstrumentId
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Return type:
InstrumentId
Type:
OrderPendingCancel.instrument_id
"""
...
@property
def reconciliation(self) -> bool:
"""
bool
If the event was generated during reconciliation.
如果事件是在对账期间生成的。
Return type:
bool
Type:
OrderPendingCancel.reconciliation
"""
...
def set_client_order_id(self, client_order_id: "ClientOrderId"):
...
@property
def strategy_id(self) -> "TraderId":
"""
TraderId
The strategy ID associated with the event.
与事件关联的策略 ID。
Return type:
StrategyId
Type:
OrderPendingCancel.strategy_id
"""
...
@staticmethod
def to_dict(obj: "OrderPendingCancel"):
"""
Return a dictionary representation of this object.
返回此对象的字典表示形式。
Return type:
dict[str, object]
"""
...
@property
def trader_id(self) -> "TraderId":
"""
TraderId
The trader ID associated with the event.
与事件关联的交易者 ID。
Return type:
TraderId
Type:
OrderPendingCancel.trader_id
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderPendingCancel.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderPendingCancel.ts_init
"""
...
@property
def venue_order_id(self) -> "VenueOrderId" | None:
"""
VenueOrderId | None
The venue order ID associated with the event.
与事件关联的交易场所订单 ID。
Return type:
VenueOrderId or None
Type:
OrderPendingCancel.venue_order_id
"""
...
class OrderPendingUpdate(OrderEvent):
"""
OrderPendingUpdate(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 ModifyOrder command has been sent to the trading venue.
表示已将 ModifyOrder 命令发送到交易场所的事件。
Parameters:
trader_id (TraderId) – The trader ID.
trader_id (TraderId) - 交易者 ID。
strategy_id (StrategyId) – The strategy ID.
strategy_id (StrategyId) - 策略 ID。
instrument_id (InstrumentId) – The instrument ID.
instrument_id (InstrumentId) - 金融工具 ID。
client_order_id (ClientOrderId) – The client order ID.
client_order_id (ClientOrderId) - 客户订单 ID。
venue_order_id (VenueOrderId, optional with no default so None must be passed explicitly) – The venue order ID (assigned by the venue).
venue_order_id (VenueOrderId,可选,无默认值,因此必须显式传递 None) - 交易场所订单 ID(由交易场所分配)。
account_id (AccountId, optional with no default so None must be passed explicitly) – The account ID (with the venue).
account_id (AccountId,可选,无默认值,因此必须显式传递 None) - 账户 ID(包含交易场所)。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the order pending update event occurred.
ts_event (uint64_t) - 订单待更新事件发生时的 UNIX 时间戳(纳秒)。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
reconciliation (bool , default False) – If the event was generated during reconciliation.
reconciliation (bool,默认 False) - 如果事件是在对账期间生成的。
"""
@property
def account_id(self) -> "AccountId" | None:
"""
AccountId | None
The account ID associated with the event.
与事件关联的账户 ID。
Return type:
AccountId or None
Type:
OrderPendingUpdate.account_id
"""
...
@property
def client_order_id(self) -> "ClientOrderId":
"""
ClientOrderId
The client order ID associated with the event.
与事件关联的客户订单 ID。
Return type:
ClientOrderId
Type:
OrderPendingUpdate.client_order_id
"""
...
@staticmethod
def from_dict(values: dict) -> "OrderPendingUpdate":
"""
Return an order pending update event from the given dict values.
从给定的字典值返回订单待更新事件。
Parameters:
values (dict *[*str , object ]) – The values for initialization.
values (dict *[*str , object ]) - 初始化的值。
Return type:
OrderPendingUpdate
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
OrderPendingUpdate.id
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
InstrumentId
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Return type:
InstrumentId
Type:
OrderPendingUpdate.instrument_id
"""
...
@property
def reconciliation(self) -> bool:
"""
bool
If the event was generated during reconciliation.
如果事件是在对账期间生成的。
Return type:
bool
Type:
OrderPendingUpdate.reconciliation
"""
...
def set_client_order_id(self, client_order_id: "ClientOrderId"):
...
@property
def strategy_id(self) -> "TraderId":
"""
TraderId
The strategy ID associated with the event.
与事件关联的策略 ID。
Return type:
StrategyId
Type:
OrderPendingUpdate.strategy_id
"""
...
@staticmethod
def to_dict(obj: "OrderPendingUpdate"):
"""
Return a dictionary representation of this object.
返回此对象的字典表示形式。
Return type:
dict[str, object]
"""
...
@property
def trader_id(self) -> "TraderId":
"""
TraderId
The trader ID associated with the event.
与事件关联的交易者 ID。
Return type:
TraderId
Type:
OrderPendingUpdate.trader_id
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderPendingUpdate.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderPendingUpdate.ts_init
"""
...
@property
def venue_order_id(self) -> "VenueOrderId" | None:
"""
VenueOrderId | None
The venue order ID associated with the event.
与事件关联的交易场所订单 ID。
Return type:
VenueOrderId or None
Type:
OrderPendingUpdate.venue_order_id
"""
...
class OrderRejected(OrderEvent):
"""
OrderRejected(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, AccountId account_id, unicode reason, UUID4 event_id, uint64_t ts_event, uint64_t ts_init, bool reconciliation=False)
Represents an event where an order has been rejected by the trading venue.
表示一个订单被交易场所拒绝的事件。
Parameters:
trader_id (TraderId) – The trader ID.
trader_id (TraderId) - 交易者 ID。
strategy_id (StrategyId) – The strategy ID.
strategy_id (StrategyId) - 策略 ID。
instrument_id (InstrumentId) – The instrument ID.
instrument_id (InstrumentId) - 金融工具 ID。
client_order_id (ClientOrderId) – The client order ID.
client_order_id (ClientOrderId) - 客户订单 ID。
account_id (AccountId) – The account ID (with the venue).
account_id (AccountId) - 账户 ID(包含交易场所)。
reason (datetime) – The order rejected reason.
reason (datetime) - 订单被拒绝的原因。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the order rejected event occurred.
ts_event (uint64_t) - 订单被拒绝事件发生时的 UNIX 时间戳(纳秒)。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
reconciliation (bool , default False) – If the event was generated during reconciliation.
reconciliation (bool,默认 False) - 如果事件是在对账期间生成的。
Raises:
ValueError – If reason is not a valid string.
ValueError - 如果 reason 不是有效的字符串。
"""
@property
def account_id(self) -> "AccountId" | None:
"""
AccountId | None
The account ID associated with the event.
与事件关联的账户 ID。
Return type:
AccountId or None
Type:
OrderRejected.account_id
"""
...
@property
def client_order_id(self) -> "ClientOrderId":
"""
ClientOrderId
The client order ID associated with the event.
与事件关联的客户订单 ID。
Return type:
ClientOrderId
Type:
OrderRejected.client_order_id
"""
...
@staticmethod
def from_dict(values: dict) -> "OrderRejected":
"""
Return an order rejected event from the given dict values.
从给定的字典值返回订单被拒绝事件。
Parameters:
values (dict *[*str , object ]) – The values for initialization.
values (dict *[*str , object ]) - 初始化的值。
Return type:
OrderRejected
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
OrderRejected.id
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
InstrumentId
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Return type:
InstrumentId
Type:
OrderRejected.instrument_id
"""
...
@property
def reason(self) -> str:
"""
str
Return the reason the order was rejected.
返回订单被拒绝的原因。
Return type:
str
Type:
OrderRejected.reason
"""
...
@property
def reconciliation(self) -> bool:
"""
bool
If the event was generated during reconciliation.
如果事件是在对账期间生成的。
Return type:
bool
Type:
OrderRejected.reconciliation
"""
...
def set_client_order_id(self, client_order_id: "ClientOrderId"):
...
@property
def strategy_id(self) -> "TraderId":
"""
TraderId
The strategy ID associated with the event.
与事件关联的策略 ID。
Return type:
StrategyId
Type:
OrderRejected.strategy_id
"""
...
@staticmethod
def to_dict(obj: "OrderRejected"):
"""
Return a dictionary representation of this object.
返回此对象的字典表示形式。
Return type:
dict[str, object]
"""
...
@property
def trader_id(self) -> "TraderId":
"""
TraderId
The trader ID associated with the event.
与事件关联的交易者 ID。
Return type:
TraderId
Type:
OrderRejected.trader_id
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderRejected.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderRejected.ts_init
"""
...
@property
def venue_order_id(self) -> "VenueOrderId" | None:
"""
VenueOrderId | None
The venue order ID associated with the event.
与事件关联的交易场所订单 ID。
Return type:
VenueOrderId or None
Type:
OrderRejected.venue_order_id
"""
...
class OrderReleased(OrderEvent):
"""
OrderReleased(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, Price released_price, UUID4 event_id, uint64_t ts_init)
Represents an event where an order was released from the OrderEmulator by the Nautilus system.
表示一个订单被 Nautilus 系统从 OrderEmulator 中释放的事件。
Parameters:
trader_id (TraderId) – The trader ID.
trader_id (TraderId) - 交易者 ID。
strategy_id (StrategyId) – The strategy ID.
strategy_id (StrategyId) - 策略 ID。
instrument_id (InstrumentId) – The instrument ID.
instrument_id (InstrumentId) - 金融工具 ID。
client_order_id (ClientOrderId) – The client order ID.
client_order_id (ClientOrderId) - 客户订单 ID。
released_price (Price) – The price which released the order from the emulator.
released_price (Price) - 从模拟器中释放订单的价格。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
"""
@property
def account_id(self) -> "AccountId" | None:
"""
AccountId | None
The account ID associated with the event.
与事件关联的账户 ID。
Return type:
AccountId or None
Type:
OrderReleased.account_id
"""
...
@property
def client_order_id(self) -> "ClientOrderId":
"""
ClientOrderId
The client order ID associated with the event.
与事件关联的客户订单 ID。
Return type:
ClientOrderId
Type:
OrderReleased.client_order_id
"""
...
@staticmethod
def from_dict(values: dict) -> "OrderReleased":
"""
Return an order released event from the given dict values.
从给定的字典值返回订单释放事件。
Parameters:
values (dict *[*str , object ]) – The values for initialization.
values (dict *[*str , object ]) - 初始化的值。
Return type:
OrderReleased
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
OrderReleased.id
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
InstrumentId
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Return type:
InstrumentId
Type:
OrderReleased.instrument_id
"""
...
@property
def reconciliation(self) -> bool:
"""
bool
If the event was generated during reconciliation.
如果事件是在对账期间生成的。
Return type:
bool
Type:
OrderReleased.reconciliation
"""
...
@property
def released_price(self) -> "Price":
"""
Price
The released price for the event.
事件的释放价格。
Return type:
Price
Type:
OrderReleased.released_price
"""
...
def set_client_order_id(self, client_order_id: "ClientOrderId"):
...
@property
def strategy_id(self) -> "TraderId":
"""
TraderId
The strategy ID associated with the event.
与事件关联的策略 ID。
Return type:
StrategyId
Type:
OrderReleased.strategy_id
"""
...
@staticmethod
def to_dict(obj: "OrderReleased"):
"""
Return a dictionary representation of this object.
返回此对象的字典表示形式。
Return type:
dict[str, object]
"""
...
@property
def trader_id(self) -> "TraderId":
"""
TraderId
The trader ID associated with the event.
与事件关联的交易者 ID。
Return type:
TraderId
Type:
OrderReleased.trader_id
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderReleased.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderReleased.ts_init
"""
...
@property
def venue_order_id(self) -> "VenueOrderId" | None:
"""
VenueOrderId | None
The venue order ID associated with the event.
与事件关联的交易场所订单 ID。
Return type:
VenueOrderId or None
Type:
OrderReleased.venue_order_id
"""
...
class OrderSubmitted(OrderEvent):
"""
OrderSubmitted(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, AccountId account_id, UUID4 event_id, uint64_t ts_event, uint64_t ts_init)
Represents an event where an order has been submitted by the system to the trading venue.
表示一个订单已由系统提交到交易场所的事件。
Parameters:
trader_id (TraderId) – The trader ID.
trader_id (TraderId) - 交易者 ID。
strategy_id (StrategyId) – The strategy ID.
strategy_id (StrategyId) - 策略 ID。
instrument_id (InstrumentId) – The instrument ID.
instrument_id (InstrumentId) - 金融工具 ID。
client_order_id (ClientOrderId) – The client order ID.
client_order_id (ClientOrderId) - 客户订单 ID。
account_id (AccountId) – The account ID (with the venue).
account_id (AccountId) - 账户 ID(包含交易场所)。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the order submitted event occurred.
ts_event (uint64_t) - 订单提交事件发生时的 UNIX 时间戳(纳秒)。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
"""
@property
def account_id(self) -> "AccountId" | None:
"""
AccountId | None
The account ID associated with the event.
与事件关联的账户 ID。
Return type:
AccountId or None
Type:
OrderSubmitted.account_id
"""
...
@property
def client_order_id(self) -> "ClientOrderId":
"""
ClientOrderId
The client order ID associated with the event.
与事件关联的客户订单 ID。
Return type:
ClientOrderId
Type:
OrderSubmitted.client_order_id
"""
...
@staticmethod
def from_dict(values: dict) -> "OrderSubmitted":
"""
Return an order submitted event from the given dict values.
从给定的字典值返回订单提交事件。
Parameters:
values (dict *[*str , object ]) – The values for initialization.
values (dict *[*str , object ]) - 初始化的值。
Return type:
OrderSubmitted
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
OrderSubmitted.id
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
InstrumentId
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Return type:
InstrumentId
Type:
OrderSubmitted.instrument_id
"""
...
@property
def reconciliation(self) -> bool:
"""
bool
If the event was generated during reconciliation.
如果事件是在对账期间生成的。
Return type:
bool
Type:
OrderSubmitted.reconciliation
"""
...
def set_client_order_id(self, client_order_id: "ClientOrderId"):
...
@property
def strategy_id(self) -> "TraderId":
"""
TraderId
The strategy ID associated with the event.
与事件关联的策略 ID。
Return type:
StrategyId
Type:
OrderSubmitted.strategy_id
"""
...
@staticmethod
def to_dict(obj: "OrderSubmitted"):
"""
Return a dictionary representation of this object.
返回此对象的字典表示形式。
Return type:
dict[str, object]
"""
...
@property
def trader_id(self) -> "TraderId":
"""
TraderId
The trader ID associated with the event.
与事件关联的交易者 ID。
Return type:
TraderId
Type:
OrderSubmitted.trader_id
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderSubmitted.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderSubmitted.ts_init
"""
...
@property
def venue_order_id(self) -> "VenueOrderId" | None:
"""
VenueOrderId | None
The venue order ID associated with the event.
与事件关联的交易场所订单 ID。
Return type:
VenueOrderId or None
Type:
OrderSubmitted.venue_order_id
"""
...
class OrderTriggered(OrderEvent):
"""
OrderTriggered(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 triggered.
表示一个订单已被触发的事件。
Applicable to StopLimit orders only.
仅适用于止损限价单。
Parameters:
trader_id (TraderId) – The trader ID.
trader_id (TraderId) - 交易者 ID。
strategy_id (StrategyId) – The strategy ID.
strategy_id (StrategyId) - 策略 ID。
instrument_id (InstrumentId) – The instrument ID.
instrument_id (InstrumentId) - 金融工具 ID。
client_order_id (ClientOrderId) – The client order ID.
client_order_id (ClientOrderId) - 客户订单 ID。
venue_order_id (VenueOrderId, optional with no default so None must be passed explicitly) – The venue order ID (assigned by the venue).
venue_order_id (VenueOrderId,可选,无默认值,因此必须显式传递 None) - 交易场所订单 ID(由交易场所分配)。
account_id (AccountId, optional with no default so None must be passed explicitly) – The account ID (with the venue).
account_id (AccountId,可选,无默认值,因此必须显式传递 None) - 账户 ID(包含交易场所)。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the order triggered event occurred.
ts_event (uint64_t) - 订单触发事件发生时的 UNIX 时间戳(纳秒)。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
reconciliation (bool , default False) – If the event was generated during reconciliation.
reconciliation (bool,默认 False) - 如果事件是在对账期间生成的。
"""
@property
def account_id(self) -> "AccountId" | None:
"""
AccountId | None
The account ID associated with the event.
与事件关联的账户 ID。
Return type:
AccountId or None
Type:
OrderTriggered.account_id
"""
...
@property
def client_order_id(self) -> "ClientOrderId":
"""
ClientOrderId
The client order ID associated with the event.
与事件关联的客户订单 ID。
Return type:
ClientOrderId
Type:
OrderTriggered.client_order_id
"""
...
@staticmethod
def from_dict(values: dict) -> "OrderTriggered":
"""
Return an order triggered event from the given dict values.
从给定的字典值返回订单触发事件。
Parameters:
values (dict *[*str , object ]) – The values for initialization.
values (dict *[*str , object ]) - 初始化的值。
Return type:
OrderTriggered
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
OrderTriggered.id
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
InstrumentId
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Return type:
InstrumentId
Type:
OrderTriggered.instrument_id
"""
...
@property
def reconciliation(self) -> bool:
"""
bool
If the event was generated during reconciliation.
如果事件是在对账期间生成的。
Return type:
bool
Type:
OrderTriggered.reconciliation
"""
...
def set_client_order_id(self, client_order_id: "ClientOrderId"):
...
@property
def strategy_id(self) -> "TraderId":
"""
TraderId
The strategy ID associated with the event.
与事件关联的策略 ID。
Return type:
StrategyId
Type:
OrderTriggered.strategy_id
"""
...
@staticmethod
def to_dict(obj: "OrderTriggered"):
"""
Return a dictionary representation of this object.
返回此对象的字典表示形式。
Return type:
dict[str, object]
"""
...
@property
def trader_id(self) -> "TraderId":
"""
TraderId
The trader ID associated with the event.
与事件关联的交易者 ID。
Return type:
TraderId
Type:
OrderTriggered.trader_id
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderTriggered.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderTriggered.ts_init
"""
...
@property
def venue_order_id(self) -> "VenueOrderId" | None:
"""
VenueOrderId | None
The venue order ID associated with the event.
与事件关联的交易场所订单 ID。
Return type:
VenueOrderId or None
Type:
OrderTriggered.venue_order_id
"""
...
class OrderUpdated(OrderEvent):
"""
OrderUpdated(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, ClientOrderId client_order_id, VenueOrderId venue_order_id: VenueOrderId | None, AccountId account_id: AccountId | None, Quantity quantity, Price price: Price | None, Price trigger_price: Price | None, UUID4 event_id, uint64_t ts_event, uint64_t ts_init, bool reconciliation=False)
Represents an event where an order has been updated at the trading venue.
表示一个订单已在交易场所更新的事件。
Parameters:
trader_id (TraderId) – The trader ID.
trader_id (TraderId) - 交易者 ID。
strategy_id (StrategyId) – The strategy ID.
strategy_id (StrategyId) - 策略 ID。
instrument_id (InstrumentId) – The instrument ID
instrument_id (InstrumentId) - 金融工具 ID。
client_order_id (ClientOrderId) – The client order ID.
client_order_id (ClientOrderId) - 客户订单 ID。
venue_order_id (VenueOrderId, optional with no default so None must be passed explicitly) – The venue order ID (assigned by the venue).
venue_order_id (VenueOrderId,可选,无默认值,因此必须显式传递 None) - 交易场所订单 ID(由交易场所分配)。
account_id (AccountId, optional with no default so None must be passed explicitly) – The account ID (with the venue).
account_id (AccountId,可选,无默认值,因此必须显式传递 None) - 账户 ID(包含交易场所)。
quantity (Quantity) – The orders current quantity.
quantity (Quantity) - 订单的当前数量。
price (Price, optional with no default so None must be passed explicitly) – The orders current price.
price (Price,可选,无默认值,因此必须显式传递 None) - 订单的当前价格。
trigger_price (Price, optional with no default so None must be passed explicitly) – The orders current trigger.
trigger_price (Price,可选,无默认值,因此必须显式传递 None) - 订单的当前触发价格。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the order updated event occurred.
ts_event (uint64_t) - 订单更新事件发生时的 UNIX 时间戳(纳秒)。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
reconciliation (bool , default False) – If the event was generated during reconciliation.
reconciliation (bool,默认 False) - 如果事件是在对账期间生成的。
Raises:
ValueError – If quantity is not positive (> 0).
ValueError - 如果 quantity 不为正数 (> 0)。
"""
@property
def account_id(self) -> "AccountId" | None:
"""
AccountId | None
The account ID associated with the event.
与事件关联的账户 ID。
Return type:
AccountId or None
Type:
OrderUpdated.account_id
"""
...
@property
def client_order_id(self) -> "ClientOrderId":
"""
ClientOrderId
The client order ID associated with the event.
与事件关联的客户订单 ID。
Return type:
ClientOrderId
Type:
OrderUpdated.client_order_id
"""
...
@staticmethod
def from_dict(values: dict) -> "OrderUpdated":
"""
Return an order updated event from the given dict values.
从给定的字典值返回订单更新事件。
Parameters:
values (dict *[*str , object ]) – The values for initialization.
values (dict *[*str , object ]) - 初始化的值。
Return type:
OrderUpdated
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
OrderUpdated.id
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
InstrumentId
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Return type:
InstrumentId
Type:
OrderUpdated.instrument_id
"""
...
@property
def price(self) -> "Price" or None:
"""
The orders current price.
订单的当前价格。
Returns:
Price
"""
...
@property
def quantity(self) -> "Quantity":
"""
The orders current quantity.
订单的当前数量。
Returns:
Quantity
"""
...
@property
def reconciliation(self) -> bool:
"""
bool
If the event was generated during reconciliation.
如果事件是在对账期间生成的。
Return type:
bool
Type:
OrderUpdated.reconciliation
"""
...
def set_client_order_id(self, client_order_id: "ClientOrderId"):
...
@property
def strategy_id(self) -> "TraderId":
"""
TraderId
The strategy ID associated with the event.
与事件关联的策略 ID。
Return type:
StrategyId
Type:
OrderUpdated.strategy_id
"""
...
@staticmethod
def to_dict(obj: "OrderUpdated"):
"""
Return a dictionary representation of this object.
返回此对象的字典表示形式。
Return type:
dict[str, object]
"""
...
@property
def trader_id(self) -> "TraderId":
"""
TraderId
The trader ID associated with the event.
与事件关联的交易者 ID。
Return type:
TraderId
Type:
OrderUpdated.trader_id
"""
...
@property
def trigger_price(self) -> "Price" or None:
"""
The orders current trigger price.
订单的当前触发价格。
Returns:
Price or None
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderUpdated.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
OrderUpdated.ts_init
"""
...
@property
def venue_order_id(self) -> "VenueOrderId" | None:
"""
VenueOrderId | None
The venue order ID associated with the event.
与事件关联的交易场所订单 ID。
Return type:
VenueOrderId or None
Type:
OrderUpdated.venue_order_id
"""
...
class PositionChanged(PositionEvent):
"""
PositionChanged(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, PositionId position_id, AccountId account_id, ClientOrderId opening_order_id, OrderSide entry, PositionSide side, double signed_qty, Quantity quantity, Quantity peak_qty, Quantity last_qty, Price last_px, Currency currency, double avg_px_open, double avg_px_close, double realized_return, Money realized_pnl, Money unrealized_pnl, UUID4 event_id, uint64_t ts_opened, uint64_t ts_event, uint64_t ts_init)
Represents an event where a position has changed.
表示一个头寸已更改的事件。
Parameters:
trader_id (TraderId) – The trader ID.
trader_id (TraderId) - 交易者 ID。
strategy_id (StrategyId) – The strategy ID.
strategy_id (StrategyId) - 策略 ID。
instrument_id (InstrumentId) – The instrument ID.
instrument_id (InstrumentId) - 金融工具 ID。
position_id (PositionId) – The position IDt.
position_id (PositionId) - 头寸 ID。
account_id (AccountId) – The strategy ID.
account_id (AccountId) - 策略 ID。
opening_order_id (ClientOrderId) – The client order ID for the order which opened the position.
opening_order_id (ClientOrderId) - 开仓订单的客户订单 ID。
strategy_id – The strategy ID associated with the event.
strategy_id - 与事件关联的策略 ID。
entry (OrderSide {BUY, SELL}) – The position entry order side.
entry (OrderSide {BUY, SELL}) - 头寸入场订单方向。
side (PositionSide {FLAT, LONG, SHORT}) – The current position side.
side (PositionSide {FLAT, LONG, SHORT}) - 当前头寸方向。
signed_qty (double) – The current signed quantity (positive for LONG, negative for SHORT).
signed_qty (double) - 当前的带符号数量(LONG 为正,SHORT 为负)。
quantity (Quantity) – The current open quantity.
quantity (Quantity) - 当前的未平仓数量。
peak_qty (Quantity) – The peak directional quantity reached by the position.
peak_qty (Quantity) - 头寸达到的峰值方向数量。
last_qty (Quantity) – The last fill quantity for the position.
last_qty (Quantity) - 头寸的最后成交数量。
last_px (Price) – The last fill price for the position (not average price).
last_px (Price) - 头寸的最后成交价格(非平均价格)。
currency (Currency) – The position quote currency.
currency (Currency) - 头寸的报价货币。
avg_px_open (double) – The average open price.
avg_px_open (double) - 平均开仓价格。
avg_px_close (double) – The average close price.
avg_px_close (double) - 平均平仓价格。
realized_return (double) – The realized return for the position.
realized_return (double) - 头寸的已实现收益。
realized_pnl (Money) – The realized PnL for the position.
realized_pnl (Money) - 头寸的已实现盈亏。
unrealized_pnl (Money) – The unrealized PnL for the position.
unrealized_pnl (Money) - 头寸的未实现盈亏。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_opened (uint64_t) – UNIX timestamp (nanoseconds) when the position opened event occurred.
ts_opened (uint64_t) - 头寸开仓事件发生时的 UNIX 时间戳(纳秒)。
ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the position changed event occurred.
ts_event (uint64_t) - 头寸更改事件发生时的 UNIX 时间戳(纳秒)。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
"""
@property
def account_id(self) -> "AccountId":
"""
The account ID associated with the position.
与头寸关联的账户 ID。
Returns:
AccountId
"""
...
@property
def avg_px_close(self) -> float:
"""
The average closing price.
平均平仓价格。
Returns:
double
"""
...
@property
def avg_px_open(self) -> float:
"""
The average open price.
平均开仓价格。
Returns:
double
"""
...
@property
def closing_order_id(self) -> "ClientOrderId" or None:
"""
The client order ID for the order which closed the position.
平仓订单的客户订单 ID。
Returns:
ClientOrderId or None
"""
...
@staticmethod
def create(
position: "Position", fill: "OrderFilled", event_id: "UUID4", ts_init: int
) -> "PositionChanged":
"""
Return a position changed event from the given params.
从给定的参数返回头寸更改事件。
Parameters:
position (Position) – The position for the event.
position (Position) - 事件的头寸。
fill (OrderFilled) – The order fill for the event.
fill (OrderFilled) - 事件的订单成交。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
PositionChanged
"""
...
@property
def currency(self) -> "Currency":
"""
The position quote currency.
头寸的报价货币。
Returns:
Currency
"""
...
@property
def duration_ns(self) -> int:
"""
The total open duration (nanoseconds).
总的持仓时间(纳秒)。
Returns:
uint64_t
"""
...
@property
def entry(self) -> "OrderSide":
"""
The entry direction from open.
开仓方向。
Returns:
OrderSide
"""
...
@staticmethod
def from_dict(values: dict) -> "PositionChanged":
"""
Return a position changed event from the given dict values.
从给定的字典值返回头寸更改事件。
Parameters:
values (dict *[*str , object ]) – The values for initialization.
values (dict *[*str , object ]) - 初始化的值。
Return type:
PositionChanged
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
PositionEvent.id
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Returns:
InstrumentId
"""
...
@property
def last_px(self) -> "Price":
"""
The last fill price for the position.
头寸的最后成交价格。
Returns:
Price
"""
...
@property
def last_qty(self) -> "Quantity":
"""
The last fill quantity for the position.
头寸的最后成交数量。
Returns:
Quantity
"""
...
@property
def opening_order_id(self) -> "ClientOrderId":
"""
The client order ID for the order which opened the position.
开仓订单的客户订单 ID。
Returns:
ClientOrderId
"""
...
@property
def peak_qty(self) -> "Quantity":
"""
The peak directional quantity reached by the position.
头寸达到的峰值方向数量。
Returns:
Quantity
"""
...
@property
def position_id(self) -> "PositionId":
"""
The position ID associated with the event.
与事件关联的头寸 ID。
Returns:
PositionId
"""
...
@property
def quantity(self) -> "Quantity":
"""
The position open quantity.
头寸的未平仓数量。
Returns:
Quantity
"""
...
@property
def realized_pnl(self) -> "Money":
"""
The realized PnL for the position (including commissions).
头寸的已实现盈亏(包括佣金)。
Returns:
Money
"""
...
@property
def realized_return(self) -> float:
"""
The realized return for the position.
头寸的已实现收益。
Returns:
double
"""
...
@property
def side(self) -> "PositionSide":
"""
The position side.
头寸方向。
Returns:
PositionSide
"""
...
@property
def signed_qty(self) -> float:
"""
The position signed quantity (positive for LONG, negative for SHORT).
头寸的带符号数量(LONG 为正,SHORT 为负)。
Returns:
double
"""
...
@property
def strategy_id(self) -> "StrategyId":
"""
The strategy ID associated with the event.
与事件关联的策略 ID。
Returns:
StrategyId
"""
...
@staticmethod
def to_dict(obj: "PositionChanged"):
"""
Return a dictionary representation of this object.
返回此对象的字典表示形式。
Return type:
dict[str, object]
"""
...
@property
def trader_id(self) -> "TraderId":
"""
The trader ID associated with the event.
与事件关联的交易者 ID。
Returns:
TraderId
"""
...
@property
def ts_closed(self) -> int:
"""
UNIX timestamp (nanoseconds) when the position was closed.
头寸平仓时的 UNIX 时间戳(纳秒)。
Returns:
uint64_t
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
PositionEvent.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
PositionEvent.ts_init
"""
...
@property
def ts_opened(self) -> int:
"""
UNIX timestamp (nanoseconds) when the position was opened.
头寸开仓时的 UNIX 时间戳(纳秒)。
Returns:
uint64_t
"""
...
@property
def unrealized_pnl(self) -> "Money":
"""
The unrealized PnL for the position (including commissions).
头寸的未实现盈亏(包括佣金)。
Returns:
Money
"""
...
class PositionClosed(PositionEvent):
"""
PositionClosed(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, PositionId position_id, AccountId account_id, ClientOrderId opening_order_id, ClientOrderId closing_order_id, OrderSide entry, PositionSide side, double signed_qty, Quantity quantity, Quantity peak_qty, Quantity last_qty, Price last_px, Currency currency, double avg_px_open, double avg_px_close, double realized_return, Money realized_pnl, UUID4 event_id, uint64_t ts_opened, uint64_t ts_closed, uint64_t duration_ns, uint64_t ts_init)
Represents an event where a position has been closed.
表示一个头寸已平仓的事件。
Parameters:
trader_id (TraderId) – The trader ID.
trader_id (TraderId) - 交易者 ID。
strategy_id (StrategyId) – The strategy ID.
strategy_id (StrategyId) - 策略 ID。
instrument_id (InstrumentId) – The instrument ID.
instrument_id (InstrumentId) - 金融工具 ID。
position_id (PositionId) – The position IDt.
position_id (PositionId) - 头寸 ID。
account_id (AccountId) – The strategy ID.
account_id (AccountId) - 策略 ID。
opening_order_id (ClientOrderId) – The client order ID for the order which opened the position.
opening_order_id (ClientOrderId) - 开仓订单的客户订单 ID。
closing_order_id (ClientOrderId) – The client order ID for the order which closed the position.
closing_order_id (ClientOrderId) - 平仓订单的客户订单 ID。
strategy_id – The strategy ID associated with the event.
strategy_id - 与事件关联的策略 ID。
entry (OrderSide {BUY, SELL}) – The position entry order side.
entry (OrderSide {BUY, SELL}) - 头寸入场订单方向。
side (PositionSide {FLAT}) – The current position side.
side (PositionSide {FLAT}) - 当前头寸方向。
signed_qty (double) – The current signed quantity (positive for LONG, negative for SHORT).
signed_qty (double) - 当前的带符号数量(LONG 为正,SHORT 为负)。
quantity (Quantity) – The current open quantity.
quantity (Quantity) - 当前的未平仓数量。
peak_qty (Quantity) – The peak directional quantity reached by the position.
peak_qty (Quantity) - 头寸达到的峰值方向数量。
last_qty (Quantity) – The last fill quantity for the position.
last_qty (Quantity) - 头寸的最后成交数量。
last_px (Price) – The last fill price for the position (not average price).
last_px (Price) - 头寸的最后成交价格(非平均价格)。
currency (Currency) – The position quote currency.
currency (Currency) - 头寸的报价货币。
avg_px_open (Decimal) – The average open price.
avg_px_open (Decimal) - 平均开仓价格。
avg_px_close (Decimal) – The average close price.
avg_px_close (Decimal) - 平均平仓价格。
realized_return (Decimal) – The realized return for the position.
realized_return (Decimal) - 头寸的已实现收益。
realized_pnl (Money) – The realized PnL for the position.
realized_pnl (Money) - 头寸的已实现盈亏。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_opened (uint64_t) – UNIX timestamp (nanoseconds) when the position opened event occurred.
ts_opened (uint64_t) - 头寸开仓事件发生时的 UNIX 时间戳(纳秒)。
ts_closed (uint64_t) – UNIX timestamp (nanoseconds) when the position closed event occurred.
ts_closed (uint64_t) - 头寸平仓事件发生时的 UNIX 时间戳(纳秒)。
duration_ns (uint64_t) – The total open duration (nanoseconds).
duration_ns (uint64_t) - 总的持仓时间(纳秒)。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
"""
@property
def account_id(self) -> "AccountId":
"""
The account ID associated with the position.
与头寸关联的账户 ID。
Returns:
AccountId
"""
...
@property
def avg_px_close(self) -> float:
"""
The average closing price.
平均平仓价格。
Returns:
double
"""
...
@property
def avg_px_open(self) -> float:
"""
The average open price.
平均开仓价格。
Returns:
double
"""
...
@property
def closing_order_id(self) -> "ClientOrderId" or None:
"""
The client order ID for the order which closed the position.
平仓订单的客户订单 ID。
Returns:
ClientOrderId or None
"""
...
@staticmethod
def create(
position: "Position", fill: "OrderFilled", event_id: "UUID4", ts_init: int
) -> "PositionClosed":
"""
Return a position closed event from the given params.
从给定的参数返回头寸平仓事件。
Parameters:
position (Position) – The position for the event.
position (Position) - 事件的头寸。
fill (OrderFilled) – The order fill for the event.
fill (OrderFilled) - 事件的订单成交。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
PositionClosed
"""
...
@property
def currency(self) -> "Currency":
"""
The position quote currency.
头寸的报价货币。
Returns:
Currency
"""
...
@property
def duration_ns(self) -> int:
"""
The total open duration (nanoseconds).
总的持仓时间(纳秒)。
Returns:
uint64_t
"""
...
@property
def entry(self) -> "OrderSide":
"""
The entry direction from open.
开仓方向。
Returns:
OrderSide
"""
...
@staticmethod
def from_dict(values: dict) -> "PositionClosed":
"""
Return a position closed event from the given dict values.
从给定的字典值返回头寸平仓事件。
Parameters:
values (dict *[*str , object ]) – The values for initialization.
values (dict *[*str , object ]) - 初始化的值。
Return type:
PositionClosed
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
PositionEvent.id
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Returns:
InstrumentId
"""
...
@property
def last_px(self) -> "Price":
"""
The last fill price for the position.
头寸的最后成交价格。
Returns:
Price
"""
...
@property
def last_qty(self) -> "Quantity":
"""
The last fill quantity for the position.
头寸的最后成交数量。
Returns:
Quantity
"""
...
@property
def opening_order_id(self) -> "ClientOrderId":
"""
The client order ID for the order which opened the position.
开仓订单的客户订单 ID。
Returns:
ClientOrderId
"""
...
@property
def peak_qty(self) -> "Quantity":
"""
The peak directional quantity reached by the position.
头寸达到的峰值方向数量。
Returns:
Quantity
"""
...
@property
def position_id(self) -> "PositionId":
"""
The position ID associated with the event.
与事件关联的头寸 ID。
Returns:
PositionId
"""
...
@property
def quantity(self) -> "Quantity":
"""
The position open quantity.
头寸的未平仓数量。
Returns:
Quantity
"""
...
@property
def realized_pnl(self) -> "Money":
"""
The realized PnL for the position (including commissions).
头寸的已实现盈亏(包括佣金)。
Returns:
Money
"""
...
@property
def realized_return(self) -> float:
"""
The realized return for the position.
头寸的已实现收益。
Returns:
double
"""
...
@property
def side(self) -> "PositionSide":
"""
The position side.
头寸方向。
Returns:
PositionSide
"""
...
@property
def signed_qty(self) -> float:
"""
The position signed quantity (positive for LONG, negative for SHORT).
头寸的带符号数量(LONG 为正,SHORT 为负)。
Returns:
double
"""
...
@property
def strategy_id(self) -> "StrategyId":
"""
The strategy ID associated with the event.
与事件关联的策略 ID。
Returns:
StrategyId
"""
...
@staticmethod
def to_dict(obj: "PositionClosed"):
"""
Return a dictionary representation of this object.
返回此对象的字典表示形式。
Return type:
dict[str, object]
"""
...
@property
def trader_id(self) -> "TraderId":
"""
The trader ID associated with the event.
与事件关联的交易者 ID。
Returns:
TraderId
"""
...
@property
def ts_closed(self) -> int:
"""
UNIX timestamp (nanoseconds) when the position was closed.
头寸平仓时的 UNIX 时间戳(纳秒)。
Returns:
uint64_t
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
PositionEvent.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
PositionEvent.ts_init
"""
...
@property
def ts_opened(self) -> int:
"""
UNIX timestamp (nanoseconds) when the position was opened.
头寸开仓时的 UNIX 时间戳(纳秒)。
Returns:
uint64_t
"""
...
@property
def unrealized_pnl(self) -> "Money":
"""
The unrealized PnL for the position (including commissions).
头寸的未实现盈亏(包括佣金)。
Returns:
Money
"""
...
class PositionEvent(Event):
"""
PositionEvent(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, PositionId position_id, AccountId account_id, ClientOrderId opening_order_id, ClientOrderId closing_order_id: ClientOrderId | None, OrderSide entry, PositionSide side, double signed_qty, Quantity quantity, Quantity peak_qty, Quantity last_qty, Price last_px, Currency currency, double avg_px_open, double avg_px_close, double realized_return, Money realized_pnl, Money unrealized_pnl, UUID4 event_id, uint64_t ts_opened, uint64_t ts_closed, uint64_t duration_ns, uint64_t ts_event, uint64_t ts_init)
The base class for all position events.
所有头寸事件的基类。
Parameters:
trader_id (TraderId) – The trader ID.
trader_id (TraderId) - 交易者 ID。
strategy_id (StrategyId) – The strategy ID.
strategy_id (StrategyId) - 策略 ID。
instrument_id (InstrumentId) – The instrument ID.
instrument_id (InstrumentId) - 金融工具 ID。
position_id (PositionId) – The position IDt.
position_id (PositionId) - 头寸 ID。
account_id (AccountId) – The strategy ID.
account_id (AccountId) - 策略 ID。
opening_order_id (ClientOrderId) – The client order ID for the order which opened the position.
opening_order_id (ClientOrderId) - 开仓订单的客户订单 ID。
closing_order_id (ClientOrderId) – The client order ID for the order which closed the position.
closing_order_id (ClientOrderId) - 平仓订单的客户订单 ID。
entry (OrderSide {BUY, SELL}) – The position entry order side.
entry (OrderSide {BUY, SELL}) - 头寸入场订单方向。
side (PositionSide {FLAT, LONG, SHORT}) – The current position side.
side (PositionSide {FLAT, LONG, SHORT}) - 当前头寸方向。
signed_qty (double) – The current signed quantity (positive for LONG, negative for SHORT).
signed_qty (double) - 当前的带符号数量(LONG 为正,SHORT 为负)。
quantity (Quantity) – The current open quantity.
quantity (Quantity) - 当前的未平仓数量。
peak_qty (Quantity) – The peak directional quantity reached by the position.
peak_qty (Quantity) - 头寸达到的峰值方向数量。
last_qty (Quantity) – The last fill quantity for the position.
last_qty (Quantity) - 头寸的最后成交数量。
last_px (Price) – The last fill price for the position (not average price).
last_px (Price) - 头寸的最后成交价格(非平均价格)。
currency (Currency) – The position quote currency.
currency (Currency) - 头寸的报价货币。
avg_px_open (double) – The average open price.
avg_px_open (double) - 平均开仓价格。
avg_px_close (double) – The average close price.
avg_px_close (double) - 平均平仓价格。
realized_return (double) – The realized return for the position.
realized_return (double) - 头寸的已实现收益。
realized_pnl (Money) – The realized PnL for the position.
realized_pnl (Money) - 头寸的已实现盈亏。
unrealized_pnl (Money) – The unrealized PnL for the position.
unrealized_pnl (Money) - 头寸的未实现盈亏。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_opened (uint64_t) – UNIX timestamp (nanoseconds) when the position opened event occurred.
ts_opened (uint64_t) - 头寸开仓事件发生时的 UNIX 时间戳(纳秒)。
ts_closed (uint64_t) – UNIX timestamp (nanoseconds) when the position closed event occurred.
ts_closed (uint64_t) - 头寸平仓事件发生时的 UNIX 时间戳(纳秒)。
duration_ns (uint64_t) – The total open duration (nanoseconds), will be 0 if still open.
duration_ns (uint64_t) - 总的持仓时间(纳秒),如果仍然开仓,则为 0。
ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the event occurred.
ts_event (uint64_t) - 事件发生时的 UNIX 时间戳(纳秒)。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
WARNING
This class should not be used directly, but through a concrete subclass.
此类不应直接使用,而应通过具体的子类使用。
"""
@property
def account_id(self) -> "AccountId":
"""
The account ID associated with the position.
与头寸关联的账户 ID。
Returns:
AccountId
"""
...
@property
def avg_px_close(self) -> float:
"""
The average closing price.
平均平仓价格。
Returns:
double
"""
...
@property
def avg_px_open(self) -> float:
"""
The average open price.
平均开仓价格。
Returns:
double
"""
...
@property
def closing_order_id(self) -> "ClientOrderId" or None:
"""
The client order ID for the order which closed the position.
平仓订单的客户订单 ID。
Returns:
ClientOrderId or None
"""
...
@property
def currency(self) -> "Currency":
"""
The position quote currency.
头寸的报价货币。
Returns:
Currency
"""
...
@property
def duration_ns(self) -> int:
"""
The total open duration (nanoseconds).
总的持仓时间(纳秒)。
Returns:
uint64_t
"""
...
@property
def entry(self) -> "OrderSide":
"""
The entry direction from open.
开仓方向。
Returns:
OrderSide
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
PositionEvent.id
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Returns:
InstrumentId
"""
...
@property
def last_px(self) -> "Price":
"""
The last fill price for the position.
头寸的最后成交价格。
Returns:
Price
"""
...
@property
def last_qty(self) -> "Quantity":
"""
The last fill quantity for the position.
头寸的最后成交数量。
Returns:
Quantity
"""
...
@property
def opening_order_id(self) -> "ClientOrderId":
"""
The client order ID for the order which opened the position.
开仓订单的客户订单 ID。
Returns:
ClientOrderId
"""
...
@property
def peak_qty(self) -> "Quantity":
"""
The peak directional quantity reached by the position.
头寸达到的峰值方向数量。
Returns:
Quantity
"""
...
@property
def position_id(self) -> "PositionId":
"""
The position ID associated with the event.
与事件关联的头寸 ID。
Returns:
PositionId
"""
...
@property
def quantity(self) -> "Quantity":
"""
The position open quantity.
头寸的未平仓数量。
Returns:
Quantity
"""
...
@property
def realized_pnl(self) -> "Money":
"""
The realized PnL for the position (including commissions).
头寸的已实现盈亏(包括佣金)。
Returns:
Money
"""
...
@property
def realized_return(self) -> float:
"""
The realized return for the position.
头寸的已实现收益。
Returns:
double
"""
...
@property
def side(self) -> "PositionSide":
"""
The position side.
头寸方向。
Returns:
PositionSide
"""
...
@property
def signed_qty(self) -> float:
"""
The position signed quantity (positive for LONG, negative for SHORT).
头寸的带符号数量(LONG 为正,SHORT 为负)。
Returns:
double
"""
...
@property
def strategy_id(self) -> "StrategyId":
"""
The strategy ID associated with the event.
与事件关联的策略 ID。
Returns:
StrategyId
"""
...
@property
def trader_id(self) -> "TraderId":
"""
The trader ID associated with the event.
与事件关联的交易者 ID。
Returns:
TraderId
"""
...
@property
def ts_closed(self) -> int:
"""
UNIX timestamp (nanoseconds) when the position was closed.
头寸平仓时的 UNIX 时间戳(纳秒)。
Returns:
uint64_t
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
PositionEvent.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
PositionEvent.ts_init
"""
...
@property
def ts_opened(self) -> int:
"""
UNIX timestamp (nanoseconds) when the position was opened.
头寸开仓时的 UNIX 时间戳(纳秒)。
Returns:
uint64_t
"""
...
@property
def unrealized_pnl(self) -> "Money":
"""
The unrealized PnL for the position (including commissions).
头寸的未实现盈亏(包括佣金)。
Returns:
Money
"""
...
class PositionOpened(PositionEvent):
"""
PositionOpened(TraderId trader_id, StrategyId strategy_id, InstrumentId instrument_id, PositionId position_id, AccountId account_id, ClientOrderId opening_order_id, OrderSide entry, PositionSide side, double signed_qty, Quantity quantity, Quantity peak_qty, Quantity last_qty, Price last_px, Currency currency, double avg_px_open, Money realized_pnl, UUID4 event_id, uint64_t ts_event, uint64_t ts_init)
Represents an event where a position has been opened.
表示一个头寸已开仓的事件。
Parameters:
trader_id (TraderId) – The trader ID.
trader_id (TraderId) - 交易者 ID。
strategy_id (StrategyId) – The strategy ID.
strategy_id (StrategyId) - 策略 ID。
instrument_id (InstrumentId) – The instrument ID.
instrument_id (InstrumentId) - 金融工具 ID。
position_id (PositionId) – The position IDt.
position_id (PositionId) - 头寸 ID。
account_id (AccountId) – The strategy ID.
account_id (AccountId) - 策略 ID。
opening_order_id (ClientOrderId) – The client order ID for the order which opened the position.
opening_order_id (ClientOrderId) - 开仓订单的客户订单 ID。
strategy_id – The strategy ID associated with the event.
strategy_id - 与事件关联的策略 ID。
entry (OrderSide {BUY, SELL}) – The position entry order side.
entry (OrderSide {BUY, SELL}) - 头寸入场订单方向。
side (PositionSide {LONG, SHORT}) – The current position side.
side (PositionSide {LONG, SHORT}) - 当前头寸方向。
signed_qty (double) – The current signed quantity (positive for LONG, negative for SHORT).
signed_qty (double) - 当前的带符号数量(LONG 为正,SHORT 为负)。
quantity (Quantity) – The current open quantity.
quantity (Quantity) - 当前的未平仓数量。
peak_qty (Quantity) – The peak directional quantity reached by the position.
peak_qty (Quantity) - 头寸达到的峰值方向数量。
last_qty (Quantity) – The last fill quantity for the position.
last_qty (Quantity) - 头寸的最后成交数量。
last_px (Price) – The last fill price for the position (not average price).
last_px (Price) - 头寸的最后成交价格(非平均价格)。
currency (Currency) – The position quote currency.
currency (Currency) - 头寸的报价货币。
avg_px_open (double) – The average open price.
avg_px_open (double) - 平均开仓价格。
realized_pnl (Money) – The realized PnL for the position.
realized_pnl (Money) - 头寸的已实现盈亏。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the position opened event occurred.
ts_event (uint64_t) - 头寸开仓事件发生时的 UNIX 时间戳(纳秒)。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
"""
@property
def account_id(self) -> "AccountId":
"""
The account ID associated with the position.
与头寸关联的账户 ID。
Returns:
AccountId
"""
...
@property
def avg_px_close(self) -> float:
"""
The average closing price.
平均平仓价格。
Returns:
double
"""
...
@property
def avg_px_open(self) -> float:
"""
The average open price.
平均开仓价格。
Returns:
double
"""
...
@property
def closing_order_id(self) -> "ClientOrderId" or None:
"""
The client order ID for the order which closed the position.
平仓订单的客户订单 ID。
Returns:
ClientOrderId or None
"""
...
@staticmethod
def create(
position: "Position", fill: "OrderFilled", event_id: "UUID4", ts_init: int
) -> "PositionOpened":
"""
Return a position opened event from the given params.
从给定的参数返回头寸开仓事件。
Parameters:
position (Position) – The position for the event.
position (Position) - 事件的头寸。
fill (OrderFilled) – The order fill for the event.
fill (OrderFilled) - 事件的订单成交。
event_id (UUID4) – The event ID.
event_id (UUID4) - 事件 ID。
ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the object was initialized.
ts_init (uint64_t) - 对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
PositionOpened
"""
...
@property
def currency(self) -> "Currency":
"""
The position quote currency.
头寸的报价货币。
Returns:
Currency
"""
...
@property
def duration_ns(self) -> int:
"""
The total open duration (nanoseconds).
总的持仓时间(纳秒)。
Returns:
uint64_t
"""
...
@property
def entry(self) -> "OrderSide":
"""
The entry direction from open.
开仓方向。
Returns:
OrderSide
"""
...
@staticmethod
def from_dict(values: dict) -> "PositionOpened":
"""
Return a position opened event from the given dict values.
从给定的字典值返回头寸开仓事件。
Parameters:
values (dict *[*str , object ]) – The values for initialization.
values (dict *[*str , object ]) - 初始化的值。
Return type:
PositionOpened
"""
...
@property
def id(self) -> "UUID4":
"""
UUID4
The event message identifier.
事件消息标识符。
Return type:
UUID4
Type:
PositionEvent.id
"""
...
@property
def instrument_id(self) -> "InstrumentId":
"""
The instrument ID associated with the event.
与事件关联的金融工具 ID。
Returns:
InstrumentId
"""
...
@property
def last_px(self) -> "Price":
"""
The last fill price for the position.
头寸的最后成交价格。
Returns:
Price
"""
...
@property
def last_qty(self) -> "Quantity":
"""
The last fill quantity for the position.
头寸的最后成交数量。
Returns:
Quantity
"""
...
@property
def opening_order_id(self) -> "ClientOrderId":
"""
The client order ID for the order which opened the position.
开仓订单的客户订单 ID。
Returns:
ClientOrderId
"""
...
@property
def peak_qty(self) -> "Quantity":
"""
The peak directional quantity reached by the position.
头寸达到的峰值方向数量。
Returns:
Quantity
"""
...
@property
def position_id(self) -> "PositionId":
"""
The position ID associated with the event.
与事件关联的头寸 ID。
Returns:
PositionId
"""
...
@property
def quantity(self) -> "Quantity":
"""
The position open quantity.
头寸的未平仓数量。
Returns:
Quantity
"""
...
@property
def realized_pnl(self) -> "Money":
"""
The realized PnL for the position (including commissions).
头寸的已实现盈亏(包括佣金)。
Returns:
Money
"""
...
@property
def realized_return(self) -> float:
"""
The realized return for the position.
头寸的已实现收益。
Returns:
double
"""
...
@property
def side(self) -> "PositionSide":
"""
The position side.
头寸方向。
Returns:
PositionSide
"""
...
@property
def signed_qty(self) -> float:
"""
The position signed quantity (positive for LONG, negative for SHORT).
头寸的带符号数量(LONG 为正,SHORT 为负)。
Returns:
double
"""
...
@property
def strategy_id(self) -> "StrategyId":
"""
The strategy ID associated with the event.
与事件关联的策略 ID。
Returns:
StrategyId
"""
...
@staticmethod
def to_dict(obj: "PositionOpened"):
"""
Return a dictionary representation of this object.
返回此对象的字典表示形式。
Return type:
dict[str, object]
"""
...
@property
def trader_id(self) -> "TraderId":
"""
The trader ID associated with the event.
与事件关联的交易者 ID。
Returns:
TraderId
"""
...
@property
def ts_closed(self) -> int:
"""
UNIX timestamp (nanoseconds) when the position was closed.
头寸平仓时的 UNIX 时间戳(纳秒)。
Returns:
uint64_t
"""
...
@property
def ts_event(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the event occurred.
事件发生时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
PositionEvent.ts_event
"""
...
@property
def ts_init(self) -> int:
"""
int
UNIX timestamp (nanoseconds) when the object was initialized.
对象初始化时的 UNIX 时间戳(纳秒)。
Return type:
int
Type:
PositionEvent.ts_init
"""
...
@property
def ts_opened(self) -> int:
"""
UNIX timestamp (nanoseconds) when the position was opened.
头寸开仓时的 UNIX 时间戳(纳秒)。
Returns:
uint64_t
"""
...
@property
def unrealized_pnl(self) -> "Money":
"""
The unrealized PnL for the position (including commissions).
头寸的未实现盈亏(包括佣金)。
Returns:
Money
"""
...