openlimits_coinbase/model/
book_record_l2.rs

1use serde::Deserialize;
2use serde::Serialize;
3use rust_decimal::prelude::Decimal;
4use super::BookLevel;
5use super::shared::string_to_decimal;
6
7/// This struct represents a level 2 book record
8#[derive(Serialize, Deserialize, Debug, Clone)]
9pub struct BookRecordL2 {
10    #[serde(with = "string_to_decimal")]
11    pub price: Decimal,
12    #[serde(with = "string_to_decimal")]
13    pub size: Decimal,
14    pub num_orders: usize,
15}
16
17impl BookLevel for BookRecordL2 {
18    fn level() -> u8 {
19        2
20    }
21}