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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* Ethereal Exchange API
*
* Ethereal HTTP API for real-time trading, order management, and market data access.
*
* The version of the OpenAPI document: 0.1.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// BookDepthMessage : Server-to-client BookDepth event message. First message is the full book (up to 100 levels per side). Subsequent messages are price-level diffs with absolute quantities. A zero quantity removes that level.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct BookDepthMessage {
/// System timestamp in milliseconds when this BookDepth was emitted.
#[serde(rename = "timestamp")]
pub timestamp: i64,
/// Timestamp in ms of the previous BookDepth event for this product.
#[serde(rename = "previousTimestamp")]
pub previous_timestamp: i64,
/// Identifier of the product.
#[serde(rename = "productId")]
pub product_id: uuid::Uuid,
/// Array of ask levels as [price, quantity] string tuples.
#[serde(rename = "asks")]
pub asks: Vec<Vec<String>>,
/// Array of bid levels as [price, quantity] string tuples.
#[serde(rename = "bids")]
pub bids: Vec<Vec<String>>,
}
impl BookDepthMessage {
/// Server-to-client BookDepth event message. First message is the full book (up to 100 levels per side). Subsequent messages are price-level diffs with absolute quantities. A zero quantity removes that level.
pub fn new(
timestamp: i64,
previous_timestamp: i64,
product_id: uuid::Uuid,
asks: Vec<Vec<String>>,
bids: Vec<Vec<String>>,
) -> BookDepthMessage {
BookDepthMessage {
timestamp,
previous_timestamp,
product_id,
asks,
bids,
}
}
}