1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//!
//! The depth data, received via WebSocket.
//!

use serde::Deserialize;

use crate::http_api_v3::data::depth_element::DepthElement;

///
/// The depth data, received via WebSocket.
///
#[derive(Debug, Deserialize, Clone)]
pub struct Depth {
    /// The trade event type. Usually equal to `depthUpdate`.
    #[serde(rename = "e")]
    pub event_type: String,
    /// The trade event time in milliseconds since Unix epoch.
    #[serde(rename = "E")]
    pub event_time: i64,
    /// The trading symbol name.
    #[serde(rename = "s")]
    pub symbol: String,
    /// The first update ID.
    #[serde(rename = "U")]
    pub first_update_id: i64,
    /// The last update ID.
    #[serde(rename = "u")]
    pub last_update_id: i64,
    /// The orders below the current price.
    #[serde(rename = "b")]
    pub bids: Vec<DepthElement>,
    /// The orders above the current price.
    #[serde(rename = "a")]
    pub asks: Vec<DepthElement>,
}