pub struct MarketEvent<InstrumentKey = Instrument, T = DataKind> {
pub time_exchange: DateTime<Utc>,
pub time_received: DateTime<Utc>,
pub exchange: Exchange,
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: Exchange§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,
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 copy 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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