rust_okx/api/finance/requests/
common.rs1use serde::Serialize;
2
3#[derive(Debug, Clone, Default, Serialize)]
5pub struct FinanceHistoryRequest {
6 #[serde(skip_serializing_if = "Option::is_none")]
7 ccy: Option<String>,
8 #[serde(skip_serializing_if = "Option::is_none")]
9 after: Option<String>,
10 #[serde(skip_serializing_if = "Option::is_none")]
11 before: Option<String>,
12 #[serde(skip_serializing_if = "Option::is_none")]
13 limit: Option<u32>,
14}
15
16impl FinanceHistoryRequest {
17 pub fn new() -> Self {
19 Self::default()
20 }
21
22 pub fn currency(mut self, ccy: impl Into<String>) -> Self {
24 self.ccy = Some(ccy.into());
25 self
26 }
27
28 pub fn after(mut self, after: impl Into<String>) -> Self {
30 self.after = Some(after.into());
31 self
32 }
33
34 pub fn before(mut self, before: impl Into<String>) -> Self {
36 self.before = Some(before.into());
37 self
38 }
39
40 pub fn limit(mut self, limit: u32) -> Self {
42 self.limit = Some(limit);
43 self
44 }
45}