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
//!
//! The order GET response.
//!

use rust_decimal::Decimal;
use serde_derive::Deserialize;

use crate::data::order::{Side, Status, TimeInForce, Type};

#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Response {
    symbol: String,
    order_id: i64,
    client_order_id: String,
    #[serde(deserialize_with = "crate::data::serde::deserialize_decimal")]
    price: Decimal,
    #[serde(deserialize_with = "crate::data::serde::deserialize_decimal")]
    orig_qty: Decimal,
    #[serde(deserialize_with = "crate::data::serde::deserialize_decimal")]
    executed_qty: Decimal,
    #[serde(deserialize_with = "crate::data::serde::deserialize_decimal")]
    cummulative_quote_qty: Decimal,
    status: Status,
    time_in_force: TimeInForce,
    r#type: Type,
    side: Side,
    #[serde(deserialize_with = "crate::data::serde::deserialize_decimal")]
    stop_price: Decimal,
    #[serde(deserialize_with = "crate::data::serde::deserialize_decimal")]
    iceberg_qty: Decimal,
    time: i64,
    update_time: i64,
    is_working: bool,
}

impl Response {
    pub fn original_quantity(&self) -> Decimal {
        self.orig_qty
    }

    pub fn executed_quantity(&self) -> Decimal {
        self.executed_qty
    }

    pub fn status(&self) -> Status {
        self.status
    }
}