nautilus_model::instruments

Trait Instrument

Source
pub trait Instrument: 'static + Send {
Show 40 methods // Required methods fn into_any(self) -> InstrumentAny; fn id(&self) -> InstrumentId; fn raw_symbol(&self) -> Symbol; fn asset_class(&self) -> AssetClass; fn instrument_class(&self) -> InstrumentClass; fn underlying(&self) -> Option<Ustr>; fn base_currency(&self) -> Option<Currency>; fn quote_currency(&self) -> Currency; fn settlement_currency(&self) -> Currency; fn isin(&self) -> Option<Ustr>; fn option_kind(&self) -> Option<OptionKind>; fn exchange(&self) -> Option<Ustr>; fn strike_price(&self) -> Option<Price>; fn activation_ns(&self) -> Option<UnixNanos>; fn expiration_ns(&self) -> Option<UnixNanos>; fn is_inverse(&self) -> bool; fn price_precision(&self) -> u8; fn size_precision(&self) -> u8; fn price_increment(&self) -> Price; fn size_increment(&self) -> Quantity; fn multiplier(&self) -> Quantity; fn lot_size(&self) -> Option<Quantity>; fn max_quantity(&self) -> Option<Quantity>; fn min_quantity(&self) -> Option<Quantity>; fn max_notional(&self) -> Option<Money>; fn min_notional(&self) -> Option<Money>; fn max_price(&self) -> Option<Price>; fn min_price(&self) -> Option<Price>; fn ts_event(&self) -> UnixNanos; fn ts_init(&self) -> UnixNanos; // Provided methods fn symbol(&self) -> Symbol { ... } fn venue(&self) -> Venue { ... } fn margin_init(&self) -> Decimal { ... } fn margin_maint(&self) -> Decimal { ... } fn maker_fee(&self) -> Decimal { ... } fn taker_fee(&self) -> Decimal { ... } fn make_price(&self, value: f64) -> Price { ... } fn make_qty(&self, value: f64) -> Quantity { ... } fn calculate_notional_value( &self, quantity: Quantity, price: Price, use_quote_for_inverse: Option<bool>, ) -> Money { ... } fn calculate_base_quantity( &self, quantity: Quantity, last_px: Price, ) -> Quantity { ... }
}

Required Methods§

Provided Methods§

Source

fn symbol(&self) -> Symbol

Source

fn venue(&self) -> Venue

Source

fn margin_init(&self) -> Decimal

Source

fn margin_maint(&self) -> Decimal

Source

fn maker_fee(&self) -> Decimal

Source

fn taker_fee(&self) -> Decimal

Source

fn make_price(&self, value: f64) -> Price

Creates a new Price from the given value with the correct price precision for the instrument.

Source

fn make_qty(&self, value: f64) -> Quantity

Creates a new Quantity from the given value with the correct size precision for the instrument.

Source

fn calculate_notional_value( &self, quantity: Quantity, price: Price, use_quote_for_inverse: Option<bool>, ) -> Money

Calculates the notional value from the given parameters. The use_quote_for_inverse flag is only applicable for inverse instruments.

§Panics

This function panics:

  • If instrument is inverse and not use_quote_for_inverse, with no base currency.
Source

fn calculate_base_quantity( &self, quantity: Quantity, last_px: Price, ) -> Quantity

Returns the equivalent quantity of the base asset.

Implementors§