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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
* 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};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct OrderFillDto {
/// Id of the fill
#[serde(rename = "id")]
pub id: uuid::Uuid,
/// Id of the order (from the context of the specified subaccount)
#[serde(rename = "orderId")]
pub order_id: uuid::Uuid,
/// A subaccount scoped unique client-generated order id (either a UUID or alphanumeric string up to 32 characters)
#[serde(rename = "clientOrderId", skip_serializing_if = "Option::is_none")]
pub client_order_id: Option<String>,
/// Fill price in expressed as a decimal (precision: 9)
#[serde(rename = "price")]
pub price: String,
/// Quantity filled in native units expressed as a decimal (precision: 9)
#[serde(rename = "filled")]
pub filled: String,
/// The provided order's type e.g. MARKET or LIMIT
#[serde(rename = "type")]
pub r#type: Type,
#[serde(rename = "side")]
pub side: models::OrderSide,
/// Indicates if the fill is reduce only
#[serde(rename = "reduceOnly")]
pub reduce_only: bool,
/// The provided subaccount's charged fee in USD expressed as a decimal (precision: 9)
#[serde(rename = "feeUsd")]
pub fee_usd: String,
/// Indicates if the fill was a maker or taker
#[serde(rename = "isMaker")]
pub is_maker: bool,
/// Id of product the order fill was made against
#[serde(rename = "productId")]
pub product_id: uuid::Uuid,
/// Id of the subaccount associated to order fill
#[serde(rename = "subaccountId")]
pub subaccount_id: String,
/// Fill creation timestamp (ms since Unix Epoch)
#[serde(rename = "createdAt")]
pub created_at: f64,
}
impl OrderFillDto {
pub fn new(
id: uuid::Uuid,
order_id: uuid::Uuid,
price: String,
filled: String,
r#type: Type,
side: models::OrderSide,
reduce_only: bool,
fee_usd: String,
is_maker: bool,
product_id: uuid::Uuid,
subaccount_id: String,
created_at: f64,
) -> OrderFillDto {
OrderFillDto {
id,
order_id,
client_order_id: None,
price,
filled,
r#type,
side,
reduce_only,
fee_usd,
is_maker,
product_id,
subaccount_id,
created_at,
}
}
}
/// The provided order's type e.g. MARKET or LIMIT
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "MARKET")]
Market,
#[serde(rename = "LIMIT")]
Limit,
}
impl Default for Type {
fn default() -> Type {
Self::Market
}
}