Skip to main content

openlimits_binance/model/
price_stats.rs

1use serde::Deserialize;
2use serde::Serialize;
3use rust_decimal::prelude::Decimal;
4use super::shared::string_to_decimal;
5
6/// This struct represents price statistics 
7#[derive(Debug, Serialize, Deserialize, Clone)]
8#[serde(rename_all = "camelCase")]
9pub struct PriceStats {
10    pub symbol: String,
11    #[serde(with = "string_to_decimal")]
12    pub price_change: Decimal,
13    #[serde(with = "string_to_decimal")]
14    pub price_change_percent: Decimal,
15    #[serde(with = "string_to_decimal")]
16    pub weighted_avg_price: Decimal,
17    #[serde(with = "string_to_decimal")]
18    pub prev_close_price: Decimal,
19    #[serde(with = "string_to_decimal")]
20    pub last_price: Decimal,
21    #[serde(with = "string_to_decimal")]
22    pub bid_price: Decimal,
23    #[serde(with = "string_to_decimal")]
24    pub ask_price: Decimal,
25    #[serde(with = "string_to_decimal")]
26    pub open_price: Decimal,
27    #[serde(with = "string_to_decimal")]
28    pub high_price: Decimal,
29    #[serde(with = "string_to_decimal")]
30    pub low_price: Decimal,
31    #[serde(with = "string_to_decimal")]
32    pub volume: Decimal,
33    pub open_time: u64,
34    pub close_time: u64,
35    pub first_id: i64, // For dummy symbol "123456", it is -1
36    pub last_id: i64,  // Same as above
37    pub count: u64,
38}