#[repr(C)]pub struct PortfolioSnapshot {
pub account_id: AccountId,
pub account_type: AccountType,
pub base_currency: Option<Currency>,
pub balances: Vec<AccountBalance>,
pub margins: Vec<MarginBalance>,
pub unrealized_pnls: Vec<Money>,
pub realized_pnls: Vec<Money>,
pub total_equity: Vec<Money>,
pub event_id: UUID4,
pub ts_event: UnixNanos,
pub ts_init: UnixNanos,
}Expand description
Represents a point-in-time snapshot of portfolio state for a single account, emitted periodically while the account holds open positions.
Unlike AccountState, which fires only on
balance or margin changes, PortfolioSnapshot carries a continuous
mark-to-market view by folding open-position valuations into the totals.
Totals span every venue the account holds positions on, so multi-venue
accounts (e.g., a prime broker routing across exchanges) produce a single
account-wide snapshot rather than per-venue slices.
Fields§
§account_id: AccountIdThe account ID this snapshot belongs to.
account_type: AccountTypeThe type of the account (e.g., cash, margin).
base_currency: Option<Currency>The base currency for the account, if applicable.
balances: Vec<AccountBalance>The per-currency account balances at snapshot time.
margins: Vec<MarginBalance>The per-instrument margin balances at snapshot time (margin accounts only).
unrealized_pnls: Vec<Money>The per-currency unrealized PnL across all open positions at snapshot time.
realized_pnls: Vec<Money>The per-currency realized PnL accumulated for positions opened in this session.
total_equity: Vec<Money>The per-currency total equity (mark-to-market).
For cash accounts: balance.total + Σ mark_value(open positions) in the same currency.
For margin accounts: balance.total + Σ unrealized_pnl(open positions) in the same currency.
event_id: UUID4The unique identifier for the event.
ts_event: UnixNanosUNIX timestamp (nanoseconds) when the event occurred.
ts_init: UnixNanosUNIX timestamp (nanoseconds) when the event was initialized.
Implementations§
Source§impl PortfolioSnapshot
impl PortfolioSnapshot
Sourcepub fn new(
account_id: AccountId,
account_type: AccountType,
base_currency: Option<Currency>,
balances: Vec<AccountBalance>,
margins: Vec<MarginBalance>,
unrealized_pnls: Vec<Money>,
realized_pnls: Vec<Money>,
total_equity: Vec<Money>,
event_id: UUID4,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> Self
pub fn new( account_id: AccountId, account_type: AccountType, base_currency: Option<Currency>, balances: Vec<AccountBalance>, margins: Vec<MarginBalance>, unrealized_pnls: Vec<Money>, realized_pnls: Vec<Money>, total_equity: Vec<Money>, event_id: UUID4, ts_event: UnixNanos, ts_init: UnixNanos, ) -> Self
Creates a new PortfolioSnapshot instance.
Trait Implementations§
Source§impl CatalogPathPrefix for PortfolioSnapshot
impl CatalogPathPrefix for PortfolioSnapshot
Source§fn path_prefix() -> &'static str
fn path_prefix() -> &'static str
Source§impl Clone for PortfolioSnapshot
impl Clone for PortfolioSnapshot
Source§fn clone(&self) -> PortfolioSnapshot
fn clone(&self) -> PortfolioSnapshot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PortfolioSnapshot
impl Debug for PortfolioSnapshot
impl DerefToPyAny for PortfolioSnapshot
Source§impl<'de> Deserialize<'de> for PortfolioSnapshot
impl<'de> Deserialize<'de> for PortfolioSnapshot
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 Display for PortfolioSnapshot
impl Display for PortfolioSnapshot
Source§impl<'a, 'py> FromPyObject<'a, 'py> for PortfolioSnapshotwhere
Self: Clone,
impl<'a, 'py> FromPyObject<'a, 'py> for PortfolioSnapshotwhere
Self: Clone,
Source§impl HasTsInit for PortfolioSnapshot
impl HasTsInit for PortfolioSnapshot
Source§impl<'py> IntoPyObject<'py> for PortfolioSnapshot
impl<'py> IntoPyObject<'py> for PortfolioSnapshot
Source§type Target = PortfolioSnapshot
type Target = PortfolioSnapshot
Source§type Output = Bound<'py, <PortfolioSnapshot as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <PortfolioSnapshot 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 PortfolioSnapshot
impl PartialEq for PortfolioSnapshot
Source§impl PyClass for PortfolioSnapshot
impl PyClass for PortfolioSnapshot
Source§impl PyClassImpl for PortfolioSnapshot
impl PyClassImpl for PortfolioSnapshot
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§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = /// Represents a point-in-time snapshot of portfolio state for a single account,
/// emitted periodically while the account holds open positions.
///
/// Unlike [`AccountState`](crate::events::AccountState), which fires only on
/// balance or margin changes, `PortfolioSnapshot` carries a continuous
/// mark-to-market view by folding open-position valuations into the totals.
/// Totals span every venue the account holds positions on, so multi-venue
/// accounts (e.g., a prime broker routing across exchanges) produce a single
/// account-wide snapshot rather than per-venue slices.
const RAW_DOC: &'static CStr = /// Represents a point-in-time snapshot of portfolio state for a single account, /// emitted periodically while the account holds open positions. /// /// Unlike [`AccountState`](crate::events::AccountState), which fires only on /// balance or margin changes, `PortfolioSnapshot` carries a continuous /// mark-to-market view by folding open-position valuations into the totals. /// Totals span every venue the account holds positions on, so multi-venue /// accounts (e.g., a prime broker routing across exchanges) produce a single /// account-wide snapshot rather than per-venue slices.
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type Layout = <<PortfolioSnapshot as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<PortfolioSnapshot>
type Layout = <<PortfolioSnapshot as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<PortfolioSnapshot>
Source§type ThreadChecker = NoopThreadChecker
type ThreadChecker = NoopThreadChecker
type Inventory = Pyo3MethodsInventoryForPortfolioSnapshot
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<PyObjectOffset>
fn dict_offset() -> Option<PyObjectOffset>
§fn weaklist_offset() -> Option<PyObjectOffset>
fn weaklist_offset() -> Option<PyObjectOffset>
Source§impl PyClassNewTextSignature for PortfolioSnapshot
impl PyClassNewTextSignature for PortfolioSnapshot
const TEXT_SIGNATURE: &'static str = "(account_id, account_type, balances, margins, unrealized_pnls, realized_pnls, total_equity, event_id, ts_event, ts_init, base_currency=None)"
Source§impl PyStubType for PortfolioSnapshot
impl PyStubType for PortfolioSnapshot
Source§fn type_output() -> TypeInfo
fn type_output() -> TypeInfo
§fn type_input() -> TypeInfo
fn type_input() -> TypeInfo
Source§impl PyTypeInfo for PortfolioSnapshot
impl PyTypeInfo for PortfolioSnapshot
Source§const NAME: &str = <Self as ::pyo3::PyClass>::NAME
const NAME: &str = <Self as ::pyo3::PyClass>::NAME
prefer using ::type_object(py).name() to get the correct runtime value
Source§const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
prefer using ::type_object(py).module() to get the correct runtime value
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 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_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type.Auto Trait Implementations§
impl Freeze for PortfolioSnapshot
impl RefUnwindSafe for PortfolioSnapshot
impl Send for PortfolioSnapshot
impl Sync for PortfolioSnapshot
impl Unpin for PortfolioSnapshot
impl UnsafeUnpin for PortfolioSnapshot
impl UnwindSafe for PortfolioSnapshot
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<'py, T> FromPyObjectOwned<'py> for Twhere
T: for<'a> FromPyObject<'a, 'py>,
§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§impl<'py, T> IntoPyObjectNautilusExt<'py> for Twhere
T: IntoPyObjectExt<'py>,
impl<'py, T> IntoPyObjectNautilusExt<'py> for Twhere
T: IntoPyObjectExt<'py>,
§fn into_py_any_unwrap(self, py: Python<'py>) -> Py<PyAny>
fn into_py_any_unwrap(self, py: Python<'py>) -> Py<PyAny>
§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
§fn type_check(object: &Bound<'_, PyAny>) -> bool
fn type_check(object: &Bound<'_, PyAny>) -> bool
§fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
isinstance and issubclass function. Read more