Struct crypto_message::TradeMsg
source · 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: StringThe exchange name, unique for each exchage
market_type: MarketTypeMarket type
msg_type: MessageTypeMessage type
pair: StringUnified pair, base/quote, e.g., BTC/USDT
symbol: StringExchange-specific trading symbol or id, recognized by RESTful API
timestamp: i64Unix timestamp, in milliseconds
side: TradeSideWhich side is taker
price: f64price
quantity_base: f64§quantity_quote: f64§quantity_contract: Option<f64>Number of contracts, always None for Spot
trade_id: String§json: Stringthe original JSON message
Implementations§
source§impl TradeMsg
impl TradeMsg
sourcepub fn to_csv_string(&self) -> String
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.
Trait Implementations§
source§impl<'de> Deserialize<'de> for TradeMsg
impl<'de> Deserialize<'de> for TradeMsg
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