#[repr(C)]pub struct PositionAdjusted {
pub trader_id: TraderId,
pub strategy_id: StrategyId,
pub instrument_id: InstrumentId,
pub position_id: PositionId,
pub account_id: AccountId,
pub adjustment_type: PositionAdjustmentType,
pub quantity_change: Option<Decimal>,
pub pnl_change: Option<Money>,
pub reason: Option<Ustr>,
pub event_id: UUID4,
pub ts_event: UnixNanos,
pub ts_init: UnixNanos,
}Expand description
Represents an adjustment to a position’s quantity or realized PnL.
This event is used to track changes to positions that occur outside of normal order fills, such as:
- Commission adjustments that affect the actual quantity held (e.g., crypto spot commissions)
- Funding payments that affect realized PnL (e.g., perpetual futures funding)
Fields§
§trader_id: TraderIdThe trader ID associated with the event.
strategy_id: StrategyIdThe strategy ID associated with the event.
instrument_id: InstrumentIdThe instrument ID associated with the event.
position_id: PositionIdThe position ID associated with the event.
account_id: AccountIdThe account ID associated with the event.
adjustment_type: PositionAdjustmentTypeThe type of adjustment.
quantity_change: Option<Decimal>The quantity change (if applicable). Positive increases quantity, negative decreases.
pnl_change: Option<Money>The PnL change (if applicable). Can be positive or negative.
reason: Option<Ustr>Optional reason or reference for the adjustment (e.g., order ID, funding period).
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 PositionAdjusted
impl PositionAdjusted
Sourcepub fn new(
trader_id: TraderId,
strategy_id: StrategyId,
instrument_id: InstrumentId,
position_id: PositionId,
account_id: AccountId,
adjustment_type: PositionAdjustmentType,
quantity_change: Option<Decimal>,
pnl_change: Option<Money>,
reason: Option<Ustr>,
event_id: UUID4,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> Self
pub fn new( trader_id: TraderId, strategy_id: StrategyId, instrument_id: InstrumentId, position_id: PositionId, account_id: AccountId, adjustment_type: PositionAdjustmentType, quantity_change: Option<Decimal>, pnl_change: Option<Money>, reason: Option<Ustr>, event_id: UUID4, ts_event: UnixNanos, ts_init: UnixNanos, ) -> Self
Creates a new PositionAdjusted instance.
Source§impl PositionAdjusted
impl PositionAdjusted
Sourcepub fn py_to_dict(&self, py: Python<'_>) -> PyResult<Py<PyAny>>
pub fn py_to_dict(&self, py: Python<'_>) -> PyResult<Py<PyAny>>
Converts this PositionAdjusted into a Python dict.
§Errors
Returns a PyErr if serialization into a Python dict fails.
Trait Implementations§
Source§impl Clone for PositionAdjusted
impl Clone for PositionAdjusted
Source§fn clone(&self) -> PositionAdjusted
fn clone(&self) -> PositionAdjusted
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PositionAdjusted
impl Debug for PositionAdjusted
Source§impl<'de> Deserialize<'de> for PositionAdjusted
impl<'de> Deserialize<'de> for PositionAdjusted
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<'py> IntoPyObject<'py> for PositionAdjusted
impl<'py> IntoPyObject<'py> for PositionAdjusted
Source§type Target = PositionAdjusted
type Target = PositionAdjusted
Source§type Output = Bound<'py, <PositionAdjusted as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <PositionAdjusted 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 PositionAdjusted
impl PartialEq for PositionAdjusted
Source§impl PyClass for PositionAdjusted
impl PyClass for PositionAdjusted
Source§impl PyClassImpl for PositionAdjusted
impl PyClassImpl for PositionAdjusted
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 adjustment to a position's quantity or realized PnL.
///
/// This event is used to track changes to positions that occur outside of normal
/// order fills, such as:
/// - Commission adjustments that affect the actual quantity held (e.g., crypto spot commissions)
/// - Funding payments that affect realized PnL (e.g., perpetual futures funding)
const RAW_DOC: &'static CStr = /// Represents an adjustment to a position's quantity or realized PnL. /// /// This event is used to track changes to positions that occur outside of normal /// order fills, such as: /// - Commission adjustments that affect the actual quantity held (e.g., crypto spot commissions) /// - Funding payments that affect realized PnL (e.g., perpetual futures funding)
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type ThreadChecker = SendablePyClass<PositionAdjusted>
type ThreadChecker = SendablePyClass<PositionAdjusted>
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 PositionAdjusted
impl PyClassNewTextSignature for PositionAdjusted
const TEXT_SIGNATURE: &'static str = "(trader_id, strategy_id, instrument_id, position_id, account_id, adjustment_type, quantity_change, pnl_change, reason, event_id, ts_event, ts_init)"
Source§impl PyMethods<PositionAdjusted> for PyClassImplCollector<PositionAdjusted>
impl PyMethods<PositionAdjusted> for PyClassImplCollector<PositionAdjusted>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for PositionAdjusted
impl PyTypeInfo for PositionAdjusted
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 PositionAdjusted
impl Serialize for PositionAdjusted
impl Copy for PositionAdjusted
impl DerefToPyAny for PositionAdjusted
impl ExtractPyClassWithClone for PositionAdjusted
impl StructuralPartialEq for PositionAdjusted
Auto Trait Implementations§
impl Freeze for PositionAdjusted
impl RefUnwindSafe for PositionAdjusted
impl Send for PositionAdjusted
impl Sync for PositionAdjusted
impl Unpin for PositionAdjusted
impl UnwindSafe for PositionAdjusted
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> 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 moreSource§impl<'py, T> IntoPyObjectNautilusExt<'py> for Twhere
T: IntoPyObjectExt<'py>,
impl<'py, T> IntoPyObjectNautilusExt<'py> for Twhere
T: IntoPyObjectExt<'py>,
Source§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,
§const NAME: &'static str = T::NAME
const NAME: &'static str = T::NAME
§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