pub struct ExecutionInstrumentMap {
pub exchange: Keyed<ExchangeIndex, ExchangeId>,
pub assets: FnvIndexSet<AssetNameExchange>,
pub instruments: FnvIndexSet<InstrumentNameExchange>,
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>§assets: FnvIndexSet<AssetNameExchange>§instruments: FnvIndexSet<InstrumentNameExchange>§asset_names: FnvHashMap<AssetNameExchange, AssetIndex>§instrument_names: FnvHashMap<InstrumentNameExchange, InstrumentIndex>Implementations§
Source§impl ExecutionInstrumentMap
impl ExecutionInstrumentMap
Sourcepub fn new(
exchange: Keyed<ExchangeIndex, ExchangeId>,
assets: FnvIndexMap<AssetIndex, AssetNameExchange>,
instruments: FnvIndexMap<InstrumentIndex, InstrumentNameExchange>,
) -> Self
pub fn new( exchange: Keyed<ExchangeIndex, ExchangeId>, assets: FnvIndexMap<AssetIndex, AssetNameExchange>, instruments: FnvIndexMap<InstrumentIndex, InstrumentNameExchange>, ) -> 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
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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 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
Mutably borrows from an owned value. Read more
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
Compare self to
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>
Converts
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>
Converts
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