openlimits_binance/model/websocket/
ticker.rs1use serde::Deserialize;
2use serde::Serialize;
3use rust_decimal::prelude::Decimal;
4use super::shared::string_to_decimal;
5
6#[derive(Debug, Serialize, Deserialize, Clone)]
8#[serde(rename_all = "camelCase")]
9pub struct Ticker {
10 #[serde(rename = "e")]
11 pub event_type: String,
12 #[serde(rename = "E")]
13 pub event_time: u64,
14 #[serde(rename = "s")]
15 pub symbol: String,
16 #[serde(rename = "p", with = "string_to_decimal")]
17 pub price_change: Decimal,
18 #[serde(rename = "P", with = "string_to_decimal")]
19 pub price_change_percent: Decimal,
20 #[serde(rename = "w", with = "string_to_decimal")]
21 pub average_price: Decimal,
22 #[serde(rename = "x", with = "string_to_decimal")]
23 pub prev_close: Decimal,
24 #[serde(rename = "c", with = "string_to_decimal")]
25 pub current_close: Decimal,
26 #[serde(rename = "Q", with = "string_to_decimal")]
27 pub current_close_qty: Decimal,
28 #[serde(rename = "b", with = "string_to_decimal")]
29 pub best_bid: Decimal,
30 #[serde(rename = "B", with = "string_to_decimal")]
31 pub best_bid_qty: Decimal,
32 #[serde(rename = "a", with = "string_to_decimal")]
33 pub best_ask: Decimal,
34 #[serde(rename = "A", with = "string_to_decimal")]
35 pub best_ask_qty: Decimal,
36 #[serde(rename = "o", with = "string_to_decimal")]
37 pub open: Decimal,
38 #[serde(rename = "h", with = "string_to_decimal")]
39 pub high: Decimal,
40 #[serde(rename = "l", with = "string_to_decimal")]
41 pub low: Decimal,
42 #[serde(rename = "v", with = "string_to_decimal")]
43 pub volume: Decimal,
44 #[serde(rename = "q", with = "string_to_decimal")]
45 pub quote_volume: Decimal,
46 #[serde(rename = "O")]
47 pub open_time: u64,
48 #[serde(rename = "C")]
49 pub close_time: u64,
50 #[serde(rename = "F")]
51 pub first_trade_id: u64,
52 #[serde(rename = "L")]
53 pub last_trade_id: u64,
54 #[serde(rename = "n")]
55 pub num_trades: u64,
56}