Skip to main content

openlimits_coinbase/model/websocket/
change.rs

1use rust_decimal::prelude::Decimal;
2use serde::Deserialize;
3use super::OrderSide;
4use super::shared::string_to_decimal;
5use super::shared::string_to_opt_decimal;
6
7#[derive(Deserialize, Debug, Clone, PartialEq)]
8pub struct Change {
9    pub time: String,
10    pub sequence: usize,
11    pub order_id: String,
12    pub product_id: String,
13    #[serde(with = "string_to_decimal")]
14    pub new_size: Decimal,
15    #[serde(with = "string_to_decimal")]
16    pub old_size: Decimal,
17    #[serde(default)]
18    #[serde(with = "string_to_opt_decimal")]
19    pub new_funds: Option<Decimal>,
20    #[serde(default)]
21    #[serde(with = "string_to_opt_decimal")]
22    pub old_funds: Option<Decimal>,
23    #[serde(default)]
24    #[serde(with = "string_to_opt_decimal")]
25    pub price: Option<Decimal>,
26    pub side: OrderSide,
27    pub user_id: Option<String>,
28    #[serde(default)]
29    pub profile_id: Option<String>,
30}