nautilus_model::orders::stop_market

Struct StopMarketOrder

Source
pub struct StopMarketOrder {
    pub trigger_price: Price,
    pub trigger_type: TriggerType,
    pub expire_time: Option<UnixNanos>,
    pub display_qty: Option<Quantity>,
    pub trigger_instrument_id: Option<InstrumentId>,
    pub is_triggered: bool,
    pub ts_triggered: Option<UnixNanos>,
    /* private fields */
}

Fields§

§trigger_price: Price§trigger_type: TriggerType§expire_time: Option<UnixNanos>§display_qty: Option<Quantity>§trigger_instrument_id: Option<InstrumentId>§is_triggered: bool§ts_triggered: Option<UnixNanos>

Implementations§

Source§

impl StopMarketOrder

Source

pub fn new( trader_id: TraderId, strategy_id: StrategyId, instrument_id: InstrumentId, client_order_id: ClientOrderId, order_side: OrderSide, quantity: Quantity, trigger_price: Price, trigger_type: TriggerType, time_in_force: TimeInForce, expire_time: Option<UnixNanos>, 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<HashMap<Ustr, Ustr>>, exec_spawn_id: Option<ClientOrderId>, tags: Option<Vec<Ustr>>, init_id: UUID4, ts_init: UnixNanos, ) -> Self

Creates a new StopMarketOrder instance.

Methods from Deref<Target = OrderCore>§

Source

pub fn apply(&mut self, event: OrderEventAny) -> Result<(), OrderError>

Source

pub fn set_slippage(&mut self, price: Price)

Source

pub fn signed_decimal_qty(&self) -> Decimal

Source

pub fn would_reduce_only( &self, side: PositionSide, position_qty: Quantity, ) -> bool

Source

pub fn commission(&self, currency: &Currency) -> Option<Money>

Source

pub fn commissions(&self) -> HashMap<Currency, Money>

Source

pub fn init_event(&self) -> Option<OrderEventAny>

Trait Implementations§

Source§

impl AsRef<StopMarketOrder> for OrderAny

Source§

fn as_ref(&self) -> &StopMarketOrder

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for StopMarketOrder

Source§

fn clone(&self) -> StopMarketOrder

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StopMarketOrder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StopMarketOrder

Source§

fn default() -> Self

Creates a new default StopMarketOrder instance for testing.

Source§

impl Deref for StopMarketOrder

Source§

type Target = OrderCore

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for StopMarketOrder

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<'de> Deserialize<'de> for StopMarketOrder

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<OrderInitialized> for StopMarketOrder

Source§

fn from(event: OrderInitialized) -> Self

Converts to this type from the input type.
Source§

impl IntoPy<Py<PyAny>> for StopMarketOrder

Source§

