Skip to main content

longport/trade/requests/
get_today_executions.rs

1use serde::Serialize;
2
3use crate::types::normalize_symbol_owned;
4
5/// Options for get today executions request
6#[derive(Debug, Default, Serialize, Clone)]
7pub struct GetTodayExecutionsOptions {
8    #[serde(skip_serializing_if = "Option::is_none")]
9    symbol: Option<String>,
10    #[serde(skip_serializing_if = "Option::is_none")]
11    order_id: Option<String>,
12}
13
14impl GetTodayExecutionsOptions {
15    /// Create a new `GetTodayExecutionsOptions`
16    #[inline]
17    pub fn new() -> Self {
18        Default::default()
19    }
20
21    /// Set the security symbol
22    #[inline]
23    #[must_use]
24    pub fn symbol(self, symbol: impl Into<String>) -> Self {
25        Self {
26            symbol: Some(normalize_symbol_owned(symbol)),
27            ..self
28        }
29    }
30
31    /// Set the order id
32    #[inline]
33    #[must_use]
34    pub fn order_id(self, order_id: impl Into<String>) -> Self {
35        Self {
36            order_id: Some(order_id.into()),
37            ..self
38        }
39    }
40}