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