#[repr(C)]pub struct AccountState {
pub account_id: AccountId,
pub account_type: AccountType,
pub base_currency: Option<Currency>,
pub balances: Vec<AccountBalance>,
pub margins: Vec<MarginBalance>,
pub is_reported: bool,
pub event_id: UUID4,
pub ts_event: UnixNanos,
pub ts_init: UnixNanos,
}Expand description
Represents an event which includes information on the state of the account.
Fields§
§account_id: AccountIdThe account ID associated with the event.
account_type: AccountTypeThe type of the account (e.g., margin, spot, etc.).
base_currency: Option<Currency>The base currency for the account, if applicable.
balances: Vec<AccountBalance>The balances in the account.
margins: Vec<MarginBalance>The margin balances in the account.
is_reported: boolIndicates if the account state is reported by the exchange (as opposed to system-calculated).
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 AccountState
impl AccountState
Sourcepub fn new(
account_id: AccountId,
account_type: AccountType,
balances: Vec<AccountBalance>,
margins: Vec<MarginBalance>,
is_reported: bool,
event_id: UUID4,
ts_event: UnixNanos,
ts_init: UnixNanos,
base_currency: Option<Currency>,
) -> Self
pub fn new( account_id: AccountId, account_type: AccountType, balances: Vec<AccountBalance>, margins: Vec<MarginBalance>, is_reported: bool, event_id: UUID4, ts_event: UnixNanos, ts_init: UnixNanos, base_currency: Option<Currency>, ) -> Self
Creates a new AccountState instance.
Sourcepub fn has_same_balances_and_margins(&self, other: &Self) -> bool
pub fn has_same_balances_and_margins(&self, other: &Self) -> bool
Returns true if this account state has the same balances and margins as another.
This compares all balances and margins for equality, returning true only if
all balances and margins are equal. If any balance or margin is different or
missing, returns false.
§Note
This method does not compare event IDs, timestamps, or other metadata - only the actual balance and margin values.
Source§impl AccountState
impl AccountState
Sourcepub fn py_from_dict(values: &Bound<'_, PyDict>) -> PyResult<Self>
pub fn py_from_dict(values: &Bound<'_, PyDict>) -> PyResult<Self>
Constructs an AccountState from a Python dict.
§Errors
Returns a PyErr if any required field is missing or type conversion fails.
§Panics
Panics if any unwrap on parsed values fails (e.g., invalid formats or missing items).
Sourcepub fn py_to_dict(&self, py: Python<'_>) -> PyResult<Py<PyAny>>
pub fn py_to_dict(&self, py: Python<'_>) -> PyResult<Py<PyAny>>
Converts this AccountState into a Python dict.
§Errors
Returns a PyErr if serialization into a Python dict fails.
Trait Implementations§
Source§impl Clone for AccountState
impl Clone for AccountState
Source§fn clone(&self) -> AccountState
fn clone(&self) -> AccountState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AccountState
impl Debug for AccountState
Source§impl<'de> Deserialize<'de> for AccountState
impl<'de> Deserialize<'de> for AccountState
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 AccountState
impl Display for AccountState
Source§impl From<AccountState> for AccountAny
impl From<AccountState> for AccountAny
Source§fn from(event: AccountState) -> Self
fn from(event: AccountState) -> Self
Source§impl<'py> IntoPyObject<'py> for AccountState
impl<'py> IntoPyObject<'py> for AccountState
Source§type Target = AccountState
type Target = AccountState
Source§type Output = Bound<'py, <AccountState as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <AccountState 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 AccountState
impl PartialEq for AccountState
Source§impl PyClass for AccountState
impl PyClass for AccountState
Source§impl PyClassImpl for AccountState
impl PyClassImpl for AccountState
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 an event which includes information on the state of the account.
const RAW_DOC: &'static CStr = /// Represents an event which includes information on the state of the account.
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type ThreadChecker = SendablePyClass<AccountState>
type ThreadChecker = SendablePyClass<AccountState>
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 PyClassNewTextSignature for AccountState
impl PyClassNewTextSignature for AccountState
const TEXT_SIGNATURE: &'static str = "(account_id, account_type, balances, margins, is_reported, event_id, ts_event, ts_init, base_currency=None)"
Source§impl<'a, 'holder, 'py> PyFunctionArgument<'a, 'holder, 'py, false> for &'holder AccountState
impl<'a, 'holder, 'py> PyFunctionArgument<'a, 'holder, 'py, false> for &'holder AccountState
Source§impl<'a, 'holder, 'py> PyFunctionArgument<'a, 'holder, 'py, false> for &'holder mut AccountState
impl<'a, 'holder, 'py> PyFunctionArgument<'a, 'holder, 'py, false> for &'holder mut AccountState
Source§impl PyMethods<AccountState> for PyClassImplCollector<AccountState>
impl PyMethods<AccountState> for PyClassImplCollector<AccountState>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for AccountState
impl PyTypeInfo for AccountState
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.Source§impl Serialize for AccountState
impl Serialize for AccountState
impl DerefToPyAny for AccountState
Auto Trait Implementations§
impl Freeze for AccountState
impl RefUnwindSafe for AccountState
impl Send for AccountState
impl Sync for AccountState
impl Unpin for AccountState
impl UnwindSafe for AccountState
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§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,
Source§impl<T> Separable for Twhere
T: Display,
impl<T> Separable for Twhere
T: Display,
Source§fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
SeparatorPolicy. Read more