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: Option<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_init: UnixNanos,
pub ts_last: 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 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: Option<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_init: UnixNanos
UNIX timestamp (nanoseconds) when the snapshot was initialized.
ts_last: UnixNanos
UNIX timestamp (nanoseconds) when the last position event occurred.
Implementations§
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<'py> IntoPyObject<'py> for PositionSnapshot
impl<'py> IntoPyObject<'py> for PositionSnapshot
Source§type Target = PositionSnapshot
type Target = PositionSnapshot
Source§type Output = Bound<'py, <PositionSnapshot as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <PositionSnapshot as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
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(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
PyTypeInfo::type_object
PyTypeInfo::type_object
].§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type or a subclass of this type.§fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
PyTypeInfo::is_type_of
PyTypeInfo::is_type_of
].§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type.§fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
PyTypeInfo::is_exact_type_of
PyTypeInfo::is_exact_type_of
].Source§impl Serialize for PositionSnapshot
impl Serialize for PositionSnapshot
impl DerefToPyAny for PositionSnapshot
impl HasCustomRichCmp for PositionSnapshot
impl StructuralPartialEq for PositionSnapshot
Auto Trait Implementations§
impl Freeze for PositionSnapshot
impl RefUnwindSafe for PositionSnapshot
impl Send for PositionSnapshot
impl Sync for PositionSnapshot
impl Unpin for PositionSnapshot
impl UnwindSafe for PositionSnapshot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FromPyObject<'_> for Twhere
T: PyClass + Clone,
impl<T> FromPyObject<'_> for Twhere
T: PyClass + Clone,
§fn extract_bound(obj: &Bound<'_, PyAny>) -> Result<T, PyErr>
fn extract_bound(obj: &Bound<'_, PyAny>) -> Result<T, PyErr>
§impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
§fn from_py_object_bound(ob: Borrowed<'_, 'py, PyAny>) -> Result<T, PyErr>
fn from_py_object_bound(ob: Borrowed<'_, 'py, PyAny>) -> Result<T, PyErr>
§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self
into an owned Python object, dropping type information.§fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
self
into an owned Python object, dropping type information and unbinding it
from the 'py
lifetime.§fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
self
into a Python object. Read more