rust_okx/api/finance/requests/
common.rs1use serde::Serialize;
2
3#[derive(Debug, Clone, Default, Serialize)]
5pub struct CurrencyRequest<'a> {
6 #[serde(skip_serializing_if = "Option::is_none")]
8 pub ccy: Option<&'a str>,
9}
10
11#[derive(Debug, Clone, Serialize)]
13pub struct SetLendingRateRequest<'a> {
14 pub ccy: &'a str,
16 pub rate: &'a str,
18}
19
20#[derive(Debug, Clone, Serialize)]
22pub struct AmountRequest<'a> {
23 pub amt: &'a str,
25}
26
27#[derive(Debug, Clone, Serialize)]
29#[serde(rename_all = "camelCase")]
30pub struct CancelRedeemRequest<'a> {
31 pub ord_id: &'a str,
33}
34
35#[derive(Debug, Clone, Serialize)]
37pub struct ApyHistoryRequest<'a> {
38 pub days: &'a str,
40}
41
42#[derive(Debug, Clone, Default, Serialize)]
44pub struct FinanceHistoryRequest {
45 #[serde(skip_serializing_if = "Option::is_none")]
46 ccy: Option<String>,
47 #[serde(skip_serializing_if = "Option::is_none")]
48 after: Option<String>,
49 #[serde(skip_serializing_if = "Option::is_none")]
50 before: Option<String>,
51 #[serde(skip_serializing_if = "Option::is_none")]
52 limit: Option<u32>,
53}
54
55impl FinanceHistoryRequest {
56 pub fn new() -> Self {
58 Self::default()
59 }
60
61 pub fn currency(mut self, ccy: impl Into<String>) -> Self {
63 self.ccy = Some(ccy.into());
64 self
65 }
66
67 pub fn after(mut self, after: impl Into<String>) -> Self {
69 self.after = Some(after.into());
70 self
71 }
72
73 pub fn before(mut self, before: impl Into<String>) -> Self {
75 self.before = Some(before.into());
76 self
77 }
78
79 pub fn limit(mut self, limit: u32) -> Self {
81 self.limit = Some(limit);
82 self
83 }
84}