1use serde::Serialize;
10use serde_json::Value;
11
12#[derive(Debug, Default, Clone, Serialize)]
16pub struct GetFundsOptions {
17 #[serde(skip_serializing_if = "Option::is_none")]
19 filter: Option<Value>,
20 #[serde(skip_serializing_if = "Vec::is_empty")]
22 quick_ids: Vec<i64>,
23 #[serde(skip_serializing_if = "Vec::is_empty")]
25 time_interval: Vec<String>,
26}
27
28impl GetFundsOptions {
29 #[inline]
31 #[must_use]
32 pub fn new() -> Self {
33 Self::default()
34 }
35
36 #[inline]
38 #[must_use]
39 pub fn filter(self, filter: Value) -> Self {
40 Self {
41 filter: Some(filter),
42 ..self
43 }
44 }
45
46 #[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 #[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#[derive(Debug, Default, Clone, Serialize)]
76pub struct GetFundAnalysisOptions {
77 #[serde(skip_serializing_if = "Option::is_none")]
79 period: Option<i32>,
80}
81
82impl GetFundAnalysisOptions {
83 #[inline]
85 #[must_use]
86 pub fn new() -> Self {
87 Self::default()
88 }
89
90 #[inline]
92 #[must_use]
93 pub fn period(mut self, period: i32) -> Self {
94 self.period = Some(period);
95 self
96 }
97}
98
99#[derive(Debug, Default, Clone, Serialize)]
101pub struct FundPageOptions {
102 #[serde(skip_serializing_if = "Option::is_none")]
104 page: Option<i32>,
105 #[serde(skip_serializing_if = "Option::is_none")]
107 size: Option<i32>,
108}
109
110impl FundPageOptions {
111 #[inline]
113 #[must_use]
114 pub fn new() -> Self {
115 Self::default()
116 }
117
118 #[inline]
120 #[must_use]
121 pub fn page(self, page: i32) -> Self {
122 Self {
123 page: Some(page),
124 ..self
125 }
126 }
127
128 #[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#[derive(Debug, Default, Clone, Serialize)]
141pub struct FundNavRangeOptions {
142 #[serde(skip_serializing_if = "Option::is_none")]
144 month_before: Option<i32>,
145 #[serde(skip_serializing_if = "Option::is_none")]
147 year_before: Option<i32>,
148}
149
150impl FundNavRangeOptions {
151 #[inline]
153 #[must_use]
154 pub fn new() -> Self {
155 Self::default()
156 }
157
158 #[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 #[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#[derive(Debug, Default, Clone, Serialize)]
181pub struct GetFundHoldingsOptions {
182 #[serde(skip_serializing_if = "Option::is_none")]
184 scene: Option<i32>,
185}
186
187impl GetFundHoldingsOptions {
188 #[inline]
190 #[must_use]
191 pub fn new() -> Self {
192 Self::default()
193 }
194
195 #[inline]
197 #[must_use]
198 pub fn scene(mut self, scene: i32) -> Self {
199 self.scene = Some(scene);
200 self
201 }
202}
203
204#[derive(Debug, Default, Clone, Serialize)]
206pub struct GetFundStockHoldingsOptions {
207 #[serde(skip_serializing_if = "Option::is_none")]
209 limit: Option<i32>,
210}
211
212impl GetFundStockHoldingsOptions {
213 #[inline]
215 #[must_use]
216 pub fn new() -> Self {
217 Self::default()
218 }
219
220 #[inline]
222 #[must_use]
223 pub fn limit(mut self, limit: i32) -> Self {
224 self.limit = Some(limit);
225 self
226 }
227}
228
229#[derive(Debug, Default, Clone, Serialize)]
231pub struct GetFundPositionsOptions {
232 #[serde(skip_serializing_if = "Option::is_none")]
234 account_channel: Option<String>,
235 #[serde(skip_serializing_if = "Option::is_none")]
237 aaid: Option<i64>,
238}
239
240impl GetFundPositionsOptions {
241 #[inline]
243 #[must_use]
244 pub fn new() -> Self {
245 Self::default()
246 }
247
248 #[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 #[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#[derive(Debug, Default, Clone, Serialize)]
271pub struct GetFundPositionOptions {
272 #[serde(skip_serializing_if = "Option::is_none")]
274 account_channel: Option<String>,
275 #[serde(skip_serializing_if = "Option::is_none")]
277 aaid: Option<i64>,
278 #[serde(skip_serializing_if = "Option::is_none")]
280 start: Option<String>,
281 #[serde(skip_serializing_if = "Option::is_none")]
283 end: Option<String>,
284}
285
286impl GetFundPositionOptions {
287 #[inline]
289 #[must_use]
290 pub fn new() -> Self {
291 Self::default()
292 }
293
294 #[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 #[inline]
306 #[must_use]
307 pub fn aaid(self, aaid: i64) -> Self {
308 Self {
309 aaid: Some(aaid),
310 ..self
311 }
312 }
313
314 #[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 #[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#[derive(Debug, Default, Clone, Serialize)]
337pub struct GetFundPositionProfitsOptions {
338 #[serde(skip_serializing_if = "Option::is_none")]
340 account_channel: Option<String>,
341 #[serde(skip_serializing_if = "Option::is_none")]
343 aaid: Option<i64>,
344 #[serde(skip_serializing_if = "Option::is_none")]
346 start: Option<String>,
347 #[serde(skip_serializing_if = "Option::is_none")]
349 end: Option<String>,
350 #[serde(skip_serializing_if = "Option::is_none")]
352 page: Option<i32>,
353 #[serde(skip_serializing_if = "Option::is_none")]
355 size: Option<i32>,
356}
357
358impl GetFundPositionProfitsOptions {
359 #[inline]
361 #[must_use]
362 pub fn new() -> Self {
363 Self::default()
364 }
365
366 #[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 #[inline]
378 #[must_use]
379 pub fn aaid(self, aaid: i64) -> Self {
380 Self {
381 aaid: Some(aaid),
382 ..self
383 }
384 }
385
386 #[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 #[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 #[inline]
408 #[must_use]
409 pub fn page(self, page: i32) -> Self {
410 Self {
411 page: Some(page),
412 ..self
413 }
414 }
415
416 #[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#[derive(Debug, Default, Clone, Serialize)]
429pub struct GetFundPositionDividendsOptions {
430 #[serde(skip_serializing_if = "Option::is_none")]
432 account_channel: Option<String>,
433 #[serde(skip_serializing_if = "Option::is_none")]
435 aaid: Option<i64>,
436 #[serde(skip_serializing_if = "Option::is_none")]
438 currency: Option<String>,
439 #[serde(skip_serializing_if = "Option::is_none")]
441 start: Option<i64>,
442 #[serde(skip_serializing_if = "Option::is_none")]
444 end: Option<i64>,
445 #[serde(skip_serializing_if = "Option::is_none")]
447 page: Option<i32>,
448 #[serde(skip_serializing_if = "Option::is_none")]
450 size: Option<i32>,
451}
452
453impl GetFundPositionDividendsOptions {
454 #[inline]
456 #[must_use]
457 pub fn new() -> Self {
458 Self::default()
459 }
460
461 #[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 #[inline]
473 #[must_use]
474 pub fn aaid(self, aaid: i64) -> Self {
475 Self {
476 aaid: Some(aaid),
477 ..self
478 }
479 }
480
481 #[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 #[inline]
493 #[must_use]
494 pub fn start(self, start: i64) -> Self {
495 Self {
496 start: Some(start),
497 ..self
498 }
499 }
500
501 #[inline]
503 #[must_use]
504 pub fn end(self, end: i64) -> Self {
505 Self {
506 end: Some(end),
507 ..self
508 }
509 }
510
511 #[inline]
513 #[must_use]
514 pub fn page(self, page: i32) -> Self {
515 Self {
516 page: Some(page),
517 ..self
518 }
519 }
520
521 #[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#[derive(Debug, Default, Clone, Serialize)]
534pub struct GetFundOrdersOptions {
535 #[serde(rename = "counter_id", skip_serializing_if = "Vec::is_empty")]
537 counter_ids: Vec<String>,
538 #[serde(skip_serializing_if = "Option::is_none")]
540 actions: Option<String>,
541 #[serde(skip_serializing_if = "Option::is_none")]
543 states: Option<String>,
544 #[serde(skip_serializing_if = "Option::is_none")]
546 currency: Option<String>,
547 #[serde(skip_serializing_if = "Option::is_none")]
549 start: Option<i64>,
550 #[serde(skip_serializing_if = "Option::is_none")]
552 end: Option<i64>,
553 #[serde(skip_serializing_if = "Option::is_none")]
555 page: Option<i32>,
556 #[serde(skip_serializing_if = "Option::is_none")]
558 size: Option<i32>,
559}
560
561impl GetFundOrdersOptions {
562 #[inline]
564 #[must_use]
565 pub fn new() -> Self {
566 Self::default()
567 }
568
569 #[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 #[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 #[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 #[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 #[inline]
615 #[must_use]
616 pub fn start(self, start: i64) -> Self {
617 Self {
618 start: Some(start),
619 ..self
620 }
621 }
622
623 #[inline]
625 #[must_use]
626 pub fn end(self, end: i64) -> Self {
627 Self {
628 end: Some(end),
629 ..self
630 }
631 }
632
633 #[inline]
635 #[must_use]
636 pub fn page(self, page: i32) -> Self {
637 Self {
638 page: Some(page),
639 ..self
640 }
641 }
642
643 #[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#[derive(Debug, Default, Clone, Serialize)]
656pub struct GetFundTransactionsOptions {
657 #[serde(skip_serializing_if = "Option::is_none")]
659 account_channel: Option<String>,
660 #[serde(skip_serializing_if = "Option::is_none")]
662 business_type: Option<String>,
663 #[serde(skip_serializing_if = "Option::is_none")]
665 category: Option<String>,
666 #[serde(skip_serializing_if = "Option::is_none")]
668 currencies: Option<String>,
669 #[serde(skip_serializing_if = "Option::is_none")]
671 start: Option<i64>,
672 #[serde(skip_serializing_if = "Option::is_none")]
674 end: Option<i64>,
675 #[serde(skip_serializing_if = "Option::is_none")]
677 page: Option<i32>,
678 #[serde(skip_serializing_if = "Option::is_none")]
680 size: Option<i32>,
681}
682
683impl GetFundTransactionsOptions {
684 #[inline]
686 #[must_use]
687 pub fn new() -> Self {
688 Self::default()
689 }
690
691 #[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 #[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 #[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 #[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 #[inline]
733 #[must_use]
734 pub fn start(self, start: i64) -> Self {
735 Self {
736 start: Some(start),
737 ..self
738 }
739 }
740
741 #[inline]
743 #[must_use]
744 pub fn end(self, end: i64) -> Self {
745 Self {
746 end: Some(end),
747 ..self
748 }
749 }
750
751 #[inline]
753 #[must_use]
754 pub fn page(self, page: i32) -> Self {
755 Self {
756 page: Some(page),
757 ..self
758 }
759 }
760
761 #[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#[derive(Debug, Clone, Serialize)]
774pub struct ValidateFundOrderOptions {
775 counter_id: String,
777 action: String,
779 currency: String,
781 #[serde(skip_serializing_if = "Option::is_none")]
783 amount: Option<String>,
784 #[serde(skip_serializing_if = "Option::is_none")]
786 units: Option<String>,
787 #[serde(skip_serializing_if = "Option::is_none")]
789 dividend_option: Option<i32>,
790 #[serde(skip_serializing_if = "Option::is_none")]
792 fund_source: Option<i32>,
793 #[serde(skip_serializing_if = "Option::is_none")]
795 account_channel: Option<String>,
796}
797
798impl ValidateFundOrderOptions {
799 #[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 #[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 #[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 #[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 #[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 #[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#[derive(Debug, Clone, Serialize)]
872pub struct SubmitFundOrderOptions {
873 counter_id: String,
875 action: String,
877 currency: String,
879 #[serde(skip_serializing_if = "Option::is_none")]
881 amount: Option<String>,
882 #[serde(skip_serializing_if = "Option::is_none")]
884 units: Option<String>,
885 #[serde(skip_serializing_if = "Option::is_none")]
887 dividend_option: Option<i32>,
888 #[serde(skip_serializing_if = "Option::is_none")]
890 fee: Option<String>,
891 #[serde(skip_serializing_if = "Option::is_none")]
893 is_sell_all: Option<bool>,
894 #[serde(skip_serializing_if = "Option::is_none")]
896 remark: Option<String>,
897 #[serde(skip_serializing_if = "Option::is_none")]
899 trade_method: Option<i32>,
900}
901
902impl SubmitFundOrderOptions {
903 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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}