openlimits_coinbase/model/
order.rs

1use serde::Deserialize;
2use serde::Serialize;
3use chrono::naive::NaiveDateTime;
4use rust_decimal::prelude::Decimal;
5use super::OrderSide;
6use super::OrderType;
7use super::OrderStatus;
8use super::OrderStop;
9use super::shared::string_to_decimal;
10use super::shared::naive_datetime_from_string;
11
12/// This struct represents an order
13#[derive(Serialize, Deserialize, Debug, Clone)]
14pub struct Order {
15    pub id: String,
16    pub product_id: String,
17    pub side: OrderSide,
18    pub stp: Option<String>,
19    #[serde(flatten)]
20    pub _type: OrderType,
21    pub post_only: bool,
22    #[serde(with = "naive_datetime_from_string")]
23    pub created_at: NaiveDateTime,
24    #[serde(with = "string_to_decimal")]
25    pub fill_fees: Decimal,
26    #[serde(with = "string_to_decimal")]
27    pub filled_size: Decimal,
28    #[serde(with = "string_to_decimal")]
29    pub executed_value: Decimal,
30    pub status: OrderStatus,
31    pub settled: bool,
32    #[serde(flatten)]
33    pub stop: Option<OrderStop>,
34}