Skip to main content

longbridge/fund/
requests.rs

1//! Request option builders for the fund endpoints.
2//!
3//! The fund identifier is exposed as `counter_id` (e.g. `UT/FD/HK0000384492`).
4//! Because it contains `/` it cannot live in the URL path, so endpoints that
5//! target a single fund take `counter_id` as a separate method argument and
6//! send it as the `counter_id` query parameter; these option structs only carry
7//! the remaining query-string / request-body fields.
8
9use serde::Serialize;
10use serde_json::Value;
11
12/// Options for the fund list ([`FundContext::funds`]).
13///
14/// [`FundContext::funds`]: crate::fund::FundContext::funds
15#[derive(Debug, Default, Clone, Serialize)]
16pub struct GetFundsOptions {
17    /// Server-defined filter object
18    #[serde(skip_serializing_if = "Option::is_none")]
19    filter: Option<Value>,
20    /// Quick-filter ids
21    #[serde(skip_serializing_if = "Vec::is_empty")]
22    quick_ids: Vec<i64>,
23    /// Earning-rate time intervals
24    #[serde(skip_serializing_if = "Vec::is_empty")]
25    time_interval: Vec<String>,
26}
27
28impl GetFundsOptions {
29    /// Create a new [`GetFundsOptions`]
30    #[inline]
31    #[must_use]
32    pub fn new() -> Self {
33        Self::default()
34    }
35
36    /// Set the filter object
37    #[inline]
38    #[must_use]
39    pub fn filter(self, filter: Value) -> Self {
40        Self {
41            filter: Some(filter),
42            ..self
43        }
44    }
45
46    /// Set the quick-filter ids
47    #[inline]
48    #[must_use]
49    pub fn quick_ids<I>(self, quick_ids: I) -> Self
50    where
51        I: IntoIterator<Item = i64>,
52    {
53        Self {
54            quick_ids: quick_ids.into_iter().collect(),
55            ..self
56        }
57    }
58
59    /// Set the earning-rate time intervals
60    #[inline]
61    #[must_use]
62    pub fn time_interval<I, T>(self, time_interval: I) -> Self
63    where
64        I: IntoIterator<Item = T>,
65        T: Into<String>,
66    {
67        Self {
68            time_interval: time_interval.into_iter().map(Into::into).collect(),
69            ..self
70        }
71    }
72}
73
74/// Options for the fund analysis / trend / comparison endpoints.
75#[derive(Debug, Default, Clone, Serialize)]
76pub struct GetFundAnalysisOptions {
77    /// Analysis period
78    #[serde(skip_serializing_if = "Option::is_none")]
79    period: Option<i32>,
80}
81
82impl GetFundAnalysisOptions {
83    /// Create a new [`GetFundAnalysisOptions`]
84    #[inline]
85    #[must_use]
86    pub fn new() -> Self {
87        Self::default()
88    }
89
90    /// Set the analysis period
91    #[inline]
92    #[must_use]
93    pub fn period(mut self, period: i32) -> Self {
94        self.period = Some(period);
95        self
96    }
97}
98
99/// Paging options (page / size).
100#[derive(Debug, Default, Clone, Serialize)]
101pub struct FundPageOptions {
102    /// Page number
103    #[serde(skip_serializing_if = "Option::is_none")]
104    page: Option<i32>,
105    /// Page size
106    #[serde(skip_serializing_if = "Option::is_none")]
107    size: Option<i32>,
108}
109
110impl FundPageOptions {
111    /// Create a new [`FundPageOptions`]
112    #[inline]
113    #[must_use]
114    pub fn new() -> Self {
115        Self::default()
116    }
117
118    /// Set the page number
119    #[inline]
120    #[must_use]
121    pub fn page(self, page: i32) -> Self {
122        Self {
123            page: Some(page),
124            ..self
125        }
126    }
127
128    /// Set the page size
129    #[inline]
130    #[must_use]
131    pub fn size(self, size: i32) -> Self {
132        Self {
133            size: Some(size),
134            ..self
135        }
136    }
137}
138
139/// Net-value range options (relative months / years before now).
140#[derive(Debug, Default, Clone, Serialize)]
141pub struct FundNavRangeOptions {
142    /// Number of months before now
143    #[serde(skip_serializing_if = "Option::is_none")]
144    month_before: Option<i32>,
145    /// Number of years before now
146    #[serde(skip_serializing_if = "Option::is_none")]
147    year_before: Option<i32>,
148}
149
150impl FundNavRangeOptions {
151    /// Create a new [`FundNavRangeOptions`]
152    #[inline]
153    #[must_use]
154    pub fn new() -> Self {
155        Self::default()
156    }
157
158    /// Set the number of months before now
159    #[inline]
160    #[must_use]
161    pub fn month_before(self, month_before: i32) -> Self {
162        Self {
163            month_before: Some(month_before),
164            ..self
165        }
166    }
167
168    /// Set the number of years before now
169    #[inline]
170    #[must_use]
171    pub fn year_before(self, year_before: i32) -> Self {
172        Self {
173            year_before: Some(year_before),
174            ..self
175        }
176    }
177}
178
179/// Options for the fund holdings endpoint.
180#[derive(Debug, Default, Clone, Serialize)]
181pub struct GetFundHoldingsOptions {
182    /// Scene
183    #[serde(skip_serializing_if = "Option::is_none")]
184    scene: Option<i32>,
185}
186
187impl GetFundHoldingsOptions {
188    /// Create a new [`GetFundHoldingsOptions`]
189    #[inline]
190    #[must_use]
191    pub fn new() -> Self {
192        Self::default()
193    }
194
195    /// Set the scene
196    #[inline]
197    #[must_use]
198    pub fn scene(mut self, scene: i32) -> Self {
199        self.scene = Some(scene);
200        self
201    }
202}
203
204/// Options for the fund stock-holdings (reverse) endpoint.
205#[derive(Debug, Default, Clone, Serialize)]
206pub struct GetFundStockHoldingsOptions {
207    /// Maximum number of stocks to return
208    #[serde(skip_serializing_if = "Option::is_none")]
209    limit: Option<i32>,
210}
211
212impl GetFundStockHoldingsOptions {
213    /// Create a new [`GetFundStockHoldingsOptions`]
214    #[inline]
215    #[must_use]
216    pub fn new() -> Self {
217        Self::default()
218    }
219
220    /// Set the maximum number of stocks to return
221    #[inline]
222    #[must_use]
223    pub fn limit(mut self, limit: i32) -> Self {
224        self.limit = Some(limit);
225        self
226    }
227}
228
229/// Options for the fund positions overview endpoint.
230#[derive(Debug, Default, Clone, Serialize)]
231pub struct GetFundPositionsOptions {
232    /// Account channel
233    #[serde(skip_serializing_if = "Option::is_none")]
234    account_channel: Option<String>,
235    /// Account id
236    #[serde(skip_serializing_if = "Option::is_none")]
237    aaid: Option<i64>,
238}
239
240impl GetFundPositionsOptions {
241    /// Create a new [`GetFundPositionsOptions`]
242    #[inline]
243    #[must_use]
244    pub fn new() -> Self {
245        Self::default()
246    }
247
248    /// Set the account channel
249    #[inline]
250    #[must_use]
251    pub fn account_channel(self, account_channel: impl Into<String>) -> Self {
252        Self {
253            account_channel: Some(account_channel.into()),
254            ..self
255        }
256    }
257
258    /// Set the account id
259    #[inline]
260    #[must_use]
261    pub fn aaid(self, aaid: i64) -> Self {
262        Self {
263            aaid: Some(aaid),
264            ..self
265        }
266    }
267}
268
269/// Options for a single fund position detail.
270#[derive(Debug, Default, Clone, Serialize)]
271pub struct GetFundPositionOptions {
272    /// Account channel
273    #[serde(skip_serializing_if = "Option::is_none")]
274    account_channel: Option<String>,
275    /// Account id
276    #[serde(skip_serializing_if = "Option::is_none")]
277    aaid: Option<i64>,
278    /// Range start
279    #[serde(skip_serializing_if = "Option::is_none")]
280    start: Option<String>,
281    /// Range end
282    #[serde(skip_serializing_if = "Option::is_none")]
283    end: Option<String>,
284}
285
286impl GetFundPositionOptions {
287    /// Create a new [`GetFundPositionOptions`]
288    #[inline]
289    #[must_use]
290    pub fn new() -> Self {
291        Self::default()
292    }
293
294    /// Set the account channel
295    #[inline]
296    #[must_use]
297    pub fn account_channel(self, account_channel: impl Into<String>) -> Self {
298        Self {
299            account_channel: Some(account_channel.into()),
300            ..self
301        }
302    }
303
304    /// Set the account id
305    #[inline]
306    #[must_use]
307    pub fn aaid(self, aaid: i64) -> Self {
308        Self {
309            aaid: Some(aaid),
310            ..self
311        }
312    }
313
314    /// Set the range start
315    #[inline]
316    #[must_use]
317    pub fn start(self, start: impl Into<String>) -> Self {
318        Self {
319            start: Some(start.into()),
320            ..self
321        }
322    }
323
324    /// Set the range end
325    #[inline]
326    #[must_use]
327    pub fn end(self, end: impl Into<String>) -> Self {
328        Self {
329            end: Some(end.into()),
330            ..self
331        }
332    }
333}
334
335/// Options for a single fund position cumulative-profit list.
336#[derive(Debug, Default, Clone, Serialize)]
337pub struct GetFundPositionProfitsOptions {
338    /// Account channel
339    #[serde(skip_serializing_if = "Option::is_none")]
340    account_channel: Option<String>,
341    /// Account id
342    #[serde(skip_serializing_if = "Option::is_none")]
343    aaid: Option<i64>,
344    /// Range start
345    #[serde(skip_serializing_if = "Option::is_none")]
346    start: Option<String>,
347    /// Range end
348    #[serde(skip_serializing_if = "Option::is_none")]
349    end: Option<String>,
350    /// Page number
351    #[serde(skip_serializing_if = "Option::is_none")]
352    page: Option<i32>,
353    /// Page size
354    #[serde(skip_serializing_if = "Option::is_none")]
355    size: Option<i32>,
356}
357
358impl GetFundPositionProfitsOptions {
359    /// Create a new [`GetFundPositionProfitsOptions`]
360    #[inline]
361    #[must_use]
362    pub fn new() -> Self {
363        Self::default()
364    }
365
366    /// Set the account channel
367    #[inline]
368    #[must_use]
369    pub fn account_channel(self, account_channel: impl Into<String>) -> Self {
370        Self {
371            account_channel: Some(account_channel.into()),
372            ..self
373        }
374    }
375
376    /// Set the account id
377    #[inline]
378    #[must_use]
379    pub fn aaid(self, aaid: i64) -> Self {
380        Self {
381            aaid: Some(aaid),
382            ..self
383        }
384    }
385
386    /// Set the range start
387    #[inline]
388    #[must_use]
389    pub fn start(self, start: impl Into<String>) -> Self {
390        Self {
391            start: Some(start.into()),
392            ..self
393        }
394    }
395
396    /// Set the range end
397    #[inline]
398    #[must_use]
399    pub fn end(self, end: impl Into<String>) -> Self {
400        Self {
401            end: Some(end.into()),
402            ..self
403        }
404    }
405
406    /// Set the page number
407    #[inline]
408    #[must_use]
409    pub fn page(self, page: i32) -> Self {
410        Self {
411            page: Some(page),
412            ..self
413        }
414    }
415
416    /// Set the page size
417    #[inline]
418    #[must_use]
419    pub fn size(self, size: i32) -> Self {
420        Self {
421            size: Some(size),
422            ..self
423        }
424    }
425}
426
427/// Options for a single fund position dividend list.
428#[derive(Debug, Default, Clone, Serialize)]
429pub struct GetFundPositionDividendsOptions {
430    /// Account channel
431    #[serde(skip_serializing_if = "Option::is_none")]
432    account_channel: Option<String>,
433    /// Account id
434    #[serde(skip_serializing_if = "Option::is_none")]
435    aaid: Option<i64>,
436    /// Currency
437    #[serde(skip_serializing_if = "Option::is_none")]
438    currency: Option<String>,
439    /// Range start (unix seconds)
440    #[serde(skip_serializing_if = "Option::is_none")]
441    start: Option<i64>,
442    /// Range end (unix seconds)
443    #[serde(skip_serializing_if = "Option::is_none")]
444    end: Option<i64>,
445    /// Page number
446    #[serde(skip_serializing_if = "Option::is_none")]
447    page: Option<i32>,
448    /// Page size
449    #[serde(skip_serializing_if = "Option::is_none")]
450    size: Option<i32>,
451}
452
453impl GetFundPositionDividendsOptions {
454    /// Create a new [`GetFundPositionDividendsOptions`]
455    #[inline]
456    #[must_use]
457    pub fn new() -> Self {
458        Self::default()
459    }
460
461    /// Set the account channel
462    #[inline]
463    #[must_use]
464    pub fn account_channel(self, account_channel: impl Into<String>) -> Self {
465        Self {
466            account_channel: Some(account_channel.into()),
467            ..self
468        }
469    }
470
471    /// Set the account id
472    #[inline]
473    #[must_use]
474    pub fn aaid(self, aaid: i64) -> Self {
475        Self {
476            aaid: Some(aaid),
477            ..self
478        }
479    }
480
481    /// Set the currency
482    #[inline]
483    #[must_use]
484    pub fn currency(self, currency: impl Into<String>) -> Self {
485        Self {
486            currency: Some(currency.into()),
487            ..self
488        }
489    }
490
491    /// Set the range start (unix seconds)
492    #[inline]
493    #[must_use]
494    pub fn start(self, start: i64) -> Self {
495        Self {
496            start: Some(start),
497            ..self
498        }
499    }
500
501    /// Set the range end (unix seconds)
502    #[inline]
503    #[must_use]
504    pub fn end(self, end: i64) -> Self {
505        Self {
506            end: Some(end),
507            ..self
508        }
509    }
510
511    /// Set the page number
512    #[inline]
513    #[must_use]
514    pub fn page(self, page: i32) -> Self {
515        Self {
516            page: Some(page),
517            ..self
518        }
519    }
520
521    /// Set the page size
522    #[inline]
523    #[must_use]
524    pub fn size(self, size: i32) -> Self {
525        Self {
526            size: Some(size),
527            ..self
528        }
529    }
530}
531
532/// Options for the fund orders list.
533#[derive(Debug, Default, Clone, Serialize)]
534pub struct GetFundOrdersOptions {
535    /// Filter by fund counter ids
536    #[serde(rename = "counter_id", skip_serializing_if = "Vec::is_empty")]
537    counter_ids: Vec<String>,
538    /// Filter by actions (comma-separated)
539    #[serde(skip_serializing_if = "Option::is_none")]
540    actions: Option<String>,
541    /// Filter by states (comma-separated)
542    #[serde(skip_serializing_if = "Option::is_none")]
543    states: Option<String>,
544    /// Filter by currency
545    #[serde(skip_serializing_if = "Option::is_none")]
546    currency: Option<String>,
547    /// Range start (unix seconds)
548    #[serde(skip_serializing_if = "Option::is_none")]
549    start: Option<i64>,
550    /// Range end (unix seconds)
551    #[serde(skip_serializing_if = "Option::is_none")]
552    end: Option<i64>,
553    /// Page number
554    #[serde(skip_serializing_if = "Option::is_none")]
555    page: Option<i32>,
556    /// Page size
557    #[serde(skip_serializing_if = "Option::is_none")]
558    size: Option<i32>,
559}
560
561impl GetFundOrdersOptions {
562    /// Create a new [`GetFundOrdersOptions`]
563    #[inline]
564    #[must_use]
565    pub fn new() -> Self {
566        Self::default()
567    }
568
569    /// Filter by fund counter ids
570    #[inline]
571    #[must_use]
572    pub fn counter_ids<I, T>(self, counter_ids: I) -> Self
573    where
574        I: IntoIterator<Item = T>,
575        T: Into<String>,
576    {
577        Self {
578            counter_ids: counter_ids.into_iter().map(Into::into).collect(),
579            ..self
580        }
581    }
582
583    /// Filter by actions
584    #[inline]
585    #[must_use]
586    pub fn actions(self, actions: impl Into<String>) -> Self {
587        Self {
588            actions: Some(actions.into()),
589            ..self
590        }
591    }
592
593    /// Filter by states
594    #[inline]
595    #[must_use]
596    pub fn states(self, states: impl Into<String>) -> Self {
597        Self {
598            states: Some(states.into()),
599            ..self
600        }
601    }
602
603    /// Filter by currency
604    #[inline]
605    #[must_use]
606    pub fn currency(self, currency: impl Into<String>) -> Self {
607        Self {
608            currency: Some(currency.into()),
609            ..self
610        }
611    }
612
613    /// Set the range start (unix seconds)
614    #[inline]
615    #[must_use]
616    pub fn start(self, start: i64) -> Self {
617        Self {
618            start: Some(start),
619            ..self
620        }
621    }
622
623    /// Set the range end (unix seconds)
624    #[inline]
625    #[must_use]
626    pub fn end(self, end: i64) -> Self {
627        Self {
628            end: Some(end),
629            ..self
630        }
631    }
632
633    /// Set the page number
634    #[inline]
635    #[must_use]
636    pub fn page(self, page: i32) -> Self {
637        Self {
638            page: Some(page),
639            ..self
640        }
641    }
642
643    /// Set the page size
644    #[inline]
645    #[must_use]
646    pub fn size(self, size: i32) -> Self {
647        Self {
648            size: Some(size),
649            ..self
650        }
651    }
652}
653
654/// Options for the fund transactions (cash-flow) list.
655#[derive(Debug, Default, Clone, Serialize)]
656pub struct GetFundTransactionsOptions {
657    /// Account channel
658    #[serde(skip_serializing_if = "Option::is_none")]
659    account_channel: Option<String>,
660    /// Business type
661    #[serde(skip_serializing_if = "Option::is_none")]
662    business_type: Option<String>,
663    /// Category
664    #[serde(skip_serializing_if = "Option::is_none")]
665    category: Option<String>,
666    /// Currencies (comma-separated)
667    #[serde(skip_serializing_if = "Option::is_none")]
668    currencies: Option<String>,
669    /// Range start (unix seconds)
670    #[serde(skip_serializing_if = "Option::is_none")]
671    start: Option<i64>,
672    /// Range end (unix seconds)
673    #[serde(skip_serializing_if = "Option::is_none")]
674    end: Option<i64>,
675    /// Page number
676    #[serde(skip_serializing_if = "Option::is_none")]
677    page: Option<i32>,
678    /// Page size
679    #[serde(skip_serializing_if = "Option::is_none")]
680    size: Option<i32>,
681}
682
683impl GetFundTransactionsOptions {
684    /// Create a new [`GetFundTransactionsOptions`]
685    #[inline]
686    #[must_use]
687    pub fn new() -> Self {
688        Self::default()
689    }
690
691    /// Set the account channel
692    #[inline]
693    #[must_use]
694    pub fn account_channel(self, account_channel: impl Into<String>) -> Self {
695        Self {
696            account_channel: Some(account_channel.into()),
697            ..self
698        }
699    }
700
701    /// Set the business type
702    #[inline]
703    #[must_use]
704    pub fn business_type(self, business_type: impl Into<String>) -> Self {
705        Self {
706            business_type: Some(business_type.into()),
707            ..self
708        }
709    }
710
711    /// Set the category
712    #[inline]
713    #[must_use]
714    pub fn category(self, category: impl Into<String>) -> Self {
715        Self {
716            category: Some(category.into()),
717            ..self
718        }
719    }
720
721    /// Set the currencies
722    #[inline]
723    #[must_use]
724    pub fn currencies(self, currencies: impl Into<String>) -> Self {
725        Self {
726            currencies: Some(currencies.into()),
727            ..self
728        }
729    }
730
731    /// Set the range start (unix seconds)
732    #[inline]
733    #[must_use]
734    pub fn start(self, start: i64) -> Self {
735        Self {
736            start: Some(start),
737            ..self
738        }
739    }
740
741    /// Set the range end (unix seconds)
742    #[inline]
743    #[must_use]
744    pub fn end(self, end: i64) -> Self {
745        Self {
746            end: Some(end),
747            ..self
748        }
749    }
750
751    /// Set the page number
752    #[inline]
753    #[must_use]
754    pub fn page(self, page: i32) -> Self {
755        Self {
756            page: Some(page),
757            ..self
758        }
759    }
760
761    /// Set the page size
762    #[inline]
763    #[must_use]
764    pub fn size(self, size: i32) -> Self {
765        Self {
766            size: Some(size),
767            ..self
768        }
769    }
770}
771
772/// Options for validating a fund order.
773#[derive(Debug, Clone, Serialize)]
774pub struct ValidateFundOrderOptions {
775    /// Fund counter id
776    counter_id: String,
777    /// Action (buy/sell)
778    action: String,
779    /// Currency
780    currency: String,
781    /// Amount (for amount-based orders)
782    #[serde(skip_serializing_if = "Option::is_none")]
783    amount: Option<String>,
784    /// Units (for unit-based orders)
785    #[serde(skip_serializing_if = "Option::is_none")]
786    units: Option<String>,
787    /// Dividend option
788    #[serde(skip_serializing_if = "Option::is_none")]
789    dividend_option: Option<i32>,
790    /// Fund source
791    #[serde(skip_serializing_if = "Option::is_none")]
792    fund_source: Option<i32>,
793    /// Account channel
794    #[serde(skip_serializing_if = "Option::is_none")]
795    account_channel: Option<String>,
796}
797
798impl ValidateFundOrderOptions {
799    /// Create a new [`ValidateFundOrderOptions`]
800    #[inline]
801    #[must_use]
802    pub fn new(
803        counter_id: impl Into<String>,
804        action: impl Into<String>,
805        currency: impl Into<String>,
806    ) -> Self {
807        Self {
808            counter_id: counter_id.into(),
809            action: action.into(),
810            currency: currency.into(),
811            amount: None,
812            units: None,
813            dividend_option: None,
814            fund_source: None,
815            account_channel: None,
816        }
817    }
818
819    /// Set the amount
820    #[inline]
821    #[must_use]
822    pub fn amount(self, amount: impl Into<String>) -> Self {
823        Self {
824            amount: Some(amount.into()),
825            ..self
826        }
827    }
828
829    /// Set the units
830    #[inline]
831    #[must_use]
832    pub fn units(self, units: impl Into<String>) -> Self {
833        Self {
834            units: Some(units.into()),
835            ..self
836        }
837    }
838
839    /// Set the dividend option
840    #[inline]
841    #[must_use]
842    pub fn dividend_option(self, dividend_option: i32) -> Self {
843        Self {
844            dividend_option: Some(dividend_option),
845            ..self
846        }
847    }
848
849    /// Set the fund source
850    #[inline]
851    #[must_use]
852    pub fn fund_source(self, fund_source: i32) -> Self {
853        Self {
854            fund_source: Some(fund_source),
855            ..self
856        }
857    }
858
859    /// Set the account channel
860    #[inline]
861    #[must_use]
862    pub fn account_channel(self, account_channel: impl Into<String>) -> Self {
863        Self {
864            account_channel: Some(account_channel.into()),
865            ..self
866        }
867    }
868}
869
870/// Options for submitting a fund order.
871#[derive(Debug, Clone, Serialize)]
872pub struct SubmitFundOrderOptions {
873    /// Fund counter id
874    counter_id: String,
875    /// Action (buy/sell)
876    action: String,
877    /// Currency
878    currency: String,
879    /// Amount (for amount-based orders)
880    #[serde(skip_serializing_if = "Option::is_none")]
881    amount: Option<String>,
882    /// Units (for unit-based orders)
883    #[serde(skip_serializing_if = "Option::is_none")]
884    units: Option<String>,
885    /// Dividend option
886    #[serde(skip_serializing_if = "Option::is_none")]
887    dividend_option: Option<i32>,
888    /// Fee
889    #[serde(skip_serializing_if = "Option::is_none")]
890    fee: Option<String>,
891    /// Whether to sell all
892    #[serde(skip_serializing_if = "Option::is_none")]
893    is_sell_all: Option<bool>,
894    /// Remark
895    #[serde(skip_serializing_if = "Option::is_none")]
896    remark: Option<String>,
897    /// Trade method
898    #[serde(skip_serializing_if = "Option::is_none")]
899    trade_method: Option<i32>,
900}
901
902impl SubmitFundOrderOptions {
903    /// Create a new [`SubmitFundOrderOptions`]
904    #[inline]
905    #[must_use]
906    pub fn new(
907        counter_id: impl Into<String>,
908        action: impl Into<String>,
909        currency: impl Into<String>,
910    ) -> Self {
911        Self {
912            counter_id: counter_id.into(),
913            action: action.into(),
914            currency: currency.into(),
915            amount: None,
916            units: None,
917            dividend_option: None,
918            fee: None,
919            is_sell_all: None,
920            remark: None,
921            trade_method: None,
922        }
923    }
924
925    /// Set the amount
926    #[inline]
927    #[must_use]
928    pub fn amount(self, amount: impl Into<String>) -> Self {
929        Self {
930            amount: Some(amount.into()),
931            ..self
932        }
933    }
934
935    /// Set the units
936    #[inline]
937    #[must_use]
938    pub fn units(self, units: impl Into<String>) -> Self {
939        Self {
940            units: Some(units.into()),
941            ..self
942        }
943    }
944
945    /// Set the dividend option
946    #[inline]
947    #[must_use]
948    pub fn dividend_option(self, dividend_option: i32) -> Self {
949        Self {
950            dividend_option: Some(dividend_option),
951            ..self
952        }
953    }
954
955    /// Set the fee
956    #[inline]
957    #[must_use]
958    pub fn fee(self, fee: impl Into<String>) -> Self {
959        Self {
960            fee: Some(fee.into()),
961            ..self
962        }
963    }
964
965    /// Set whether to sell all
966    #[inline]
967    #[must_use]
968    pub fn is_sell_all(self, is_sell_all: bool) -> Self {
969        Self {
970            is_sell_all: Some(is_sell_all),
971            ..self
972        }
973    }
974
975    /// Set the remark
976    #[inline]
977    #[must_use]
978    pub fn remark(self, remark: impl Into<String>) -> Self {
979        Self {
980            remark: Some(remark.into()),
981            ..self
982        }
983    }
984
985    /// Set the trade method
986    #[inline]
987    #[must_use]
988    pub fn trade_method(self, trade_method: i32) -> Self {
989        Self {
990            trade_method: Some(trade_method),
991            ..self
992        }
993    }
994}