pub struct StopLimitOrder {
pub price: Price,
pub trigger_price: Price,
pub trigger_type: TriggerType,
pub expire_time: Option<UnixNanos>,
pub is_post_only: bool,
pub display_qty: Option<Quantity>,
pub trigger_instrument_id: Option<InstrumentId>,
pub is_triggered: bool,
pub ts_triggered: Option<UnixNanos>,
/* private fields */
}Fields§
§price: Price§trigger_price: Price§trigger_type: TriggerType§expire_time: Option<UnixNanos>§is_post_only: bool§display_qty: Option<Quantity>§trigger_instrument_id: Option<InstrumentId>§is_triggered: bool§ts_triggered: Option<UnixNanos>Implementations§
Source§impl StopLimitOrder
impl StopLimitOrder
Sourcepub fn new_checked(
trader_id: TraderId,
strategy_id: StrategyId,
instrument_id: InstrumentId,
client_order_id: ClientOrderId,
order_side: OrderSide,
quantity: Quantity,
price: Price,
trigger_price: Price,
trigger_type: TriggerType,
time_in_force: TimeInForce,
expire_time: Option<UnixNanos>,
post_only: bool,
reduce_only: bool,
quote_quantity: bool,
display_qty: Option<Quantity>,
emulation_trigger: Option<TriggerType>,
trigger_instrument_id: Option<InstrumentId>,
contingency_type: Option<ContingencyType>,
order_list_id: Option<OrderListId>,
linked_order_ids: Option<Vec<ClientOrderId>>,
parent_order_id: Option<ClientOrderId>,
exec_algorithm_id: Option<ExecAlgorithmId>,
exec_algorithm_params: Option<IndexMap<Ustr, Ustr>>,
exec_spawn_id: Option<ClientOrderId>,
tags: Option<Vec<Ustr>>,
init_id: UUID4,
ts_init: UnixNanos,
) -> Result<Self, OrderError>
pub fn new_checked( trader_id: TraderId, strategy_id: StrategyId, instrument_id: InstrumentId, client_order_id: ClientOrderId, order_side: OrderSide, quantity: Quantity, price: Price, trigger_price: Price, trigger_type: TriggerType, time_in_force: TimeInForce, expire_time: Option<UnixNanos>, post_only: bool, reduce_only: bool, quote_quantity: bool, display_qty: Option<Quantity>, emulation_trigger: Option<TriggerType>, trigger_instrument_id: Option<InstrumentId>, contingency_type: Option<ContingencyType>, order_list_id: Option<OrderListId>, linked_order_ids: Option<Vec<ClientOrderId>>, parent_order_id: Option<ClientOrderId>, exec_algorithm_id: Option<ExecAlgorithmId>, exec_algorithm_params: Option<IndexMap<Ustr, Ustr>>, exec_spawn_id: Option<ClientOrderId>, tags: Option<Vec<Ustr>>, init_id: UUID4, ts_init: UnixNanos, ) -> Result<Self, OrderError>
Creates a new StopLimitOrder instance.
§Errors
Returns an error if:
- The
quantityis not positive. - The
display_qty(when provided) exceedsquantity. - The
time_in_forceisGTDandexpire_timeisNoneor zero. - The order metadata violates an
OrderInitialized::new_checkedinvariant.
Sourcepub fn new(
trader_id: TraderId,
strategy_id: StrategyId,
instrument_id: InstrumentId,
client_order_id: ClientOrderId,
order_side: OrderSide,
quantity: Quantity,
price: Price,
trigger_price: Price,
trigger_type: TriggerType,
time_in_force: TimeInForce,
expire_time: Option<UnixNanos>,
post_only: bool,
reduce_only: bool,
quote_quantity: bool,
display_qty: Option<Quantity>,
emulation_trigger: Option<TriggerType>,
trigger_instrument_id: Option<InstrumentId>,
contingency_type: Option<ContingencyType>,
order_list_id: Option<OrderListId>,
linked_order_ids: Option<Vec<ClientOrderId>>,
parent_order_id: Option<ClientOrderId>,
exec_algorithm_id: Option<ExecAlgorithmId>,
exec_algorithm_params: Option<IndexMap<Ustr, Ustr>>,
exec_spawn_id: Option<ClientOrderId>,
tags: Option<Vec<Ustr>>,
init_id: UUID4,
ts_init: UnixNanos,
) -> Self
pub fn new( trader_id: TraderId, strategy_id: StrategyId, instrument_id: InstrumentId, client_order_id: ClientOrderId, order_side: OrderSide, quantity: Quantity, price: Price, trigger_price: Price, trigger_type: TriggerType, time_in_force: TimeInForce, expire_time: Option<UnixNanos>, post_only: bool, reduce_only: bool, quote_quantity: bool, display_qty: Option<Quantity>, emulation_trigger: Option<TriggerType>, trigger_instrument_id: Option<InstrumentId>, contingency_type: Option<ContingencyType>, order_list_id: Option<OrderListId>, linked_order_ids: Option<Vec<ClientOrderId>>, parent_order_id: Option<ClientOrderId>, exec_algorithm_id: Option<ExecAlgorithmId>, exec_algorithm_params: Option<IndexMap<Ustr, Ustr>>, exec_spawn_id: Option<ClientOrderId>, tags: Option<Vec<Ustr>>, init_id: UUID4, ts_init: UnixNanos, ) -> Self
Creates a new StopLimitOrder instance.
§Panics
Panics if any order validation fails (see StopLimitOrder::new_checked).
Methods from Deref<Target = OrderCore>§
Sourcepub fn apply(&mut self, event: OrderEventAny) -> Result<(), OrderError>
pub fn apply(&mut self, event: OrderEventAny) -> Result<(), OrderError>
Applies the event to the order.
§Errors
Returns an error if the event is invalid for the current order status, or if
event.client_order_id() or event.strategy_id() does not match the order.
pub fn set_slippage(&mut self, price: Price)
pub fn signed_decimal_qty(&self) -> Decimal
pub fn would_reduce_only( &self, side: PositionSide, position_qty: Quantity, ) -> bool
pub fn commission(&self, currency: &Currency) -> Option<Money>
pub fn commissions(&self) -> IndexMap<Currency, Money>
pub fn commissions_vec(&self) -> Vec<Money>
Sourcepub fn events(&self) -> &[OrderEventAny]
pub fn events(&self) -> &[OrderEventAny]
Returns the order events in application order.
Sourcepub fn prepend_events(
&mut self,
events: impl IntoIterator<Item = OrderEventAny>,
)
pub fn prepend_events( &mut self, events: impl IntoIterator<Item = OrderEventAny>, )
Prepends historical events in iterator order without applying their state transitions.
Used when transforming an order into another type. The next fill rebuilds the average-price fold from the combined history; other derived state is unchanged.
pub fn init_event(&self) -> Option<OrderEventAny>
Trait Implementations§
Source§impl Clone for StopLimitOrder
impl Clone for StopLimitOrder
Source§impl Debug for StopLimitOrder
impl Debug for StopLimitOrder
Source§impl Deref for StopLimitOrder
impl Deref for StopLimitOrder
Source§impl DerefMut for StopLimitOrder
impl DerefMut for StopLimitOrder
impl DerefToPyAny for StopLimitOrder
Source§impl<'de> Deserialize<'de> for StopLimitOrder
impl<'de> Deserialize<'de> for StopLimitOrder
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 StopLimitOrder
impl Display for StopLimitOrder
Source§impl From<StopLimitOrder> for OrderAny
impl From<StopLimitOrder> for OrderAny
Source§fn from(v: StopLimitOrder) -> OrderAny
fn from(v: StopLimitOrder) -> OrderAny
Source§impl From<StopLimitOrder> for LimitOrderAny
impl From<StopLimitOrder> for LimitOrderAny
Source§fn from(v: StopLimitOrder) -> LimitOrderAny
fn from(v: StopLimitOrder) -> LimitOrderAny
Source§impl From<StopLimitOrder> for StopOrderAny
impl From<StopLimitOrder> for StopOrderAny
Source§fn from(v: StopLimitOrder) -> StopOrderAny
fn from(v: StopLimitOrder) -> StopOrderAny
Source§impl<'a, 'py> FromPyObject<'a, 'py> for StopLimitOrderwhere
Self: Clone,
impl<'a, 'py> FromPyObject<'a, 'py> for StopLimitOrderwhere
Self: Clone,
Source§impl<'py> IntoPyObject<'py> for StopLimitOrder
impl<'py> IntoPyObject<'py> for StopLimitOrder
Source§type Target = StopLimitOrder
type Target = StopLimitOrder
Source§type Output = Bound<'py, <StopLimitOrder as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <StopLimitOrder 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 Order for StopLimitOrder
impl Order for StopLimitOrder
fn into_any(self) -> OrderAny
fn status(&self) -> OrderStatus
fn trader_id(&self) -> TraderId
fn strategy_id(&self) -> StrategyId
fn instrument_id(&self) -> InstrumentId
fn symbol(&self) -> Symbol
fn venue(&self) -> Venue
fn client_order_id(&self) -> ClientOrderId
fn venue_order_id(&self) -> Option<VenueOrderId>
fn position_id(&self) -> Option<PositionId>
fn account_id(&self) -> Option<AccountId>
fn last_trade_id(&self) -> Option<TradeId>
fn order_side(&self) -> OrderSide
fn order_type(&self) -> OrderType
fn quantity(&self) -> Quantity
fn time_in_force(&self) -> TimeInForce
fn expire_time(&self) -> Option<UnixNanos>
fn price(&self) -> Option<Price>
fn trigger_price(&self) -> Option<Price>
fn trigger_type(&self) -> Option<TriggerType>
fn liquidity_side(&self) -> Option<LiquiditySide>
fn is_post_only(&self) -> bool
fn is_reduce_only(&self) -> bool
fn is_quote_quantity(&self) -> bool
fn has_price(&self) -> bool
fn display_qty(&self) -> Option<Quantity>
fn limit_offset(&self) -> Option<Decimal>
fn trailing_offset(&self) -> Option<Decimal>
fn trailing_offset_type(&self) -> Option<TrailingOffsetType>
fn emulation_trigger(&self) -> Option<TriggerType>
fn trigger_instrument_id(&self) -> Option<InstrumentId>
fn contingency_type(&self) -> Option<ContingencyType>
fn order_list_id(&self) -> Option<OrderListId>
fn linked_order_ids(&self) -> Option<&[ClientOrderId]>
fn parent_order_id(&self) -> Option<ClientOrderId>
fn exec_algorithm_id(&self) -> Option<ExecAlgorithmId>
fn exec_algorithm_params(&self) -> Option<&IndexMap<Ustr, Ustr>>
fn exec_spawn_id(&self) -> Option<ClientOrderId>
fn filled_qty(&self) -> Quantity
fn voided_qty(&self) -> Quantity
fn leaves_qty(&self) -> Quantity
fn overfill_qty(&self) -> Quantity
fn avg_px(&self) -> Option<Decimal>
fn slippage(&self) -> Option<Decimal>
fn init_id(&self) -> UUID4
fn ts_init(&self) -> UnixNanos
fn ts_submitted(&self) -> Option<UnixNanos>
fn ts_accepted(&self) -> Option<UnixNanos>
fn ts_closed(&self) -> Option<UnixNanos>
fn ts_last(&self) -> UnixNanos
fn events(&self) -> Vec<&OrderEventAny>
fn venue_order_ids(&self) -> Vec<&VenueOrderId>
fn commissions(&self) -> &IndexMap<Currency, Money>
fn trade_ids(&self) -> Vec<&TradeId>
Source§fn apply(&mut self, event: OrderEventAny) -> Result<(), OrderError>
fn apply(&mut self, event: OrderEventAny) -> Result<(), OrderError>
event to the order. Read morefn update(&mut self, event: &OrderUpdated)
fn is_triggered(&self) -> Option<bool>
fn set_position_id(&mut self, position_id: Option<PositionId>)
fn set_quantity(&mut self, quantity: Quantity)
fn set_leaves_qty(&mut self, leaves_qty: Quantity)
fn set_emulation_trigger(&mut self, emulation_trigger: Option<TriggerType>)
fn set_is_quote_quantity(&mut self, is_quote_quantity: bool)
fn set_liquidity_side(&mut self, liquidity_side: LiquiditySide)
fn would_reduce_only(&self, side: PositionSide, position_qty: Quantity) -> bool
fn previous_status(&self) -> Option<OrderStatus>
fn activation_price(&self) -> Option<Price>
Source§fn calculate_overfill(&self, fill_qty: Quantity) -> Quantity
fn calculate_overfill(&self, fill_qty: Quantity) -> Quantity
fn last_event(&self) -> &OrderEventAny
fn event_count(&self) -> usize
Source§fn is_duplicate_fill(&self, fill: &OrderFilled) -> bool
fn is_duplicate_fill(&self, fill: &OrderFilled) -> bool
true if a fill with matching trade_id, side, qty, and price already exists.fn is_buy(&self) -> bool
fn is_sell(&self) -> bool
fn is_passive(&self) -> bool
fn is_aggressive(&self) -> bool
fn is_emulated(&self) -> bool
fn is_active_local(&self) -> bool
fn is_primary(&self) -> bool
fn is_spawned(&self) -> bool
fn is_contingency(&self) -> bool
fn is_parent_order(&self) -> bool
fn is_child_order(&self) -> bool
fn is_open(&self) -> bool
fn is_canceled(&self) -> bool
fn is_closed(&self) -> bool
fn is_inflight(&self) -> bool
fn is_pending_update(&self) -> bool
fn is_pending_cancel(&self) -> bool
fn to_own_book_order(&self) -> OwnBookOrder
Source§fn to_order_status_report(
&self,
report_id: Option<UUID4>,
) -> Option<OrderStatusReport>
fn to_order_status_report( &self, report_id: Option<UUID4>, ) -> Option<OrderStatusReport>
OrderStatusReport snapshot from the order’s current state. Read moreSource§impl PartialEq for StopLimitOrder
impl PartialEq for StopLimitOrder
Source§impl PyClass for StopLimitOrder
impl PyClass for StopLimitOrder
Source§impl PyClassImpl for StopLimitOrder
impl PyClassImpl for StopLimitOrder
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 = c"\x00"
const RAW_DOC: &'static CStr = c"\x00"
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type Layout = <<StopLimitOrder as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<StopLimitOrder>
type Layout = <<StopLimitOrder as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<StopLimitOrder>
Source§type ThreadChecker = NoopThreadChecker
type ThreadChecker = NoopThreadChecker
type Inventory = Pyo3MethodsInventoryForStopLimitOrder
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 StopLimitOrder
impl PyClassNewTextSignature for StopLimitOrder
const TEXT_SIGNATURE: &'static str = "(trader_id, strategy_id, instrument_id, client_order_id, order_side, quantity, price, trigger_price, trigger_type, time_in_force, post_only, reduce_only, quote_quantity, init_id, ts_init, expire_time=None, display_qty=None, emulation_trigger=None, trigger_instrument_id=None, contingency_type=None, order_list_id=None, linked_order_ids=None, parent_order_id=None, exec_algorithm_id=None, exec_algorithm_params=None, exec_spawn_id=None, tags=None)"
Source§impl PyStubType for StopLimitOrder
impl PyStubType for StopLimitOrder
Source§fn type_output() -> TypeInfo
fn type_output() -> TypeInfo
§fn type_input() -> TypeInfo
fn type_input() -> TypeInfo
Source§impl PyTypeInfo for StopLimitOrder
impl PyTypeInfo for StopLimitOrder
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.Source§impl Serialize for StopLimitOrder
impl Serialize for StopLimitOrder
Source§impl TestDefault for StopLimitOrder
impl TestDefault for StopLimitOrder
Source§fn test_default() -> Self
fn test_default() -> Self
Creates a new test default StopLimitOrder instance.
Source§impl TryFrom<OrderInitialized> for StopLimitOrder
impl TryFrom<OrderInitialized> for StopLimitOrder
Source§type Error = OrderError
type Error = OrderError
Source§impl TryInto<StopLimitOrder> for OrderAny
impl TryInto<StopLimitOrder> for OrderAny
Source§impl TryInto<StopLimitOrder> for LimitOrderAny
impl TryInto<StopLimitOrder> for LimitOrderAny
Source§impl TryInto<StopLimitOrder> for StopOrderAny
impl TryInto<StopLimitOrder> for StopOrderAny
Auto Trait Implementations§
impl Freeze for StopLimitOrder
impl RefUnwindSafe for StopLimitOrder
impl Send for StopLimitOrder
impl Sync for StopLimitOrder
impl Unpin for StopLimitOrder
impl UnsafeUnpin for StopLimitOrder
impl UnwindSafe for StopLimitOrder
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>where
Self: IntoPyObject<'py, Error = !>,
fn into_py_any_unwrap(self, py: Python<'py>) -> Py<PyAny>where
Self: IntoPyObject<'py, Error = !>,
self into a [Py<PyAny>] when the underlying conversion is infallible.§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