nautilus_model::orders::market

Struct MarketOrder

Source
pub struct MarketOrder { /* private fields */ }

Implementations§

Source§

impl MarketOrder

Source

pub fn new( trader_id: TraderId, strategy_id: StrategyId, instrument_id: InstrumentId, client_order_id: ClientOrderId, order_side: OrderSide, quantity: Quantity, time_in_force: TimeInForce, init_id: UUID4, ts_init: UnixNanos, reduce_only: bool, quote_quantity: bool, 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>>, ) -> Self

Creates a new MarketOrder instance.

Source

pub fn new_checked( trader_id: TraderId, strategy_id: StrategyId, instrument_id: InstrumentId, client_order_id: ClientOrderId, order_side: OrderSide, quantity: Quantity, time_in_force: TimeInForce, init_id: UUID4, ts_init: UnixNanos, reduce_only: bool, quote_quantity: bool, 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>>, ) -> Result<Self>

Creates a new MarketOrder 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 Clone for MarketOrder

Source§

fn clone(&self) -> MarketOrder

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 MarketOrder

Source§

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

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

impl Default for MarketOrder

Source§

fn default() -> Self

Creates a new default MarketOrder instance for testing.

Source§

impl Deref for MarketOrder

Source§

type Target = OrderCore

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl DerefMut for MarketOrder

Source§

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

Mutably dereferences the value.
Source§

impl<'de> Deserialize<'de> for MarketOrder

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 Display for MarketOrder

Source§

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

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

impl From<OrderAny> for MarketOrder

Source§

fn from(order: OrderAny) -> MarketOrder

Converts to this type from the input type.
Source§

impl From<OrderInitialized> for MarketOrder

Source§

fn from(event: OrderInitialized) -> Self

Converts to this type from the input type.
Source§

impl IntoPy<Py<PyAny>> for MarketOrder

Source§

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

Performs the conversion.
Source§

impl Order for MarketOrder

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 apply(&mut self, event: OrderEventAny) -> Result<(), OrderError>

Source§

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

Source§

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

Source§

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

Source§

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

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 PartialEq for MarketOrder

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PyClass for MarketOrder

Source§

type Frozen = False

Whether the pyclass is frozen. Read more
Source§

impl PyClassImpl for MarketOrder

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<MarketOrder>

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<MarketOrder> for PyClassImplCollector<MarketOrder>

Source§

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

Source§

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

Source§

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

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 MarketOrder

Source§

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

Source§

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

Source§

impl PyMethods<MarketOrder> for PyClassImplCollector<MarketOrder>

Source§

fn py_methods(self) -> &'static PyClassItems

Source§

impl PyTypeInfo for MarketOrder

Source§

const NAME: &'static str = "MarketOrder"

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 MarketOrder

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 MarketOrder

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> Separable for T
where T: Display,

Source§

fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String

Adds separators according to the given SeparatorPolicy. Read more
Source§

fn separate_with_commas(&self) -> String

Inserts a comma every three digits from the right. Read more
Source§

fn separate_with_spaces(&self) -> String

Inserts a space every three digits from the right. Read more
Source§

fn separate_with_dots(&self) -> String

Inserts a period every three digits from the right. Read more
Source§

fn separate_with_underscores(&self) -> String

Inserts an underscore every three digits from the right. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. 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,