Skip to main content

futu_rest/routes/qot/
qot_3401_plus.rs

1//! REST raw proto-json routes for public QOT 3401+ APIs.
2//!
3//! These endpoints intentionally expose generated public C2S JSON directly.
4//! The daemon Gateway handlers do the C++-aligned public→backend projection.
5
6use axum::extract::{Json, State};
7use prost::Message;
8use serde::Serialize;
9use serde::de::DeserializeOwned;
10use serde_json::Value;
11
12use crate::adapter::{self, RestState};
13
14use super::RawApiResult;
15
16async fn raw_qot_request<Req, Rsp>(state: &RestState, proto_id: u32, body: Value) -> RawApiResult
17where
18    Req: Message + Default + DeserializeOwned,
19    Rsp: Message + Default + Serialize,
20{
21    adapter::proto_request_raw::<Req, Rsp>(state, proto_id, Some(body)).await
22}
23
24macro_rules! qot_raw_rest_endpoint {
25    ($fn_name:ident, $proto_const:ident, $module:ident) => {
26        pub async fn $fn_name(
27            State(state): State<RestState>,
28            Json(body): Json<Value>,
29        ) -> RawApiResult {
30            raw_qot_request::<futu_proto::$module::Request, futu_proto::$module::Response>(
31                &state,
32                futu_core::proto_id::$proto_const,
33                body,
34            )
35            .await
36        }
37    };
38}
39
40qot_raw_rest_endpoint!(
41    get_earnings_calendar,
42    QOT_GET_EARNINGS_CALENDAR,
43    qot_get_earnings_calendar
44);
45qot_raw_rest_endpoint!(
46    get_macro_indicator_list,
47    QOT_GET_MACRO_INDICATOR_LIST,
48    qot_get_macro_indicator_list
49);
50qot_raw_rest_endpoint!(
51    get_macro_indicator_history,
52    QOT_GET_MACRO_INDICATOR_HISTORY,
53    qot_get_macro_indicator_history
54);
55qot_raw_rest_endpoint!(
56    get_fed_watch_target_rate,
57    QOT_GET_FED_WATCH_TARGET_RATE,
58    qot_get_fed_watch_target_rate
59);
60qot_raw_rest_endpoint!(
61    get_fed_watch_dot_plot,
62    QOT_GET_FED_WATCH_DOT_PLOT,
63    qot_get_fed_watch_dot_plot
64);
65qot_raw_rest_endpoint!(
66    get_earnings_beat_rank,
67    QOT_GET_EARNINGS_BEAT_RANK,
68    qot_get_earnings_beat_rank
69);
70qot_raw_rest_endpoint!(
71    get_dividend_rank,
72    QOT_GET_DIVIDEND_RANK,
73    qot_get_dividend_rank
74);
75qot_raw_rest_endpoint!(
76    get_dividend_calendar,
77    QOT_GET_DIVIDEND_CALENDAR,
78    qot_get_dividend_calendar
79);
80qot_raw_rest_endpoint!(
81    get_economic_calendar,
82    QOT_GET_ECONOMIC_CALENDAR,
83    qot_get_economic_calendar
84);
85qot_raw_rest_endpoint!(
86    get_us_pre_market_rank,
87    QOT_GET_US_PRE_MARKET_RANK,
88    qot_get_us_pre_market_rank
89);
90qot_raw_rest_endpoint!(
91    get_us_after_hours_rank,
92    QOT_GET_US_AFTER_HOURS_RANK,
93    qot_get_us_after_hours_rank
94);
95qot_raw_rest_endpoint!(
96    get_us_overnight_rank,
97    QOT_GET_US_OVERNIGHT_RANK,
98    qot_get_us_overnight_rank
99);
100qot_raw_rest_endpoint!(
101    get_top_movers_rank,
102    QOT_GET_TOP_MOVERS_RANK,
103    qot_get_top_movers_rank
104);
105qot_raw_rest_endpoint!(get_hot_list, QOT_GET_HOT_LIST, qot_get_hot_list);
106qot_raw_rest_endpoint!(
107    get_short_selling_rank,
108    QOT_GET_SHORT_SELLING_RANK,
109    qot_get_short_selling_rank
110);
111qot_raw_rest_endpoint!(
112    get_period_change_rank,
113    QOT_GET_PERIOD_CHANGE_RANK,
114    qot_get_period_change_rank
115);
116qot_raw_rest_endpoint!(
117    get_high_dividend_soe_rank,
118    QOT_GET_HIGH_DIVIDEND_SOE_RANK,
119    qot_get_high_dividend_soe_rank
120);
121qot_raw_rest_endpoint!(
122    get_institution_list,
123    QOT_GET_INSTITUTION_LIST,
124    qot_get_institution_list
125);
126qot_raw_rest_endpoint!(
127    get_institution_profile,
128    QOT_GET_INSTITUTION_PROFILE,
129    qot_get_institution_profile
130);
131qot_raw_rest_endpoint!(
132    get_institution_distribution,
133    QOT_GET_INSTITUTION_DISTRIBUTION,
134    qot_get_institution_distribution
135);
136qot_raw_rest_endpoint!(
137    get_institution_holding_change,
138    QOT_GET_INSTITUTION_HOLDING_CHANGE,
139    qot_get_institution_holding_change
140);
141qot_raw_rest_endpoint!(
142    get_institution_holding_list,
143    QOT_GET_INSTITUTION_HOLDING_LIST,
144    qot_get_institution_holding_list
145);
146qot_raw_rest_endpoint!(
147    get_ark_fund_holding,
148    QOT_GET_ARK_FUND_HOLDING,
149    qot_get_ark_fund_holding
150);
151qot_raw_rest_endpoint!(
152    get_ark_stock_dynamic,
153    QOT_GET_ARK_STOCK_DYNAMIC,
154    qot_get_ark_stock_dynamic
155);
156qot_raw_rest_endpoint!(
157    get_ark_active_transaction,
158    QOT_GET_ARK_ACTIVE_TRANSACTION,
159    qot_get_ark_active_transaction
160);
161qot_raw_rest_endpoint!(
162    get_rating_change,
163    QOT_GET_RATING_CHANGE,
164    qot_get_rating_change
165);
166qot_raw_rest_endpoint!(
167    get_industrial_chain_list,
168    QOT_GET_INDUSTRIAL_CHAIN_LIST,
169    qot_get_industrial_chain_list
170);
171qot_raw_rest_endpoint!(
172    get_industrial_chain_detail,
173    QOT_GET_INDUSTRIAL_CHAIN_DETAIL,
174    qot_get_industrial_chain_detail
175);
176qot_raw_rest_endpoint!(
177    get_industrial_chain_by_plate,
178    QOT_GET_INDUSTRIAL_CHAIN_BY_PLATE,
179    qot_get_industrial_chain_by_plate
180);
181qot_raw_rest_endpoint!(
182    get_industrial_plate_info,
183    QOT_GET_INDUSTRIAL_PLATE_INFO,
184    qot_get_industrial_plate_info
185);
186qot_raw_rest_endpoint!(
187    get_industrial_plate_stock,
188    QOT_GET_INDUSTRIAL_PLATE_STOCK,
189    qot_get_industrial_plate_stock
190);
191qot_raw_rest_endpoint!(
192    get_heat_map_data,
193    QOT_GET_HEAT_MAP_DATA,
194    qot_get_heat_map_data
195);
196qot_raw_rest_endpoint!(
197    get_rise_fall_distribution,
198    QOT_GET_RISE_FALL_DISTRIBUTION,
199    qot_get_rise_fall_distribution
200);