pub struct Instrument<ExchangeKey, AssetKey> {
pub exchange: ExchangeKey,
pub name_internal: InstrumentNameInternal,
pub name_exchange: InstrumentNameExchange,
pub underlying: Underlying<AssetKey>,
pub quote: InstrumentQuoteAsset,
pub kind: InstrumentKind<AssetKey>,
pub spec: Option<InstrumentSpec<AssetKey>>,
}Expand description
Comprehensive Instrument model, containing all the data required to subscribe to market data and generate correct orders.
Fields§
§exchange: ExchangeKey§name_internal: InstrumentNameInternal§name_exchange: InstrumentNameExchange§underlying: Underlying<AssetKey>§quote: InstrumentQuoteAsset§kind: InstrumentKind<AssetKey>§spec: Option<InstrumentSpec<AssetKey>>Implementations§
Source§impl<ExchangeKey, AssetKey> Instrument<ExchangeKey, AssetKey>
impl<ExchangeKey, AssetKey> Instrument<ExchangeKey, AssetKey>
Sourcepub fn new<NameInternal, NameExchange>(
exchange: ExchangeKey,
name_internal: NameInternal,
name_exchange: NameExchange,
underlying: Underlying<AssetKey>,
quote: InstrumentQuoteAsset,
kind: InstrumentKind<AssetKey>,
spec: Option<InstrumentSpec<AssetKey>>,
) -> Self
pub fn new<NameInternal, NameExchange>( exchange: ExchangeKey, name_internal: NameInternal, name_exchange: NameExchange, underlying: Underlying<AssetKey>, quote: InstrumentQuoteAsset, kind: InstrumentKind<AssetKey>, spec: Option<InstrumentSpec<AssetKey>>, ) -> Self
Construct a new Instrument with the provided data.
This constructor assumes the InstrumentNameInternal can be constructed in the default
style via the InstrumentNameInternal::new_from_exchange constructor.
Sourcepub fn spot<NameInternal, NameExchange>(
exchange: ExchangeKey,
name_internal: NameInternal,
name_exchange: NameExchange,
underlying: Underlying<AssetKey>,
spec: Option<InstrumentSpec<AssetKey>>,
) -> Self
pub fn spot<NameInternal, NameExchange>( exchange: ExchangeKey, name_internal: NameInternal, name_exchange: NameExchange, underlying: Underlying<AssetKey>, spec: Option<InstrumentSpec<AssetKey>>, ) -> Self
Construct a new Spot Instrument with the provided data.
This constructor assumes the InstrumentNameInternal can be constructed in the default
style via the InstrumentNameInternal::new_from_exchange constructor.
Sourcepub fn map_exchange_key<NewExchangeKey>(
self,
exchange: NewExchangeKey,
) -> Instrument<NewExchangeKey, AssetKey>
pub fn map_exchange_key<NewExchangeKey>( self, exchange: NewExchangeKey, ) -> Instrument<NewExchangeKey, AssetKey>
Map this Instruments ExchangeKey to a new key.
Sourcepub fn map_asset_key_with_lookup<FnFindAsset, NewAssetKey, Error>(
self,
find_asset: FnFindAsset,
) -> Result<Instrument<ExchangeKey, NewAssetKey>, Error>
pub fn map_asset_key_with_lookup<FnFindAsset, NewAssetKey, Error>( self, find_asset: FnFindAsset, ) -> Result<Instrument<ExchangeKey, NewAssetKey>, Error>
Map this Instruments AssetKey to a new key, using the provided lookup closure.
Trait Implementations§
Source§impl<ExchangeKey: Clone, AssetKey: Clone> Clone for Instrument<ExchangeKey, AssetKey>
impl<ExchangeKey: Clone, AssetKey: Clone> Clone for Instrument<ExchangeKey, AssetKey>
Source§fn clone(&self) -> Instrument<ExchangeKey, AssetKey>
fn clone(&self) -> Instrument<ExchangeKey, AssetKey>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'de, ExchangeKey, AssetKey> Deserialize<'de> for Instrument<ExchangeKey, AssetKey>where
ExchangeKey: Deserialize<'de>,
AssetKey: Deserialize<'de>,
impl<'de, ExchangeKey, AssetKey> Deserialize<'de> for Instrument<ExchangeKey, AssetKey>where
ExchangeKey: Deserialize<'de>,
AssetKey: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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<ExchangeKey> From<&Instrument<ExchangeKey, Asset>> for MarketDataInstrument
impl<ExchangeKey> From<&Instrument<ExchangeKey, Asset>> for MarketDataInstrument
Source§fn from(value: &Instrument<ExchangeKey, Asset>) -> Self
fn from(value: &Instrument<ExchangeKey, Asset>) -> Self
Converts to this type from the input type.
Source§impl<ExchangeKey: Ord, AssetKey: Ord> Ord for Instrument<ExchangeKey, AssetKey>
impl<ExchangeKey: Ord, AssetKey: Ord> Ord for Instrument<ExchangeKey, AssetKey>
Source§fn cmp(&self, other: &Instrument<ExchangeKey, AssetKey>) -> Ordering
fn cmp(&self, other: &Instrument<ExchangeKey, AssetKey>) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<ExchangeKey: PartialEq, AssetKey: PartialEq> PartialEq for Instrument<ExchangeKey, AssetKey>
impl<ExchangeKey: PartialEq, AssetKey: PartialEq> PartialEq for Instrument<ExchangeKey, AssetKey>
Source§fn eq(&self, other: &Instrument<ExchangeKey, AssetKey>) -> bool
fn eq(&self, other: &Instrument<ExchangeKey, AssetKey>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<ExchangeKey: PartialOrd, AssetKey: PartialOrd> PartialOrd for Instrument<ExchangeKey, AssetKey>
impl<ExchangeKey: PartialOrd, AssetKey: PartialOrd> PartialOrd for Instrument<ExchangeKey, AssetKey>
Source§impl<ExchangeKey, AssetKey> Serialize for Instrument<ExchangeKey, AssetKey>
impl<ExchangeKey, AssetKey> Serialize for Instrument<ExchangeKey, AssetKey>
impl<ExchangeKey: Eq, AssetKey: Eq> Eq for Instrument<ExchangeKey, AssetKey>
impl<ExchangeKey, AssetKey> StructuralPartialEq for Instrument<ExchangeKey, AssetKey>
Auto Trait Implementations§
impl<ExchangeKey, AssetKey> Freeze for Instrument<ExchangeKey, AssetKey>
impl<ExchangeKey, AssetKey> RefUnwindSafe for Instrument<ExchangeKey, AssetKey>where
ExchangeKey: RefUnwindSafe,
AssetKey: RefUnwindSafe,
impl<ExchangeKey, AssetKey> Send for Instrument<ExchangeKey, AssetKey>
impl<ExchangeKey, AssetKey> Sync for Instrument<ExchangeKey, AssetKey>
impl<ExchangeKey, AssetKey> Unpin for Instrument<ExchangeKey, AssetKey>
impl<ExchangeKey, AssetKey> UnsafeUnpin for Instrument<ExchangeKey, AssetKey>where
ExchangeKey: UnsafeUnpin,
AssetKey: UnsafeUnpin,
impl<ExchangeKey, AssetKey> UnwindSafe for Instrument<ExchangeKey, AssetKey>where
ExchangeKey: UnwindSafe,
AssetKey: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more