1pub use futu_core::qot_quote_rights::*;
7
8pub fn profile_from_get_user_info(
9 resp: &futu_proto::get_user_info::Response,
10) -> Result<QuoteRightsProfile, String> {
11 if resp.ret_type != 0 {
12 return Err(format!(
13 "get_user_info ret_type={} msg={}",
14 resp.ret_type,
15 resp.ret_msg.as_deref().unwrap_or("")
16 ));
17 }
18 let s = resp.s2c.as_ref().ok_or_else(|| {
19 format!(
20 "get_user_info ret_type=0 but missing s2c msg={}",
21 resp.ret_msg.as_deref().unwrap_or("")
22 )
23 })?;
24
25 Ok(profile_from_snapshot(QuoteRightsSnapshot {
26 nick_name: s.nick_name.clone(),
27 user_id: s.user_id,
28 user_attribution: s.user_attribution,
29 ret_msg: resp.ret_msg.clone(),
30 sub_quota: s.sub_quota,
31 history_kl_quota: s.history_kl_quota,
32 hk_qot_right: s.hk_qot_right,
33 hk_option_qot_right: s.hk_option_qot_right,
34 hk_future_qot_right: s.hk_future_qot_right,
35 us_qot_right: s.us_qot_right,
36 us_index_qot_right: s.us_index_qot_right,
37 us_option_qot_right: s.us_option_qot_right,
38 us_cme_future_qot_right: s.us_cme_future_qot_right,
39 us_cbot_future_qot_right: s.us_cbot_future_qot_right,
40 us_nymex_future_qot_right: s.us_nymex_future_qot_right,
41 us_comex_future_qot_right: s.us_comex_future_qot_right,
42 us_cboe_future_qot_right: s.us_cboe_future_qot_right,
43 us_otc_qot_right: s.us_otc_qot_right,
44 sh_qot_right: s.sh_qot_right,
45 sz_qot_right: s.sz_qot_right,
46 sg_future_qot_right: s.sg_future_qot_right,
47 sg_stock_qot_right: s.sg_stock_qot_right,
48 my_stock_qot_right: s.my_stock_qot_right,
49 jp_future_qot_right: s.jp_future_qot_right,
50 jp_stock_qot_right: s.jp_stock_qot_right,
51 cc_qot_right: s.cc_qot_right,
52 event_contract_qot_right: s.ec_qot_right,
53 }))
54}