Trait Instrument

Source
pub trait Instrument: 'static + Send {
Show 51 methods // Required methods 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 tick_scheme(&self) -> Option<&dyn TickSchemeRule> { ... } fn into_any(self) -> InstrumentAny where Self: Sized, InstrumentAny: From<Self> { ... } fn symbol(&self) -> Symbol { ... } fn venue(&self) -> Venue { ... } fn cost_currency(&self) -> Currency { ... } fn is_quanto(&self) -> bool { ... } fn margin_init(&self) -> Decimal { ... } fn margin_maint(&self) -> Decimal { ... } fn maker_fee(&self) -> Decimal { ... } fn taker_fee(&self) -> Decimal { ... } fn _min_price_increment_precision(&self) -> u8 { ... } fn try_make_price(&self, value: f64) -> Result<Price> { ... } fn make_price(&self, value: f64) -> Price { ... } fn try_make_qty( &self, value: f64, round_down: Option<bool>, ) -> Result<Quantity> { ... } fn make_qty(&self, value: f64, round_down: Option<bool>) -> Quantity { ... } fn try_calculate_base_quantity( &self, quantity: Quantity, last_price: Price, ) -> Result<Quantity> { ... } fn calculate_base_quantity( &self, quantity: Quantity, last_price: Price, ) -> Quantity { ... } fn calculate_notional_value( &self, quantity: Quantity, price: Price, use_quote_for_inverse: Option<bool>, ) -> Money { ... } fn next_bid_price(&self, value: f64, n: i32) -> Option<Price> { ... } fn next_ask_price(&self, value: f64, n: i32) -> Option<Price> { ... } fn next_bid_prices(&self, value: f64, n: usize) -> Vec<Price> { ... } fn next_ask_prices(&self, value: f64, n: usize) -> Vec<Price> { ... }
}

Required Methods§

Provided Methods§

Source

fn tick_scheme(&self) -> Option<&dyn TickSchemeRule>

Source

fn into_any(self) -> InstrumentAny
where Self: Sized, InstrumentAny: From<Self>,

Source

fn symbol(&self) -> Symbol

Source

fn venue(&self) -> Venue

Source

fn cost_currency(&self) -> Currency

§Panics

Panics if the instrument is inverse and does not have a base currency.

Source

fn is_quanto(&self) -> bool

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 _min_price_increment_precision(&self) -> u8

Source

fn try_make_price(&self, value: f64) -> Result<Price>

§Errors

Returns an error if the value is not finite or cannot be converted to a Price.

Source

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

Source

fn try_make_qty(&self, value: f64, round_down: Option<bool>) -> Result<Quantity>

§Errors

Returns an error if the value is not finite or cannot be converted to a Quantity.

Source

fn make_qty(&self, value: f64, round_down: Option<bool>) -> Quantity

Source

fn try_calculate_base_quantity( &self, quantity: Quantity, last_price: Price, ) -> Result<Quantity>

§Errors

Returns an error if the quantity or price is not finite or cannot be converted to a Quantity.

Source

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

Source

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

§Panics

Panics if the instrument is inverse and does not have a base currency.

Source

fn next_bid_price(&self, value: f64, n: i32) -> Option<Price>

Source

fn next_ask_price(&self, value: f64, n: i32) -> Option<Price>

Source

fn next_bid_prices(&self, value: f64, n: usize) -> Vec<Price>

Source

fn next_ask_prices(&self, value: f64, n: usize) -> Vec<Price>

Implementors§