longport/trade/requests/
get_fund_positions.rs

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
use serde::Serialize;

/// Options for get fund positions request
#[derive(Debug, Serialize, Default)]
pub struct GetFundPositionsOptions {
    #[serde(skip_serializing_if = "<[_]>::is_empty", rename = "symbol")]
    symbols: Vec<String>,
}

impl GetFundPositionsOptions {
    /// Create a new `GetFundPositionsOptions`
    #[inline]
    pub fn new() -> Self {
        Default::default()
    }

    /// Set the fund symbols
    #[inline]
    #[must_use]
    pub fn symbols<I, T>(self, symbols: I) -> Self
    where
        I: IntoIterator<Item = T>,
        T: Into<String>,
    {
        Self {
            symbols: symbols.into_iter().map(Into::into).collect(),
        }
    }
}