fn into_py(self, py: Python<'_>) -> PyObject

Performs the conversion.
Source§

impl Order for StopMarketOrder

Source§

fn into_any(self) -> OrderAny

Source§

fn status(&self) -> OrderStatus

Source§

fn trader_id(&self) -> TraderId

Source§

fn strategy_id(&self) -> StrategyId

Source§

fn instrument_id(&self) -> InstrumentId

Source§

fn symbol(&self) -> Symbol

Source§

fn venue(&self) -> Venue

Source§

fn client_order_id(&self) -> ClientOrderId

Source§

fn venue_order_id(&self) -> Option<VenueOrderId>

Source§

fn position_id(&self) -> Option<PositionId>

Source§

fn account_id(&self) -> Option<AccountId>

Source§

fn last_trade_id(&self) -> Option<TradeId>

Source§

fn side(&self) -> OrderSide

Source§

fn order_type(&self) -> OrderType

Source§

fn quantity(&self) -> Quantity

Source§

fn time_in_force(&self) -> TimeInForce

Source§

fn expire_time(&self) -> Option<UnixNanos>

Source§

fn price(&self) -> Option<Price>

Source§

fn trigger_price(&self) -> Option<Price>

Source§

fn trigger_type(&self) -> Option<TriggerType>

Source§

fn liquidity_side(&self) -> Option<LiquiditySide>

Source§

fn is_post_only(&self) -> bool

Source§

fn is_reduce_only(&self) -> bool

Source§

fn is_quote_quantity(&self) -> bool

Source§

fn display_qty(&self) -> Option<Quantity>

Source§

fn limit_offset(&self) -> Option<Price>

Source§

fn trailing_offset(&self) -> Option<Price>

Source§

fn trailing_offset_type(&self) -> Option<TrailingOffsetType>

Source§

fn emulation_trigger(&self) -> Option<TriggerType>

Source§

fn trigger_instrument_id(&self) -> Option<InstrumentId>

Source§

fn contingency_type(&self) -> Option<ContingencyType>

Source§

fn order_list_id(&self) -> Option<OrderListId>

Source§

fn linked_order_ids(&self) -> Option<&[ClientOrderId]>

Source§

fn parent_order_id(&self) -> Option<ClientOrderId>

Source§

fn exec_algorithm_id(&self) -> Option<ExecAlgorithmId>

Source§

fn exec_algorithm_params(&self) -> Option<&HashMap<Ustr, Ustr>>

Source§

fn exec_spawn_id(&self) -> Option<ClientOrderId>

Source§

fn tags(&self) -> Option<&[Ustr]>

Source§

fn filled_qty(&self) -> Quantity

Source§

fn leaves_qty(&self) -> Quantity

Source§

fn avg_px(&self) -> Option<f64>

Source§

fn slippage(&self) -> Option<f64>

Source§

fn init_id(&self) -> UUID4

Source§

fn ts_init(&self) -> UnixNanos

Source§

fn ts_last(&self) -> UnixNanos

Source§

fn events(&self) -> Vec<&OrderEventAny>

Source§

fn venue_order_ids(&self) -> Vec<&VenueOrderId>

Source§

fn trade_ids(&self) -> Vec<&TradeId>

Source§

fn apply(&mut self, event: OrderEventAny) -> Result<(), OrderError>

Source§

fn update(&mut self, event: &OrderUpdated)

Source§

fn last_event(&self) -> &OrderEventAny

Source§

fn event_count(&self) -> usize

Source§

fn is_buy(&self) -> bool

Source§

fn is_sell(&self) -> bool

Source§

fn is_passive(&self) -> bool

Source§

fn is_aggressive(&self) -> bool

Source§

fn is_emulated(&self) -> bool

Source§

fn is_active_local(&self) -> bool

Source§

fn is_primary(&self) -> bool

Source§

fn is_secondary(&self) -> bool

Source§

fn is_contingency(&self) -> bool

Source§

fn is_parent_order(&self) -> bool

Source§

fn is_child_order(&self) -> bool

Source§

fn is_open(&self) -> bool

Source§

fn is_canceled(&self) -> bool

Source§

fn is_closed(&self) -> bool

Source§

fn is_inflight(&self) -> bool

Source§

fn is_pending_update(&self) -> bool

Source§

fn is_pending_cancel(&self) -> bool

Source§

fn is_spawned(&self) -> bool

Source§

impl PyClass for StopMarketOrder

Source§

type Frozen = False

Whether the pyclass is frozen. Read more
Source§

impl PyClassImpl for StopMarketOrder

Source§

const IS_BASETYPE: bool = false

#[pyclass(subclass)]
Source§

const IS_SUBCLASS: bool = false

#[pyclass(extends=…)]
Source§

const IS_MAPPING: bool = false

#[pyclass(mapping)]
Source§

const IS_SEQUENCE: bool = false

#[pyclass(sequence)]
Source§

type BaseType = PyAny

Base class
Source§

type ThreadChecker = SendablePyClass<StopMarketOrder>

This handles following two situations: Read more
Source§

type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild

Immutable or mutable
Source§

type Dict = PyClassDummySlot

Specify this class has #[pyclass(dict)] or not.
Source§

type WeakRef = PyClassDummySlot

Specify this class has #[pyclass(weakref)] or not.
Source§

type BaseNativeType = PyAny

The closest native ancestor. This is PyAny by default, and when you declare #[pyclass(extends=PyDict)], it’s PyDict.
Source§

fn items_iter() -> PyClassItemsIter

Source§

fn doc(py: Python<'_>) -> PyResult<&'static CStr>

Rendered class doc
Source§

fn lazy_type_object() -> &'static LazyTypeObject<Self>

§

fn dict_offset() -> Option<isize>

§

fn weaklist_offset() -> Option<isize>

Source§

impl PyClassNewTextSignature<StopMarketOrder> for PyClassImplCollector<StopMarketOrder>

Source§

fn new_text_signature(self) -> Option<&'static str>

Source§

impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a StopMarketOrder

Source§

type Holder = Option<PyRef<'py, StopMarketOrder>>

Source§

fn extract( obj: &'a Bound<'py, PyAny>, holder: &'a mut Self::Holder, ) -> PyResult<Self>

Source§

impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut StopMarketOrder

Source§

type Holder = Option<PyRefMut<'py, StopMarketOrder>>

Source§

fn extract( obj: &'a Bound<'py, PyAny>, holder: &'a mut Self::Holder, ) -> PyResult<Self>

Source§

impl PyMethods<StopMarketOrder> for PyClassImplCollector<StopMarketOrder>

Source§

fn py_methods(self) -> &'static PyClassItems

Source§

impl PyTypeInfo for StopMarketOrder

Source§

const NAME: &'static str = "StopMarketOrder"

Class name.
Source§

const MODULE: Option<&'static str> = _

Module name, if any.
Source§

fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject

Returns the PyTypeObject instance for this type.
§

fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>

Returns the safe abstraction over the type object.
§

fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of this type or a subclass of this type.
§

fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of this type.
Source§

impl Serialize for StopMarketOrder

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl DerefToPyAny for StopMarketOrder

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromPyObject<'_> for T
where T: PyClass + Clone,

§

fn extract_bound(obj: &Bound<'_, PyAny>) -> Result<T, PyErr>

Extracts Self from the bound smart pointer obj. Read more
§

impl<'py, T> FromPyObjectBound<'_, 'py> for T
where T: FromPyObject<'py>,

§

fn from_py_object_bound(ob: Borrowed<'_, 'py, PyAny>) -> Result<T, PyErr>

Extracts Self from the bound smart pointer obj. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PyErrArguments for T
where T: IntoPy<Py<PyAny>> + Send + Sync,

§

fn arguments(self, py: Python<'_>) -> Py<PyAny>

Arguments for exception
§

impl<T> PyTypeCheck for T
where T: PyTypeInfo,

§

const NAME: &'static str = <T as PyTypeInfo>::NAME

Name of self. This is used in error messages, for example.
§

fn type_check(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of Self, which may include a subtype. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Ungil for T
where T: Send,