pub struct PositionSnapshot {Show 26 fields
pub trader_id: TraderId,
pub strategy_id: StrategyId,
pub instrument_id: InstrumentId,
pub position_id: PositionId,
pub account_id: AccountId,
pub opening_order_id: ClientOrderId,
pub closing_order_id: Option<ClientOrderId>,
pub entry: OrderSide,
pub side: PositionSide,
pub signed_qty: f64,
pub quantity: Quantity,
pub peak_qty: Quantity,
pub quote_currency: Currency,
pub base_currency: Option<Currency>,
pub settlement_currency: Currency,
pub avg_px_open: f64,
pub avg_px_close: Option<f64>,
pub realized_return: Option<f64>,
pub realized_pnl: Money,
pub unrealized_pnl: Option<Money>,
pub commissions: Vec<Money>,
pub duration_ns: Option<u64>,
pub ts_opened: UnixNanos,
pub ts_closed: Option<UnixNanos>,
pub ts_last: UnixNanos,
pub ts_init: UnixNanos,
}
Expand description
Represents a position state snapshot as a certain instant.
Fields§
§trader_id: TraderId
The trader ID associated with the snapshot.
strategy_id: StrategyId
The strategy ID associated with the snapshot.
instrument_id: InstrumentId
The instrument ID associated with the snapshot.
position_id: PositionId
The position ID associated with the snapshot.
account_id: AccountId
The account ID associated with the position.
opening_order_id: ClientOrderId
The client order ID for the order which opened the position.
closing_order_id: Option<ClientOrderId>
The client order ID for the order which closed the position.
entry: OrderSide
The entry direction from open.
side: PositionSide
The position side.
signed_qty: f64
The position signed quantity (positive for LONG, negative for SHOT).
quantity: Quantity
The position open quantity.
peak_qty: Quantity
The peak directional quantity reached by the position.
quote_currency: Currency
The last fill quantity for the position. The position quote currency.
base_currency: Option<Currency>
The position base currency.
settlement_currency: Currency
The position settlement currency.
avg_px_open: f64
The average open price.
avg_px_close: Option<f64>
The average closing price.
realized_return: Option<f64>
The realized return for the position.
realized_pnl: Money
The realized PnL for the position (including commissions).
unrealized_pnl: Option<Money>
The unrealized PnL for the position (including commissions).
commissions: Vec<Money>
The commissions for the position.
duration_ns: Option<u64>
The open duration for the position (nanoseconds).
ts_opened: UnixNanos
UNIX timestamp (nanoseconds) when the position opened.
ts_closed: Option<UnixNanos>
UNIX timestamp (nanoseconds) when the position closed.
ts_last: UnixNanos
UNIX timestamp (nanoseconds) when the last position event occurred.
ts_init: UnixNanos
UNIX timestamp (nanoseconds) when the snapshot was initialized.
Trait Implementations§
Source§impl Clone for PositionSnapshot
impl Clone for PositionSnapshot
Source§fn clone(&self) -> PositionSnapshot
fn clone(&self) -> PositionSnapshot
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PositionSnapshot
impl Debug for PositionSnapshot
Source§impl<'de> Deserialize<'de> for PositionSnapshot
impl<'de> Deserialize<'de> for PositionSnapshot
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl IntoPy<Py<PyAny>> for PositionSnapshot
impl IntoPy<Py<PyAny>> for PositionSnapshot
Source§impl PartialEq for PositionSnapshot
impl PartialEq for PositionSnapshot
Source§impl PyClass for PositionSnapshot
impl PyClass for PositionSnapshot
Source§impl PyClassImpl for PositionSnapshot
impl PyClassImpl for PositionSnapshot
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§type ThreadChecker = SendablePyClass<PositionSnapshot>
type ThreadChecker = SendablePyClass<PositionSnapshot>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PositionSnapshot
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PositionSnapshot
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut PositionSnapshot
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut PositionSnapshot
Source§impl PyMethods<PositionSnapshot> for PyClassImplCollector<PositionSnapshot>
impl PyMethods<PositionSnapshot> for PyClassImplCollector<PositionSnapshot>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for PositionSnapshot
impl PyTypeInfo for PositionSnapshot
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type or a subclass of this type.§fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type.