longport/trade/requests/
get_stock_positions.rs
1use serde::Serialize;
2
3#[derive(Debug, Serialize, Default)]
5pub struct GetStockPositionsOptions {
6 #[serde(skip_serializing_if = "<[_]>::is_empty", rename = "symbol")]
7 symbols: Vec<String>,
8}
9
10impl GetStockPositionsOptions {
11 #[inline]
13 pub fn new() -> Self {
14 Default::default()
15 }
16
17 #[inline]
19 #[must_use]
20 pub fn symbols<I, T>(self, symbols: I) -> Self
21 where
22 I: IntoIterator<Item = T>,
23 T: Into<String>,
24 {
25 Self {
26 symbols: symbols.into_iter().map(Into::into).collect(),
27 }
28 }
29}