pub struct ExecutionInstrumentMap {
pub exchange: Keyed<ExchangeIndex, ExchangeId>,
pub assets: FnvIndexSet<ExchangeAsset<Asset>>,
pub instruments: FnvIndexSet<Instrument<Keyed<ExchangeIndex, ExchangeId>, AssetIndex>>,
pub asset_names: FnvHashMap<AssetNameExchange, AssetIndex>,
pub instrument_names: FnvHashMap<InstrumentNameExchange, InstrumentIndex>,
}Expand description
Indexed instrument map used to associate the internal Barter representation of instruments and
assets with the ExecutionClient representation.
Similarly, when the execution manager received an AccountEvent
from the execution API, it needs to determine the internal representation of the associated
assets and instruments.
eg/ InstrumentNameExchange("XBT-USDT") <–> InstrumentIndex(1)
eg/ AssetNameExchange("XBT") <–> AssetIndex(1)
Fields§
§exchange: Keyed<ExchangeIndex, ExchangeId>The exchange associated with this execution map.
assets: FnvIndexSet<ExchangeAsset<Asset>>Collection of assets available by the engine with their exchange-specific representations. This holds all indexed assets.
instruments: FnvIndexSet<Instrument<Keyed<ExchangeIndex, ExchangeId>, AssetIndex>>Collection of instruments available by the engine. This holds all indexed instruments.
asset_names: FnvHashMap<AssetNameExchange, AssetIndex>Map from exchange-specific asset names to internal asset indices for fast lookups.
instrument_names: FnvHashMap<InstrumentNameExchange, InstrumentIndex>Map from exchange-specific instrument names to internal instrument indices for fast lookups.
Implementations§
Source§impl ExecutionInstrumentMap
impl ExecutionInstrumentMap
Sourcepub fn new(
exchange: Keyed<ExchangeIndex, ExchangeId>,
instruments: &IndexedInstruments,
) -> Self
pub fn new( exchange: Keyed<ExchangeIndex, ExchangeId>, instruments: &IndexedInstruments, ) -> Self
Construct a new Self using the provided indexed assets and instruments.
pub fn exchange_assets(&self) -> impl Iterator<Item = &AssetNameExchange>
pub fn exchange_instruments( &self, ) -> impl Iterator<Item = &InstrumentNameExchange>
pub fn find_exchange_id( &self, exchange: ExchangeIndex, ) -> Result<ExchangeId, KeyError>
pub fn find_exchange_index( &self, exchange: ExchangeId, ) -> Result<ExchangeIndex, IndexError>
pub fn find_asset_name_exchange( &self, asset: AssetIndex, ) -> Result<&AssetNameExchange, KeyError>
pub fn find_asset_index( &self, asset: &AssetNameExchange, ) -> Result<AssetIndex, IndexError>
pub fn find_instrument_name_exchange( &self, instrument: InstrumentIndex, ) -> Result<&InstrumentNameExchange, KeyError>
pub fn find_instrument_index( &self, instrument: &InstrumentNameExchange, ) -> Result<InstrumentIndex, IndexError>
Trait Implementations§
Source§impl Clone for ExecutionInstrumentMap
impl Clone for ExecutionInstrumentMap
Source§fn clone(&self) -> ExecutionInstrumentMap
fn clone(&self) -> ExecutionInstrumentMap
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ExecutionInstrumentMap
impl Debug for ExecutionInstrumentMap
Source§impl PartialEq for ExecutionInstrumentMap
impl PartialEq for ExecutionInstrumentMap
impl Eq for ExecutionInstrumentMap
impl StructuralPartialEq for ExecutionInstrumentMap
Auto Trait Implementations§
impl Freeze for ExecutionInstrumentMap
impl RefUnwindSafe for ExecutionInstrumentMap
impl Send for ExecutionInstrumentMap
impl Sync for ExecutionInstrumentMap
impl Unpin for ExecutionInstrumentMap
impl UnsafeUnpin for ExecutionInstrumentMap
impl UnwindSafe for ExecutionInstrumentMap
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more