pub struct TradeMsg {
Show 13 fields pub exchange: String, pub market_type: MarketType, pub msg_type: MessageType, pub pair: String, pub symbol: String, pub timestamp: i64, pub side: TradeSide, pub price: f64, pub quantity_base: f64, pub quantity_quote: f64, pub quantity_contract: Option<f64>, pub trade_id: String, pub json: String,
}
Expand description

Realtime trade message.

Fields§

§exchange: String

The exchange name, unique for each exchage

§market_type: MarketType

Market type

§msg_type: MessageType

Message type

§pair: String

Unified pair, base/quote, e.g., BTC/USDT

§symbol: String

Exchange-specific trading symbol or id, recognized by RESTful API

§timestamp: i64

Unix timestamp, in milliseconds

§side: TradeSide

Which side is taker

§price: f64

price

§quantity_base: f64§quantity_quote: f64§quantity_contract: Option<f64>

Number of contracts, always None for Spot

§trade_id: String§json: String

the original JSON message

Implementations§

source§

impl TradeMsg

source

pub fn to_csv_string(&self) -> String

Convert to a CSV string.

The exchange, market_type, msg_type, pair and symbol fields are not included to save some disk space.

source

pub fn from_csv_string( exchange: &str, market_type: &str, msg_type: &str, pair: &str, symbol: &str, s: &str ) -> Self

Convert from a CSV string.

source

pub fn to_proto(&self) -> Trade

Convert to a protobuf message.

source

pub fn from_proto( exchange: &str, market_type: &str, msg_type: &str, pair: &str, symbol: &str, proto_msg: &Trade ) -> Self

Convert from a protobuf message.

Trait Implementations§

source§

impl Debug for TradeMsg

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for TradeMsg

source§

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 Serialize for TradeMsg

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,