Enum InstrumentAny

Source
pub enum InstrumentAny {
    Betting(BettingInstrument),
    BinaryOption(BinaryOption),
    CryptoFuture(CryptoFuture),
    CryptoOption(CryptoOption),
    CryptoPerpetual(CryptoPerpetual),
    CurrencyPair(CurrencyPair),
    Equity(Equity),
    FuturesContract(FuturesContract),
    FuturesSpread(FuturesSpread),
    OptionContract(OptionContract),
    OptionSpread(OptionSpread),
}

Variants§

§

Betting(BettingInstrument)

§

BinaryOption(BinaryOption)

§

CryptoFuture(CryptoFuture)

§

CryptoOption(CryptoOption)

§

CryptoPerpetual(CryptoPerpetual)

§

CurrencyPair(CurrencyPair)

§

Equity(Equity)

§

FuturesContract(FuturesContract)

§

FuturesSpread(FuturesSpread)

§

OptionContract(OptionContract)

§

OptionSpread(OptionSpread)

Implementations§

Source§

impl InstrumentAny

Source

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

Trait Implementations§

Source§

impl Clone for InstrumentAny

Source§

fn clone(&self) -> InstrumentAny

Returns a duplicate 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 InstrumentAny

Source§

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

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

impl<'de> Deserialize<'de> for InstrumentAny

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<BettingInstrument> for InstrumentAny

Source§

fn from(v: BettingInstrument) -> InstrumentAny

Converts to this type from the input type.
Source§

impl From<BinaryOption> for InstrumentAny

Source§

fn from(v: BinaryOption) -> InstrumentAny

Converts to this type from the input type.
Source§

impl From<CryptoFuture> for InstrumentAny

Source§

fn from(v: CryptoFuture) -> InstrumentAny

Converts to this type from the input type.
Source§

impl From<CryptoOption> for InstrumentAny

Source§

fn from(v: CryptoOption) -> InstrumentAny

Converts to this type from the input type.
Source§

impl From<CryptoPerpetual> for InstrumentAny

Source§

fn from(v: CryptoPerpetual) -> InstrumentAny

Converts to this type from the input type.
Source§

impl From<CurrencyPair> for InstrumentAny

Source§

fn from(v: CurrencyPair) -> InstrumentAny

Converts to this type from the input type.
Source§

impl From<Equity> for InstrumentAny

Source§

fn from(v: Equity) -> InstrumentAny

Converts to this type from the input type.
Source§

impl From<FuturesContract> for InstrumentAny

Source§

fn from(v: FuturesContract) -> InstrumentAny

Converts to this type from the input type.
Source§

impl From<FuturesSpread> for InstrumentAny

Source§

fn from(v: FuturesSpread) -> InstrumentAny

Converts to this type from the input type.
Source§

impl From<OptionContract> for InstrumentAny

Source§

fn from(v: OptionContract) -> InstrumentAny

Converts to this type from the input type.
Source§

impl From<OptionSpread> for InstrumentAny

Source§

fn from(v: OptionSpread) -> InstrumentAny

Converts to this type from the input type.
Source§

impl Instrument for InstrumentAny

Source§

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

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

Source§

fn make_qty( &self, __enum_dispatch_arg_0: f64, __enum_dispatch_arg_1: Option<bool>, ) -> Quantity

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

Source§

fn calculate_notional_value( &self, __enum_dispatch_arg_0: Quantity, __enum_dispatch_arg_1: Price, __enum_dispatch_arg_2: 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, __enum_dispatch_arg_0: Quantity, __enum_dispatch_arg_1: Price, ) -> Quantity

Returns the equivalent quantity of the base asset.

Source§

fn into_any(self) -> InstrumentAny

Source§

fn id(&self) -> InstrumentId

Source§

fn symbol(&self) -> Symbol

Source§

fn venue(&self) -> Venue

Source§

fn raw_symbol(&self) -> Symbol

Source§

fn asset_class(&self) -> AssetClass

Source§

fn instrument_class(&self) -> InstrumentClass

Source§

fn underlying(&self) -> Option<Ustr>

Source§

fn base_currency(&self) -> Option<Currency>

Source§

fn quote_currency(&self) -> Currency

Source§

fn settlement_currency(&self) -> Currency

Source§

fn cost_currency(&self) -> Currency

Source§

fn isin(&self) -> Option<Ustr>

Source§

fn option_kind(&self) -> Option<OptionKind>

Source§

fn exchange(&self) -> Option<Ustr>

Source§

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

Source§

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

Source§

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

Source§

fn is_inverse(&self) -> bool

Source§

fn is_quanto(&self) -> bool

Source§

fn price_precision(&self) -> u8

Source§

fn size_precision(&self) -> u8

Source§

fn price_increment(&self) -> Price

Source§

fn size_increment(&self) -> Quantity

Source§

fn multiplier(&self) -> Quantity

Source§

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

Source§

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

Source§

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

Source§

fn max_notional(&self) -> Option<Money>

Source§

fn min_notional(&self) -> Option<Money>

Source§

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

Source§

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

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 ts_event(&self) -> UnixNanos

Source§

fn ts_init(&self) -> UnixNanos

Source§

impl PartialEq for InstrumentAny

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 Serialize for InstrumentAny

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 TryInto<BettingInstrument> for InstrumentAny

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<BettingInstrument, <Self as TryInto<BettingInstrument>>::Error>

Performs the conversion.
Source§

impl TryInto<BinaryOption> for InstrumentAny

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<BinaryOption, <Self as TryInto<BinaryOption>>::Error>

Performs the conversion.
Source§

impl TryInto<CryptoFuture> for InstrumentAny

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<CryptoFuture, <Self as TryInto<CryptoFuture>>::Error>

Performs the conversion.
Source§

impl TryInto<CryptoOption> for InstrumentAny

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<CryptoOption, <Self as TryInto<CryptoOption>>::Error>

Performs the conversion.
Source§

impl TryInto<CryptoPerpetual> for InstrumentAny

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<CryptoPerpetual, <Self as TryInto<CryptoPerpetual>>::Error>

Performs the conversion.
Source§

impl TryInto<CurrencyPair> for InstrumentAny

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<CurrencyPair, <Self as TryInto<CurrencyPair>>::Error>

Performs the conversion.
Source§

impl TryInto<Equity> for InstrumentAny

Source§

type Error = &'static str

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

fn try_into(self) -> Result<Equity, <Self as TryInto<Equity>>::Error>

Performs the conversion.
Source§

impl TryInto<FuturesContract> for InstrumentAny

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<FuturesContract, <Self as TryInto<FuturesContract>>::Error>

Performs the conversion.
Source§

impl TryInto<FuturesSpread> for InstrumentAny

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<FuturesSpread, <Self as TryInto<FuturesSpread>>::Error>

Performs the conversion.
Source§

impl TryInto<OptionContract> for InstrumentAny

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<OptionContract, <Self as TryInto<OptionContract>>::Error>

Performs the conversion.
Source§

impl TryInto<OptionSpread> for InstrumentAny

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<OptionSpread, <Self as TryInto<OptionSpread>>::Error>

Performs the conversion.

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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

Source§

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

§

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