longbridge/trade/requests/
get_all_executions.rs1use serde::Serialize;
2use time::OffsetDateTime;
3
4use crate::serde_utils;
5
6#[derive(Debug, Serialize, Default, Clone)]
8pub struct GetAllExecutionsOptions {
9 #[serde(skip_serializing_if = "Option::is_none")]
10 symbol: Option<String>,
11 #[serde(skip_serializing_if = "Option::is_none")]
12 order_id: Option<String>,
13 #[serde(
14 skip_serializing_if = "Option::is_none",
15 with = "serde_utils::timestamp_opt"
16 )]
17 start_at: Option<OffsetDateTime>,
18 #[serde(
19 skip_serializing_if = "Option::is_none",
20 with = "serde_utils::timestamp_opt"
21 )]
22 end_at: Option<OffsetDateTime>,
23 #[serde(skip_serializing_if = "Option::is_none")]
24 page: Option<u64>,
25}
26
27impl GetAllExecutionsOptions {
28 #[inline]
30 pub fn new() -> Self {
31 Default::default()
32 }
33
34 #[inline]
36 #[must_use]
37 pub fn symbol(self, symbol: impl Into<String>) -> Self {
38 Self {
39 symbol: Some(symbol.into()),
40 ..self
41 }
42 }
43
44 #[inline]
46 #[must_use]
47 pub fn order_id(self, order_id: impl Into<String>) -> Self {
48 Self {
49 order_id: Some(order_id.into()),
50 ..self
51 }
52 }
53
54 #[inline]
56 #[must_use]
57 pub fn start_at(self, start_at: OffsetDateTime) -> Self {
58 Self {
59 start_at: Some(start_at),
60 ..self
61 }
62 }
63
64 #[inline]
66 #[must_use]
67 pub fn end_at(self, end_at: OffsetDateTime) -> Self {
68 Self {
69 end_at: Some(end_at),
70 ..self
71 }
72 }
73
74 #[inline]
76 #[must_use]
77 pub fn page(self, page: u64) -> Self {
78 Self {
79 page: Some(page),
80 ..self
81 }
82 }
83}