Skip to main content

rust_okx/api/trade/responses/
algo.rs

1use crate::model::NumberString;
2use serde::Deserialize;
3
4/// Result row returned by algo-order mutation endpoints.
5#[derive(Debug, Clone, Deserialize)]
6#[serde(rename_all = "camelCase")]
7#[non_exhaustive]
8pub struct AlgoOrderResult {
9    /// Value returned by OKX in the `algoId` field.
10    #[serde(default)]
11    pub algo_id: String,
12    /// Value returned by OKX in the `algoClOrdId` field.
13    #[serde(default)]
14    pub algo_cl_ord_id: String,
15    /// Value returned by OKX in the `sCode` field.
16    #[serde(default)]
17    pub s_code: String,
18    /// Value returned by OKX in the `sMsg` field.
19    #[serde(default)]
20    pub s_msg: String,
21}
22
23/// Algo-order row returned by list, history, and details endpoints.
24#[derive(Debug, Clone, Deserialize)]
25#[serde(rename_all = "camelCase")]
26#[non_exhaustive]
27pub struct AlgoOrder {
28    /// Value returned by OKX in the `algoId` field.
29    #[serde(default)]
30    pub algo_id: String,
31    /// Value returned by OKX in the `algoClOrdId` field.
32    #[serde(default)]
33    pub algo_cl_ord_id: String,
34    /// Value returned by OKX in the `instType` field.
35    #[serde(default)]
36    pub inst_type: String,
37    /// Value returned by OKX in the `instId` field.
38    #[serde(default)]
39    pub inst_id: String,
40    /// Value returned by OKX in the `tdMode` field.
41    #[serde(default)]
42    pub td_mode: String,
43    /// Value returned by OKX in the `side` field.
44    #[serde(default)]
45    pub side: String,
46    /// Value returned by OKX in the `posSide` field.
47    #[serde(default)]
48    pub pos_side: String,
49    /// Value returned by OKX in the `ordType` field.
50    #[serde(default)]
51    pub ord_type: String,
52    /// Value returned by OKX in the `state` field.
53    #[serde(default)]
54    pub state: String,
55    /// Value returned by OKX in the `sz` field.
56    #[serde(default)]
57    pub sz: NumberString,
58    /// Value returned by OKX in the `actualSz` field.
59    #[serde(default)]
60    pub actual_sz: NumberString,
61    /// Value returned by OKX in the `actualPx` field.
62    #[serde(default)]
63    pub actual_px: NumberString,
64    /// Value returned by OKX in the `triggerPx` field.
65    #[serde(default)]
66    pub trigger_px: NumberString,
67    /// Value returned by OKX in the `orderPx` field.
68    #[serde(default)]
69    pub order_px: NumberString,
70    /// Value returned by OKX in the `triggerPxType` field.
71    #[serde(default)]
72    pub trigger_px_type: String,
73    /// Value returned by OKX in the `tpTriggerPx` field.
74    #[serde(default)]
75    pub tp_trigger_px: NumberString,
76    /// Value returned by OKX in the `tpOrdPx` field.
77    #[serde(default)]
78    pub tp_ord_px: NumberString,
79    /// Value returned by OKX in the `slTriggerPx` field.
80    #[serde(default)]
81    pub sl_trigger_px: NumberString,
82    /// Value returned by OKX in the `slOrdPx` field.
83    #[serde(default)]
84    pub sl_ord_px: NumberString,
85    /// Value returned by OKX in the `callbackRatio` field.
86    #[serde(default)]
87    pub callback_ratio: NumberString,
88    /// Value returned by OKX in the `callbackSpread` field.
89    #[serde(default)]
90    pub callback_spread: NumberString,
91    /// Value returned by OKX in the `activePx` field.
92    #[serde(default)]
93    pub active_px: NumberString,
94    /// Value returned by OKX in the `tag` field.
95    #[serde(default)]
96    pub tag: String,
97    /// Value returned by OKX in the `cTime` field.
98    #[serde(default)]
99    pub c_time: NumberString,
100    /// Value returned by OKX in the `uTime` field.
101    #[serde(default)]
102    pub u_time: NumberString,
103}