Skip to main content

longbridge/fund/
types.rs

1//! Fund (mutual fund) types.
2//!
3//! Response models for the fund channel OpenAPI endpoints. Numeric fields that
4//! arrive as strings on the wire are kept as [`String`] to preserve the exact
5//! server formatting; unix-second/millisecond timestamps are kept as `i64`.
6//! Every struct uses `#[serde(default)]` so missing fields decode to their
7//! default instead of failing.
8
9use serde::{Deserialize, Serialize};
10use serde_json::Value;
11
12use crate::serde_utils;
13
14/// A fund net-asset-value data point (latest / historical).
15#[derive(Debug, Clone, Default, Serialize, Deserialize)]
16#[serde(default)]
17pub struct FundNavValue {
18    /// Net value change
19    pub change: String,
20    /// Net value change percent
21    pub change_percent: String,
22    /// Formatted change percent
23    pub change_percent_format: String,
24    /// Fund counter id
25    pub counter_id: String,
26    /// Fund name
27    pub counter_name: String,
28    /// Currency
29    pub currency: String,
30    /// Formatted date
31    pub date_format: String,
32    /// ISIN
33    pub isin: String,
34    /// Last update time (unix seconds)
35    #[serde(with = "serde_utils::int64_str")]
36    pub last_update_time: i64,
37    /// Net value
38    pub value: String,
39    /// Formatted net value
40    pub value_format: String,
41}
42
43/// A recent performance point used by the hot-fund list.
44#[derive(Debug, Clone, Default, Serialize, Deserialize)]
45#[serde(default)]
46pub struct FundPerformancePoint {
47    /// Date
48    pub date: String,
49    /// Last done value
50    pub last_done: String,
51}
52
53/// A hot-selling fund entry.
54#[derive(Debug, Clone, Default, Serialize, Deserialize)]
55#[serde(default)]
56pub struct HotFund {
57    /// Asset class
58    pub asset_class: i32,
59    /// Asset class name
60    pub asset_class_name: String,
61    /// Fund counter id
62    pub counter_id: String,
63    /// Currency
64    pub currency: String,
65    /// Earning rate
66    pub earning_rate: String,
67    /// Recent performance points
68    pub fund_performances: Vec<FundPerformancePoint>,
69    /// Fund name
70    pub name: String,
71    /// Minimum purchase amount
72    pub purchase_amount: String,
73    /// Recommendation text
74    pub recommendation_text: String,
75    /// Risk level
76    pub risk_level: i32,
77    /// Risk level name
78    pub risk_level_name: String,
79    /// Time interval of the earning rate
80    pub time_interval: String,
81}
82
83/// A fund entry in the fund list.
84#[derive(Debug, Clone, Default, Serialize, Deserialize)]
85#[serde(default)]
86pub struct FundBrief {
87    /// Asset class
88    pub asset_class: i32,
89    /// Asset class name
90    pub asset_class_name: String,
91    /// Fund code
92    pub code: String,
93    /// Fund counter id
94    pub counter_id: String,
95    /// Currency
96    pub currency: String,
97    /// Description
98    pub description: String,
99    /// Earning rate
100    pub earning_rate: String,
101    /// Whether the user is holding this fund
102    pub holding: bool,
103    /// ISIN
104    pub isin: String,
105    /// Fund name
106    pub name: String,
107    /// Product
108    pub product: String,
109    /// Minimum purchase amount
110    pub purchase_amount: String,
111    /// Recommendation text
112    pub recommendation_text: String,
113    /// Risk level
114    pub risk_level: i32,
115    /// Risk level name
116    pub risk_level_name: String,
117    /// Time interval of the earning rate
118    pub time_interval: String,
119    /// Unit value
120    pub unit_value: String,
121}
122
123/// Fund list filter options. Each list holds server-defined option objects.
124#[derive(Debug, Clone, Default, Serialize, Deserialize)]
125#[serde(default)]
126pub struct FundFilters {
127    /// Asset class options
128    pub asset_class: Vec<Value>,
129    /// Company options
130    pub company: Vec<Value>,
131    /// Currency options
132    pub currency: Vec<Value>,
133    /// Industry category options
134    pub industry_category_name: Vec<Value>,
135    /// Risk level options
136    pub risk_level: Vec<Value>,
137}
138
139/// A single holding entry inside a fund's asset allocation.
140#[derive(Debug, Clone, Default, Serialize, Deserialize)]
141#[serde(default)]
142pub struct FundAssetAllocationItem {
143    /// Security code
144    pub code: String,
145    /// Security counter id
146    pub counter_id: String,
147    /// Name
148    pub name: String,
149    /// Position ratio
150    pub position_ratio: String,
151}
152
153/// A fund's asset allocation.
154#[derive(Debug, Clone, Default, Serialize, Deserialize)]
155#[serde(default)]
156pub struct FundAssetAllocation {
157    /// Asset type
158    pub asset_type: i32,
159    /// Allocation entries
160    pub lists: Vec<FundAssetAllocationItem>,
161    /// Report date
162    pub report_date: String,
163}
164
165/// Fund detail.
166#[derive(Debug, Clone, Default, Serialize, Deserialize)]
167#[serde(default)]
168pub struct FundDetail {
169    /// Additional purchase amount
170    pub additional_purchase_amount: String,
171    /// Affirm day
172    pub affirm_day: i32,
173    /// Amount affirm day
174    pub amount_affirm_day: String,
175    /// Asset allocation
176    #[serde(default)]
177    pub asset_allocation: Option<FundAssetAllocation>,
178    /// Asset class
179    pub asset_class: i32,
180    /// Asset class name
181    pub asset_class_name: String,
182    /// Bill purchase rate
183    pub bill_purchase_rate: String,
184    /// Channel
185    pub channel: String,
186    /// Close period
187    pub close_period: String,
188    /// Fund code
189    pub code: String,
190    /// Currency
191    pub currency: String,
192    /// Cut off time
193    pub cut_off_time: String,
194    /// Whether it is a derivative
195    pub derivatives: bool,
196    /// Done day
197    pub done_day: i32,
198    /// Excess return fee
199    pub excess_return_fee: String,
200    /// GST rate
201    pub gst_rate: String,
202    /// Introduction
203    pub introduce: String,
204    /// Whether it is a cash-plus fund
205    pub is_cash_plus: bool,
206    /// Whether it is a complex product
207    pub is_complex: bool,
208    /// Whether it is a new cash-plus fund
209    pub is_new_cash_plus: bool,
210    /// Whether it is a Yinghebao fund
211    pub is_yinghebao: bool,
212    /// ISIN
213    pub isin: String,
214    /// Management rate
215    pub manage_rate: String,
216    /// Manager
217    pub manager: String,
218    /// Minimum holding cash
219    pub min_hold_cash: String,
220    /// Minimum holding share
221    pub min_hold_share: String,
222    /// Minimum sell share
223    pub min_sell_share: String,
224    /// Month raise day
225    pub month_raise_day: String,
226    /// Fund name
227    pub name: String,
228    /// Net value deadline
229    pub nav_deadline: String,
230    /// Whether it is no-load
231    pub no_load: bool,
232    /// Open date
233    pub open_date: String,
234    /// Open period
235    pub open_period: String,
236    /// Product
237    pub product: String,
238    /// Product information locals
239    pub product_information_locals: String,
240    /// Profile
241    pub profile: String,
242    /// Whether purchasable
243    pub purchasable: i32,
244    /// Purchase affirm day
245    pub purchase_affirm_day: String,
246    /// Minimum purchase amount
247    pub purchase_amount: String,
248    /// Purchase rate
249    pub purchase_rate: String,
250    /// Rating
251    pub rating: i32,
252    /// Whether redeemable
253    pub redeemable: i32,
254    /// Redemption advance day
255    pub redemption_advance_day: String,
256    /// Redemption amount
257    pub redemption_amount: String,
258    /// Redemption close period text
259    pub redemption_close_period_shows: String,
260    /// Redemption done day
261    pub redemption_done_day: String,
262    /// Redemption open day text
263    pub redemption_open_day_shows: String,
264    /// Risk level
265    pub risk_level: i32,
266    /// Risk level name
267    pub risk_level_name: String,
268    /// Verify status
269    pub verify_status: i32,
270    /// Whether it is a virtual currency fund
271    pub virtual_currency: bool,
272    /// Year to date yield
273    pub year_to_date_yield: String,
274    /// Year to date yield type
275    pub ytd_yield_type: i32,
276}
277
278/// Fund analysis (level 1).
279#[derive(Debug, Clone, Default, Serialize, Deserialize)]
280#[serde(default)]
281pub struct FundAnalysis {
282    /// Actual period
283    pub actual_period: i32,
284    /// Cost level (server-defined structure)
285    pub cost_level: Value,
286    /// Return ability (server-defined structure)
287    pub return_ability: Value,
288    /// Risk ability (server-defined structure)
289    pub risk_ability: Value,
290    /// Updated at
291    pub updated_at: String,
292    /// Value for money (server-defined structure)
293    pub value_for_money: Value,
294    /// Whether visible
295    pub visible: bool,
296}
297
298/// Fund analysis detail (level 2).
299#[derive(Debug, Clone, Default, Serialize, Deserialize)]
300#[serde(default)]
301pub struct FundAnalysisDetail {
302    /// Actual period
303    pub actual_period: i32,
304    /// Available periods
305    pub available_periods: Vec<i32>,
306    /// Cost level (server-defined structure)
307    pub cost_level: Value,
308    /// Return ability (server-defined structure)
309    pub return_ability: Value,
310    /// Risk ability (server-defined structure)
311    pub risk_ability: Value,
312    /// Updated at
313    pub updated_at: String,
314    /// Value for money (server-defined structure)
315    pub value_for_money: Value,
316    /// Whether visible
317    pub visible: bool,
318}
319
320/// A benchmark contrast series in a fund trend chart.
321#[derive(Debug, Clone, Default, Serialize, Deserialize)]
322#[serde(default)]
323pub struct FundTrendContrast {
324    /// Benchmark name
325    pub benchmark_name: String,
326    /// Performance points (server-defined structure)
327    pub performances: Vec<Value>,
328}
329
330/// Fund trend chart.
331#[derive(Debug, Clone, Default, Serialize, Deserialize)]
332#[serde(default)]
333pub struct FundTrend {
334    /// Actual period
335    pub actual_period: i32,
336    /// Available periods
337    pub available_periods: Vec<i32>,
338    /// Category average performances (server-defined structure)
339    pub category_average_performances: Vec<Value>,
340    /// Benchmark contrast performances
341    #[serde(default)]
342    pub contrast_performances: Option<FundTrendContrast>,
343    /// Fund performances (server-defined structure)
344    pub fund_performances: Vec<Value>,
345}
346
347/// A named contrast performance series.
348#[derive(Debug, Clone, Default, Serialize, Deserialize)]
349#[serde(default)]
350pub struct FundNamedContrast {
351    /// Series name
352    pub name: String,
353    /// Performance points (server-defined structure)
354    pub performances: Vec<Value>,
355}
356
357/// Fund performance comparison.
358#[derive(Debug, Clone, Default, Serialize, Deserialize)]
359#[serde(default)]
360pub struct FundPerformanceComparison {
361    /// Contrast performance series
362    pub contrast_performances: Vec<FundNamedContrast>,
363    /// Fund performances (server-defined structure)
364    pub fund_performances: Vec<Value>,
365}
366
367/// A fund annual return entry.
368#[derive(Debug, Clone, Default, Serialize, Deserialize)]
369#[serde(default)]
370pub struct FundAnnualReturn {
371    /// Change percent
372    pub change_percent: String,
373    /// Year
374    pub year: i32,
375}
376
377/// A fund quarterly return entry.
378#[derive(Debug, Clone, Default, Serialize, Deserialize)]
379#[serde(default)]
380pub struct FundQuarterlyReturn {
381    /// Change percent
382    pub change_percent: String,
383    /// Quarter
384    pub quarter: i32,
385    /// Year
386    pub year: i32,
387}
388
389/// A fund's detailed performance figures.
390#[derive(Debug, Clone, Default, Serialize, Deserialize)]
391#[serde(default)]
392pub struct FundPerformance {
393    /// Annualized return (5y)
394    pub annualized_return_five: String,
395    /// Annualized return (1y)
396    pub annualized_return_one: String,
397    /// Annualized return (10y)
398    pub annualized_return_ten: String,
399    /// Annualized return (3y)
400    pub annualized_return_three: String,
401    /// Annualized return (2y)
402    pub annualized_return_two: String,
403    /// Fund counter id
404    pub counter_id: String,
405    /// Fund name
406    pub fund_name: String,
407    /// Rank (5y)
408    pub performance_rank_five_years: i32,
409    /// Rank (1d)
410    pub performance_rank_one_day: i32,
411    /// Rank (1m)
412    pub performance_rank_one_month: i32,
413    /// Rank (1w)
414    pub performance_rank_one_week: i32,
415    /// Rank (1y)
416    pub performance_rank_one_year: i32,
417    /// Rank (6m)
418    pub performance_rank_six_months: i32,
419    /// Rank (10y)
420    pub performance_rank_ten_years: i32,
421    /// Rank (3m)
422    pub performance_rank_three_months: i32,
423    /// Rank (3y)
424    pub performance_rank_three_years: i32,
425    /// Rank (2y)
426    pub performance_rank_two_years: i32,
427    /// Rank (ytd)
428    pub performance_rank_ytd: i32,
429    /// Return (5y)
430    pub performance_return_five_years: String,
431    /// Return (1d)
432    pub performance_return_one_day: String,
433    /// Return (1m)
434    pub performance_return_one_month: String,
435    /// Return (1w)
436    pub performance_return_one_week: String,
437    /// Return (1y)
438    pub performance_return_one_year: String,
439    /// Return (6m)
440    pub performance_return_six_months: String,
441    /// Return (10y)
442    pub performance_return_ten_years: String,
443    /// Return (3m)
444    pub performance_return_three_months: String,
445    /// Return (3y)
446    pub performance_return_three_years: String,
447    /// Return (2y)
448    pub performance_return_two_years: String,
449    /// Return (ytd)
450    pub performance_return_ytd: String,
451    /// Total peers (5y)
452    pub performance_total_five_years: i32,
453    /// Total peers (1d)
454    pub performance_total_one_day: i32,
455    /// Total peers (1m)
456    pub performance_total_one_month: i32,
457    /// Total peers (1w)
458    pub performance_total_one_week: i32,
459    /// Total peers (1y)
460    pub performance_total_one_year: i32,
461    /// Total peers (6m)
462    pub performance_total_six_months: i32,
463    /// Total peers (10y)
464    pub performance_total_ten_years: i32,
465    /// Total peers (3m)
466    pub performance_total_three_months: i32,
467    /// Total peers (3y)
468    pub performance_total_three_years: i32,
469    /// Total peers (2y)
470    pub performance_total_two_years: i32,
471    /// Total peers (ytd)
472    pub performance_total_ytd: i32,
473    /// Seven days annualized
474    pub seven_days_annualized: String,
475    /// Ten thousand price
476    pub ten_thousand_price: String,
477    /// Update time (unix seconds)
478    #[serde(with = "serde_utils::int64_str")]
479    pub update_time: i64,
480}
481
482/// A single fund holding (top-10 holdings).
483#[derive(Debug, Clone, Default, Serialize, Deserialize)]
484#[serde(default)]
485pub struct FundHolding {
486    /// Bond type
487    pub bond_type: String,
488    /// Bond type name
489    pub bond_type_name: String,
490    /// Country name
491    pub country_name: String,
492    /// Holding type
493    pub holding_type: String,
494    /// Industry name
495    pub industry_name: String,
496    /// Market value
497    pub market_value: String,
498    /// Maturity date
499    pub maturity_date: String,
500    /// Name
501    pub name: String,
502    /// Share change
503    pub share_change: String,
504    /// Share change percent
505    pub share_change_percent: String,
506    /// Shares
507    pub shares: String,
508    /// Weighting
509    pub weighting: String,
510}
511
512/// A fund's top-10 holdings.
513#[derive(Debug, Clone, Default, Serialize, Deserialize)]
514#[serde(default)]
515pub struct FundHoldings {
516    /// Holding entries
517    pub holdings: Vec<FundHolding>,
518    /// Report date
519    pub report_date: String,
520    /// Total weighting
521    pub weighting: String,
522}
523
524/// A stock held by the fund (reverse lookup).
525#[derive(Debug, Clone, Default, Serialize, Deserialize)]
526#[serde(default)]
527pub struct FundStockHolding {
528    /// Stock code
529    pub code: String,
530    /// Stock counter id
531    pub counter_id: String,
532    /// Currency
533    pub currency: String,
534    /// Stock name
535    pub name: String,
536    /// Position ratio
537    pub position_ratio: String,
538    /// Report date
539    pub report_date: String,
540}
541
542/// A single fund position held by the user.
543#[derive(Debug, Clone, Default, Serialize, Deserialize)]
544#[serde(default)]
545pub struct FundPosition {
546    /// Holding amount
547    pub amount: String,
548    /// Fund counter id
549    pub counter_id: String,
550    /// Currency
551    pub currency: String,
552    /// Frozen units
553    pub freeze_units: String,
554    /// Holding profit
555    pub holding_profit: String,
556    /// Holding units
557    pub holding_units: String,
558    /// Fund name
559    pub name: String,
560    /// Recent profit
561    pub recent_profit: String,
562    /// Recent trading day (unix seconds)
563    #[serde(with = "serde_utils::int64_str")]
564    pub recent_trading_day: i64,
565    /// Accumulated recent profit
566    pub sum_recent_profit: String,
567}
568
569/// The user's fund positions overview.
570#[derive(Debug, Clone, Default, Serialize, Deserialize)]
571#[serde(default)]
572pub struct FundPositions {
573    /// Account channel
574    pub account_channel: String,
575    /// Position entries
576    pub list: Vec<FundPosition>,
577    /// Pending buy orders amount
578    pub pending_buy_orders: String,
579    /// Recent trading day (unix seconds)
580    #[serde(with = "serde_utils::int64_str")]
581    pub recent_trading_day: i64,
582    /// Sold pending credit orders amount
583    pub sold_pending_credit_orders: String,
584}
585
586/// A dated value point.
587#[derive(Debug, Clone, Default, Serialize, Deserialize)]
588#[serde(default)]
589pub struct FundDatedValue {
590    /// Date (unix seconds)
591    #[serde(with = "serde_utils::int64_str")]
592    pub date: i64,
593    /// Value
594    pub value: String,
595}
596
597/// A fund unit-value point (position view).
598#[derive(Debug, Clone, Default, Serialize, Deserialize)]
599#[serde(default)]
600pub struct FundUnitValue {
601    /// Date (unix seconds)
602    #[serde(with = "serde_utils::int64_str")]
603    pub date: i64,
604    /// Day increase rate
605    pub day_increase_rate: String,
606    /// Total value
607    pub total_value: String,
608    /// Unit value
609    pub unit_value: String,
610}
611
612/// Detail values of a single fund position.
613#[derive(Debug, Clone, Default, Serialize, Deserialize)]
614#[serde(default)]
615pub struct FundPositionDetailValues {
616    /// Amount
617    pub amount: String,
618    /// Currency
619    pub currency: String,
620    /// Holding cost
621    pub holding_cost: String,
622    /// Holding profit
623    pub holding_profit: String,
624    /// Holding profit rate
625    pub holding_profit_rate: String,
626    /// Holding units
627    pub holding_units: String,
628    /// Holding value
629    pub holding_value: String,
630    /// Pending buy value
631    pub pending_buy_value: String,
632    /// Pending sell value
633    pub pending_sell_value: String,
634    /// Accumulated profit (to date)
635    pub profit_amount_accum_td: String,
636    /// Accumulated profit rate (to date)
637    pub profit_amount_accum_td_rate: String,
638    /// Recent profit
639    pub recent_profit: String,
640    /// Recent trading day (unix seconds)
641    #[serde(with = "serde_utils::int64_str")]
642    pub recent_tradingday: i64,
643    /// Recent unit value
644    pub recent_unit_value: String,
645    /// Sold pending-confirm units
646    pub sold_pending_confirm_units: String,
647}
648
649/// Detail of a single fund position.
650#[derive(Debug, Clone, Default, Serialize, Deserialize)]
651#[serde(default)]
652pub struct FundPositionDetail {
653    /// Detail values
654    #[serde(default)]
655    pub detail_values: Option<FundPositionDetailValues>,
656    /// Accumulated profit series
657    pub sum_profit: Vec<FundDatedValue>,
658    /// Unit value series
659    pub ut_value: Vec<FundUnitValue>,
660}
661
662/// Performance figures for a held fund.
663#[derive(Debug, Clone, Default, Serialize, Deserialize)]
664#[serde(default)]
665pub struct FundPositionPerformance {
666    /// Annualized return (5y)
667    pub annualized_return_five: String,
668    /// Annualized return (1y)
669    pub annualized_return_one: String,
670    /// Annualized return (10y)
671    pub annualized_return_ten: String,
672    /// Annualized return (3y)
673    pub annualized_return_three: String,
674    /// Annualized return (2y)
675    pub annualized_return_two: String,
676    /// Fund counter id
677    pub counter_id: String,
678    /// Fund name
679    pub fund_name: String,
680    /// Return (5y)
681    pub performance_return_five_years: String,
682    /// Return (1d)
683    pub performance_return_one_day: String,
684    /// Return (1m)
685    pub performance_return_one_month: String,
686    /// Return (1w)
687    pub performance_return_one_week: String,
688    /// Return (1y)
689    pub performance_return_one_year: String,
690    /// Return (6m)
691    pub performance_return_six_months: String,
692    /// Return (10y)
693    pub performance_return_ten_years: String,
694    /// Return (3m)
695    pub performance_return_three_months: String,
696    /// Return (3y)
697    pub performance_return_three_years: String,
698    /// Return (2y)
699    pub performance_return_two_years: String,
700    /// Return (ytd)
701    pub performance_return_ytd: String,
702    /// Update time (unix seconds)
703    #[serde(with = "serde_utils::int64_str")]
704    pub update_time: i64,
705}
706
707/// The user's cumulative profit for a held fund.
708#[derive(Debug, Clone, Default, Serialize, Deserialize)]
709#[serde(default)]
710pub struct FundPositionProfits {
711    /// Currency
712    pub currency: String,
713    /// Profit series
714    pub history_value: Vec<FundDatedValue>,
715    /// Last update time (unix seconds)
716    #[serde(with = "serde_utils::int64_str")]
717    pub last_update_time: i64,
718    /// Total profit
719    pub sum_profit: String,
720}
721
722/// A held-fund net-value point (position view).
723#[derive(Debug, Clone, Default, Serialize, Deserialize)]
724#[serde(default)]
725pub struct FundPositionNav {
726    /// Net value change
727    pub change: String,
728    /// Net value change percent
729    pub change_percent: String,
730    /// Fund counter id
731    pub counter_id: String,
732    /// Fund name
733    pub counter_name: String,
734    /// Last update time (unix seconds)
735    #[serde(with = "serde_utils::int64_str")]
736    pub last_update_time: i64,
737    /// Net value
738    pub value: String,
739}
740
741/// A cash dividend record for a held fund.
742#[derive(Debug, Clone, Default, Serialize, Deserialize)]
743#[serde(default)]
744pub struct FundDividend {
745    /// Amount
746    pub amount: String,
747    /// Fund counter id
748    pub counter_id: String,
749    /// Currency
750    pub currency: String,
751    /// Date (unix seconds)
752    #[serde(with = "serde_utils::int64_str")]
753    pub date: i64,
754    /// Dividend method
755    pub div_method: String,
756    /// Fund name
757    pub name: String,
758}
759
760/// The user's dividend records for a held fund.
761#[derive(Debug, Clone, Default, Serialize, Deserialize)]
762#[serde(default)]
763pub struct FundDividends {
764    /// Currency
765    pub currency: String,
766    /// Dividend records
767    pub div_cash_infos: Vec<FundDividend>,
768    /// Latest dividend date (unix seconds)
769    #[serde(with = "serde_utils::int64_str")]
770    pub lastest_date: i64,
771    /// Total cash dividend
772    pub total_div_cash: String,
773}
774
775/// A fund order (list view).
776#[derive(Debug, Clone, Default, Serialize, Deserialize)]
777#[serde(default)]
778pub struct FundOrder {
779    /// Action (buy/sell)
780    pub action: String,
781    /// Amount
782    pub amount: String,
783    /// Fund counter id
784    pub counter_id: String,
785    /// Created at (unix seconds)
786    #[serde(with = "serde_utils::int64_str")]
787    pub created_at: i64,
788    /// Currency
789    pub currency: String,
790    /// Fund name
791    pub fund_name: String,
792    /// Order id
793    #[serde(with = "serde_utils::int64_str")]
794    pub id: i64,
795    /// Whether it is an auto (DCA) order
796    pub is_auto: bool,
797    /// Net worth
798    pub net_worth: String,
799    /// Product type
800    pub product_type: String,
801    /// State
802    pub state: String,
803    /// State description
804    pub state_desc: String,
805    /// Units
806    pub units: String,
807}
808
809/// A keyword block in a fund order detail.
810#[derive(Debug, Clone, Default, Serialize, Deserialize)]
811#[serde(default)]
812pub struct FundOrderKeyword {
813    /// Content
814    pub content: String,
815    /// Group
816    pub group: String,
817    /// Key
818    pub key: String,
819    /// Line strategy
820    pub line_strategy: String,
821    /// Title
822    pub title: String,
823}
824
825/// A processing stage in a fund order detail.
826#[derive(Debug, Clone, Default, Serialize, Deserialize)]
827#[serde(default)]
828pub struct FundOrderStage {
829    /// Description
830    pub desc: String,
831    /// Key
832    pub key: String,
833    /// Link
834    pub link: String,
835    /// Link text
836    pub link_text: String,
837    /// Progress
838    pub progress: String,
839    /// Stage
840    pub stage: String,
841}
842
843/// The full information of a fund order.
844#[derive(Debug, Clone, Default, Serialize, Deserialize)]
845#[serde(default)]
846pub struct FundOrderInfo {
847    /// Account id
848    #[serde(with = "serde_utils::int64_str")]
849    pub aaid: i64,
850    /// Account channel
851    pub account_channel: String,
852    /// Action (buy/sell)
853    pub action: String,
854    /// Amount
855    pub amount: String,
856    /// Channel
857    pub channel: String,
858    /// Fund counter id
859    pub counter_id: String,
860    /// Created at (unix seconds)
861    #[serde(with = "serde_utils::int64_str")]
862    pub created_at: i64,
863    /// Currency
864    pub currency: String,
865    /// Dividend option
866    pub dividend_option: String,
867    /// Equity time (unix seconds)
868    #[serde(with = "serde_utils::int64_str")]
869    pub eq_at: i64,
870    /// Fee
871    pub fee: String,
872    /// Fund name
873    pub fund_name: String,
874    /// Fund source
875    pub fund_source: String,
876    /// Histories
877    pub histories: String,
878    /// Order id
879    #[serde(with = "serde_utils::int64_str")]
880    pub id: i64,
881    /// Message
882    pub message: String,
883    /// Net worth
884    pub net_worth: String,
885    /// Price time (unix seconds)
886    #[serde(with = "serde_utils::int64_str")]
887    pub price_at: i64,
888    /// Processed at (unix seconds)
889    #[serde(with = "serde_utils::int64_str")]
890    pub processed_at: i64,
891    /// Product type
892    pub product_type: String,
893    /// Whether repurchaseable
894    pub repurchaseable: bool,
895    /// Sale proceeds
896    pub sale_proceeds: String,
897    /// Sales charge
898    pub sales_charge: String,
899    /// Sales price
900    pub sales_price: String,
901    /// Sales unit
902    pub sales_unit: String,
903    /// State
904    pub state: String,
905    /// State description
906    pub state_desc: String,
907    /// Status
908    pub status: i32,
909    /// Extended status
910    pub status_ex: i32,
911    /// T+ description
912    pub t_description: String,
913    /// Time partition
914    pub time_partition: String,
915    /// Total amount
916    pub total_amount: String,
917    /// Transaction at (unix seconds)
918    #[serde(with = "serde_utils::int64_str")]
919    pub transaction_at: i64,
920    /// Units
921    pub units: String,
922    /// Withdraw at (unix seconds)
923    #[serde(with = "serde_utils::int64_str")]
924    pub withdraw_at: i64,
925    /// Whether withdrawable
926    pub withdrawable: bool,
927}
928
929/// Fund order detail.
930#[derive(Debug, Clone, Default, Serialize, Deserialize)]
931#[serde(default)]
932pub struct FundOrderDetail {
933    /// Keyword blocks
934    pub keywords: Vec<FundOrderKeyword>,
935    /// The order
936    #[serde(default)]
937    pub order: Option<FundOrderInfo>,
938    /// Processing stages
939    pub stages: Vec<FundOrderStage>,
940}
941
942/// A fund transaction / cash-flow record.
943#[derive(Debug, Clone, Default, Serialize, Deserialize)]
944#[serde(default)]
945pub struct FundTransaction {
946    /// Amount
947    pub amount: String,
948    /// Category
949    pub category: String,
950    /// Created at (unix seconds)
951    #[serde(with = "serde_utils::int64_str")]
952    pub created_at: i64,
953    /// Currency
954    pub currency: String,
955    /// Description
956    pub description: String,
957    /// Detail created at (unix seconds)
958    #[serde(with = "serde_utils::int64_str")]
959    pub detail_created_at: i64,
960    /// Detail type
961    pub detail_type: String,
962    /// Done at (unix seconds)
963    #[serde(with = "serde_utils::int64_str")]
964    pub done_at: i64,
965    /// Quantity description
966    pub quantity_description: String,
967    /// Redirect page
968    pub redirect_page: String,
969    /// Redirect page (v2)
970    pub redirect_page_v2: String,
971    /// Reference number
972    pub ref_no: String,
973    /// Stock quantity
974    pub stock_quantity: String,
975    /// Transaction type
976    pub tx_type: String,
977    /// Type name
978    pub type_name: String,
979}
980
981/// The result of validating a fund order.
982#[derive(Debug, Clone, Default, Serialize, Deserialize)]
983#[serde(default)]
984pub struct FundOrderValidation {
985    /// Auth token to carry into submit
986    pub auth_token: String,
987    /// Risk-assessment eval address
988    pub eval_address: String,
989    /// Fund risk level
990    pub fund_risk_level: i32,
991    /// Message
992    pub msg: String,
993    /// User PI status
994    pub user_pi: i32,
995    /// User risk level
996    pub user_risk_level: i32,
997}
998
999/// The result of submitting a fund order.
1000#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1001#[serde(default)]
1002pub struct FundOrderSubmitResponse {
1003    /// Action (buy/sell)
1004    pub action: String,
1005    /// Amount
1006    pub amount: String,
1007    /// Fund counter id
1008    pub counter_id: String,
1009    /// Created at (unix seconds)
1010    #[serde(with = "serde_utils::int64_str")]
1011    pub created_at: i64,
1012    /// Fund name
1013    pub fund_name: String,
1014    /// Order id
1015    #[serde(with = "serde_utils::int64_str")]
1016    pub id: i64,
1017    /// Message
1018    pub msg: String,
1019    /// Status
1020    pub status: i32,
1021    /// Units
1022    pub units: String,
1023}