okx-client 0.1.2

Async Rust client for the OKX exchange API v5
Documentation
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
use serde::Deserialize;

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct LoanCurrencyData {
    pub ccy: String,
    pub amt: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct RiskWarningData {
    pub inst_id: String,
    pub liq_px: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct FlexibleLoanInfo {
    pub ord_id: Option<String>,
    pub loan_notional_usd: String,
    pub loan_data: Vec<LoanCurrencyData>,
    pub collateral_notional_usd: String,
    pub collateral_data: Vec<LoanCurrencyData>,
    pub risk_warning_data: RiskWarningData,
    pub cur_ltv: String,
    pub margin_call_ltv: String,
    pub liq_ltv: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct DcdCurrencyPair {
    pub base_ccy: String,
    pub quote_ccy: String,
    pub opt_type: String,
    pub uly: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct DcdProduct {
    pub abs_yield: String,
    pub annualized_yield: String,
    pub base_ccy: String,
    pub quote_ccy: String,
    pub exp_time: String,
    pub interest_accrual_time: String,
    pub list_time: String,
    pub max_size: String,
    pub min_size: String,
    pub notional_ccy: String,
    pub opt_type: String,
    pub product_id: String,
    pub quote_time: String,
    pub redeem_end_time: String,
    pub redeem_start_time: String,
    pub step_sz: String,
    pub trade_end_time: String,
    pub strike: String,
    pub uly: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct DcdQuote {
    pub abs_yield: String,
    pub annualized_yield: String,
    pub interest_accrual_time: String,
    pub notional_sz: String,
    pub notional_ccy: String,
    pub product_id: String,
    pub quote_id: String,
    pub valid_until: String,
    pub idx_px: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct DcdTradeResult {
    pub quote_id: String,
    pub ord_id: String,
    pub state: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct DcdRedeemQuote {
    pub ord_id: String,
    pub quote_id: String,
    pub redeem_ccy: String,
    pub redeem_sz: String,
    pub term_rate: String,
    pub valid_until: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct DcdRedeemResult {
    pub ord_id: String,
    pub state: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct DcdOrderStatus {
    pub ord_id: String,
    pub state: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct DcdOrderHistoryItem {
    pub ord_id: String,
    pub quote_id: String,
    pub state: String,
    pub product_id: String,
    pub base_ccy: String,
    pub quote_ccy: String,
    pub uly: String,
    pub strike: String,
    pub notional_sz: String,
    pub notional_ccy: String,
    pub abs_yield: String,
    pub annualized_yield: String,
    pub yield_sz: String,
    pub yield_ccy: String,
    pub settle_sz: String,
    pub settle_ccy: String,
    pub settle_px: String,
    pub settle_time: String,
    pub exp_time: String,
    pub redeem_start_time: String,
    pub redeem_end_time: String,
    pub c_time: String,
    pub u_time: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct StableRewardsProductInfoDetail {
    pub ccy: String,
    pub settle_ccy: String,
    pub sub_fee_rate: String,
    pub redempt_fee_rate: String,
    pub min_sub_amt: String,
    pub min_redeem_amt: String,
    pub remaining_sub_quota: String,
    pub remaining_redempt_quota: String,
    pub can_redeem: bool,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct StableRewardsProductInfo {
    pub details: Vec<StableRewardsProductInfoDetail>,
    pub ts: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct StableRewardsQuote {
    pub quote_id: String,
    pub quote_amt: String,
    pub quote_ccy: String,
    pub exch_rate: String,
    pub fee_rate: String,
    pub quote_time: String,
    pub ttl_ms: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct StableRewardsTradeResult {
    pub quote_id: String,
    pub ord_id: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct StableRewardsBalanceDetail {
    pub ccy: String,
    pub amt: String,
    pub total_earn_accrual: String,
    pub state: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct StableRewardsBalance {
    pub details: Vec<StableRewardsBalanceDetail>,
    pub ts: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct StableRewardsApyHistoryItem {
    pub rate: String,
    pub ts: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct StableRewardsSubscribeRedeemHistoryItem {
    #[serde(rename = "type")]
    pub type_: String,
    pub status: String,
    pub ccy: String,
    pub settle_ccy: String,
    pub ccy_amt: String,
    pub settle_ccy_amt: String,
    pub fee: String,
    pub quote_id: String,
    pub ord_id: String,
    pub ts: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct OkusdLimitBucket {
    pub personal_daily_limit: String,
    pub personal_used_amt: String,
    pub platform_daily_limit: String,
    pub platform_used_amt: String,
    pub fee_rate: Option<String>,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct OkusdSubscribeLimit {
    pub personal_daily_limit: String,
    pub personal_used_amt: String,
    pub platform_daily_limit: String,
    pub platform_used_amt: String,
    pub fee_rate: Option<String>,
    pub max_sub_amt: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct OkusdLimits {
    pub sub_limit: OkusdSubscribeLimit,
    pub fast_redeem_limit: OkusdLimitBucket,
    pub std_redeem_limit: OkusdLimitBucket,
    pub ts: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct OkusdSubscribeResult {
    pub ord_id: String,
    pub cl_ord_id: String,
    pub ccy: String,
    pub amt: String,
    pub okusd_amt: String,
    pub state: String,
    pub ts: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct OkusdRedeemResult {
    pub ord_id: String,
    pub cl_ord_id: String,
    pub ccy: String,
    pub amt: String,
    pub fee: String,
    pub usdt_amt: String,
    pub redeem_type: String,
    pub state: String,
    pub est_settlement_time: String,
    pub ts: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct EthStakingProductInfo {
    pub fast_redemption_daily_limit: String,
    pub rate: String,
    pub redempt_days: String,
    pub min_amt: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct SolStakingProductInfo {
    pub fast_redemption_avail: String,
    pub fast_redemption_daily_limit: String,
    pub rate: String,
    pub redempt_days: String,
    pub min_amt: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct EthStakingCancelRedeemResult {
    pub ord_id: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct GlpMakerTaker {
    pub maker: String,
    pub taker: String,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct GlpVolumeBuckets {
    pub type_a: Option<GlpMakerTaker>,
    pub type_b_total: Option<GlpMakerTaker>,
    pub tradfi_x2: Option<GlpMakerTaker>,
    pub total: GlpMakerTaker,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct GlpShareBuckets {
    pub type_a: Option<GlpMakerTaker>,
    pub type_b_adj: Option<GlpMakerTaker>,
    pub total: GlpMakerTaker,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct GlpDailyMetrics {
    pub volume: GlpVolumeBuckets,
    pub share: GlpShareBuckets,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct GlpMtdMetrics {
    pub volume: GlpVolumeBuckets,
    pub share: GlpShareBuckets,
    pub mtd_status: String,
    pub qualifying_share: GlpMakerTaker,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct GlpProgramPerformance {
    pub program: String,
    pub market_maker_business_id: String,
    pub enrollment_status: String,
    pub market_maker_level_id: String,
    pub enrolled_tier_display: String,
    pub qualifying_pool: String,
    pub qualifying_rows: Vec<String>,
    pub daily: GlpDailyMetrics,
    pub mtd: GlpMtdMetrics,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct GlpAccount {
    pub master_account_id: String,
    pub combined_account_ids: Vec<String>,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct GlpTodayPerformance {
    pub data_ready: bool,
    pub data_date: String,
    pub account: GlpAccount,
    pub programs: Vec<GlpProgramPerformance>,
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct GlpHistoricalPerformanceItem {
    pub date: String,
    pub volume: GlpVolumeBuckets,
    pub share: GlpShareBuckets,
}