pub struct MarketEvent<InstrumentKey = MarketDataInstrument, T = DataKind> {
pub time_exchange: DateTime<Utc>,
pub time_received: DateTime<Utc>,
pub exchange: ExchangeId,
pub instrument: InstrumentKey,
pub kind: T,
}Expand description
Normalised Barter MarketEvent<T> wrapping the T data variant in metadata.
Note: T can be an enum such as the DataKind if required.
See crate::subscription for all existing Barter Market event variants.
§Examples
Fields§
§time_exchange: DateTime<Utc>§time_received: DateTime<Utc>§exchange: ExchangeId§instrument: InstrumentKey§kind: TImplementations§
Source§impl<InstrumentKey, T> MarketEvent<InstrumentKey, T>
impl<InstrumentKey, T> MarketEvent<InstrumentKey, T>
pub fn map_kind<F, O>(self, op: F) -> MarketEvent<InstrumentKey, O>where
F: FnOnce(T) -> O,
Source§impl<InstrumentKey> MarketEvent<InstrumentKey, DataKind>
impl<InstrumentKey> MarketEvent<InstrumentKey, DataKind>
pub fn as_public_trade( &self, ) -> Option<MarketEvent<&InstrumentKey, &PublicTrade>>
pub fn as_order_book_l1( &self, ) -> Option<MarketEvent<&InstrumentKey, &OrderBookL1>>
pub fn as_order_book( &self, ) -> Option<MarketEvent<&InstrumentKey, &OrderBookEvent>>
pub fn as_candle(&self) -> Option<MarketEvent<&InstrumentKey, &Candle>>
pub fn as_liquidation( &self, ) -> Option<MarketEvent<&InstrumentKey, &Liquidation>>
Trait Implementations§
Source§impl<InstrumentKey: Clone, T: Clone> Clone for MarketEvent<InstrumentKey, T>
impl<InstrumentKey: Clone, T: Clone> Clone for MarketEvent<InstrumentKey, T>
Source§fn clone(&self) -> MarketEvent<InstrumentKey, T>
fn clone(&self) -> MarketEvent<InstrumentKey, T>
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<'de, InstrumentKey, T> Deserialize<'de> for MarketEvent<InstrumentKey, T>where
InstrumentKey: Deserialize<'de>,
T: Deserialize<'de>,
impl<'de, InstrumentKey, T> Deserialize<'de> for MarketEvent<InstrumentKey, T>where
InstrumentKey: Deserialize<'de>,
T: 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<InstrumentKey> From<(ExchangeId, InstrumentKey, BinanceOrderBookL2Snapshot)> for MarketEvent<InstrumentKey, OrderBookEvent>
impl<InstrumentKey> From<(ExchangeId, InstrumentKey, BinanceOrderBookL2Snapshot)> for MarketEvent<InstrumentKey, OrderBookEvent>
Source§fn from(
(exchange, instrument, snapshot): (ExchangeId, InstrumentKey, BinanceOrderBookL2Snapshot),
) -> Self
fn from( (exchange, instrument, snapshot): (ExchangeId, InstrumentKey, BinanceOrderBookL2Snapshot), ) -> Self
Converts to this type from the input type.
Source§impl<InstrumentKey> From<MarketEvent<InstrumentKey, Candle>> for MarketEvent<InstrumentKey, DataKind>
impl<InstrumentKey> From<MarketEvent<InstrumentKey, Candle>> for MarketEvent<InstrumentKey, DataKind>
Source§fn from(value: MarketEvent<InstrumentKey, Candle>) -> Self
fn from(value: MarketEvent<InstrumentKey, Candle>) -> Self
Converts to this type from the input type.
Source§impl<InstrumentKey> From<MarketEvent<InstrumentKey, Liquidation>> for MarketEvent<InstrumentKey, DataKind>
impl<InstrumentKey> From<MarketEvent<InstrumentKey, Liquidation>> for MarketEvent<InstrumentKey, DataKind>
Source§fn from(value: MarketEvent<InstrumentKey, Liquidation>) -> Self
fn from(value: MarketEvent<InstrumentKey, Liquidation>) -> Self
Converts to this type from the input type.
Source§impl<InstrumentKey> From<MarketEvent<InstrumentKey, OrderBookEvent>> for MarketEvent<InstrumentKey, DataKind>
impl<InstrumentKey> From<MarketEvent<InstrumentKey, OrderBookEvent>> for MarketEvent<InstrumentKey, DataKind>
Source§fn from(value: MarketEvent<InstrumentKey, OrderBookEvent>) -> Self
fn from(value: MarketEvent<InstrumentKey, OrderBookEvent>) -> Self
Converts to this type from the input type.
Source§impl<InstrumentKey> From<MarketEvent<InstrumentKey, OrderBookL1>> for MarketEvent<InstrumentKey, DataKind>
impl<InstrumentKey> From<MarketEvent<InstrumentKey, OrderBookL1>> for MarketEvent<InstrumentKey, DataKind>
Source§fn from(value: MarketEvent<InstrumentKey, OrderBookL1>) -> Self
fn from(value: MarketEvent<InstrumentKey, OrderBookL1>) -> Self
Converts to this type from the input type.
Source§impl<InstrumentKey> From<MarketEvent<InstrumentKey, PublicTrade>> for MarketEvent<InstrumentKey, DataKind>
impl<InstrumentKey> From<MarketEvent<InstrumentKey, PublicTrade>> for MarketEvent<InstrumentKey, DataKind>
Source§fn from(value: MarketEvent<InstrumentKey, PublicTrade>) -> Self
fn from(value: MarketEvent<InstrumentKey, PublicTrade>) -> Self
Converts to this type from the input type.
Source§impl<InstrumentKey: Ord, T: Ord> Ord for MarketEvent<InstrumentKey, T>
impl<InstrumentKey: Ord, T: Ord> Ord for MarketEvent<InstrumentKey, T>
Source§fn cmp(&self, other: &MarketEvent<InstrumentKey, T>) -> Ordering
fn cmp(&self, other: &MarketEvent<InstrumentKey, T>) -> Ordering
1.21.0 · 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<InstrumentKey: PartialEq, T: PartialEq> PartialEq for MarketEvent<InstrumentKey, T>
impl<InstrumentKey: PartialEq, T: PartialEq> PartialEq for MarketEvent<InstrumentKey, T>
Source§fn eq(&self, other: &MarketEvent<InstrumentKey, T>) -> bool
fn eq(&self, other: &MarketEvent<InstrumentKey, T>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<InstrumentKey: PartialOrd, T: PartialOrd> PartialOrd for MarketEvent<InstrumentKey, T>
impl<InstrumentKey: PartialOrd, T: PartialOrd> PartialOrd for MarketEvent<InstrumentKey, T>
Source§impl<InstrumentKey, T> Serialize for MarketEvent<InstrumentKey, T>
impl<InstrumentKey, T> Serialize for MarketEvent<InstrumentKey, T>
impl<InstrumentKey: Eq, T: Eq> Eq for MarketEvent<InstrumentKey, T>
impl<InstrumentKey, T> StructuralPartialEq for MarketEvent<InstrumentKey, T>
Auto Trait Implementations§
impl<InstrumentKey, T> Freeze for MarketEvent<InstrumentKey, T>
impl<InstrumentKey, T> RefUnwindSafe for MarketEvent<InstrumentKey, T>where
InstrumentKey: RefUnwindSafe,
T: RefUnwindSafe,
impl<InstrumentKey, T> Send for MarketEvent<InstrumentKey, T>
impl<InstrumentKey, T> Sync for MarketEvent<InstrumentKey, T>
impl<InstrumentKey, T> Unpin for MarketEvent<InstrumentKey, T>
impl<InstrumentKey, T> UnwindSafe for MarketEvent<InstrumentKey, T>where
InstrumentKey: UnwindSafe,
T: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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