Skip to main content

futu_rest/routes/qot/
reference.rs

1//! Split from routes/qot.rs: reference.
2
3use axum::extract::{Json, State};
4use serde_json::Value;
5
6use futu_core::proto_id;
7
8use super::*;
9
10pub async fn get_plate_set(State(state): State<RestState>, Json(body): Json<Value>) -> ApiResult {
11    adapter::proto_request::<qot_get_plate_set::Request, qot_get_plate_set::Response>(
12        &state,
13        proto_id::QOT_GET_PLATE_SET,
14        Some(body),
15    )
16    .await
17}
18
19/// POST /api/plate-security — 获取板块内股票
20pub async fn get_plate_security(
21    State(state): State<RestState>,
22    Json(body): Json<Value>,
23) -> ApiResult {
24    adapter::proto_request::<qot_get_plate_security::Request, qot_get_plate_security::Response>(
25        &state,
26        proto_id::QOT_GET_PLATE_SECURITY,
27        Some(body),
28    )
29    .await
30}
31
32/// POST /api/reference — 获取关联数据
33pub async fn get_reference(State(state): State<RestState>, Json(body): Json<Value>) -> ApiResult {
34    adapter::proto_request::<qot_get_reference::Request, qot_get_reference::Response>(
35        &state,
36        proto_id::QOT_GET_REFERENCE,
37        Some(body),
38    )
39    .await
40}
41
42/// POST /api/owner-plate — 获取所属板块
43pub async fn get_owner_plate(State(state): State<RestState>, Json(body): Json<Value>) -> ApiResult {
44    adapter::proto_request::<qot_get_owner_plate::Request, qot_get_owner_plate::Response>(
45        &state,
46        proto_id::QOT_GET_OWNER_PLATE,
47        Some(body),
48    )
49    .await
50}
51
52/// POST /api/option-chain — 获取期权链
53pub async fn get_option_chain(
54    State(state): State<RestState>,
55    Json(body): Json<Value>,
56) -> ApiResult {
57    adapter::proto_request::<qot_get_option_chain::Request, qot_get_option_chain::Response>(
58        &state,
59        proto_id::QOT_GET_OPTION_CHAIN,
60        Some(body),
61    )
62    .await
63}
64
65/// POST /api/warrant — 获取窝轮
66pub async fn get_warrant(State(state): State<RestState>, Json(body): Json<Value>) -> ApiResult {
67    adapter::proto_request::<qot_get_warrant::Request, qot_get_warrant::Response>(
68        &state,
69        proto_id::QOT_GET_WARRANT,
70        Some(body),
71    )
72    .await
73}
74
75/// POST /api/capital-flow — 获取资金流向
76pub async fn get_capital_flow(
77    State(state): State<RestState>,
78    Json(body): Json<Value>,
79) -> ApiResult {
80    adapter::proto_request::<qot_get_capital_flow::Request, qot_get_capital_flow::Response>(
81        &state,
82        proto_id::QOT_GET_CAPITAL_FLOW,
83        Some(body),
84    )
85    .await
86}
87
88/// POST /api/capital-distribution — 获取资金分布
89pub async fn get_capital_distribution(
90    State(state): State<RestState>,
91    Json(body): Json<Value>,
92) -> ApiResult {
93    adapter::proto_request::<
94        qot_get_capital_distribution::Request,
95        qot_get_capital_distribution::Response,
96    >(&state, proto_id::QOT_GET_CAPITAL_DISTRIBUTION, Some(body))
97    .await
98}
99
100/// POST /api/user-security — 获取自选股
101pub async fn get_user_security(
102    State(state): State<RestState>,
103    Json(body): Json<Value>,
104) -> ApiResult {
105    adapter::proto_request::<qot_get_user_security::Request, qot_get_user_security::Response>(
106        &state,
107        proto_id::QOT_GET_USER_SECURITY,
108        Some(body),
109    )
110    .await
111}
112
113/// POST /api/stock-filter — 条件选股
114pub async fn stock_filter(State(state): State<RestState>, Json(body): Json<Value>) -> ApiResult {
115    adapter::proto_request::<qot_stock_filter::Request, qot_stock_filter::Response>(
116        &state,
117        proto_id::QOT_STOCK_FILTER,
118        Some(body),
119    )
120    .await
121}
122
123/// POST /api/ipo-list — 获取IPO列表
124pub async fn get_ipo_list(State(state): State<RestState>, Json(body): Json<Value>) -> ApiResult {
125    adapter::proto_request::<qot_get_ipo_list::Request, qot_get_ipo_list::Response>(
126        &state,
127        proto_id::QOT_GET_IPO_LIST,
128        Some(body),
129    )
130    .await
131}
132
133/// POST /api/future-info — 获取期货信息
134pub async fn get_future_info(State(state): State<RestState>, Json(body): Json<Value>) -> ApiResult {
135    adapter::proto_request::<qot_get_future_info::Request, qot_get_future_info::Response>(
136        &state,
137        proto_id::QOT_GET_FUTURE_INFO,
138        Some(body),
139    )
140    .await
141}
142
143/// POST /api/market-state — 获取市场状态
144pub async fn get_market_state(
145    State(state): State<RestState>,
146    Json(body): Json<Value>,
147) -> ApiResult {
148    adapter::proto_request::<qot_get_market_state::Request, qot_get_market_state::Response>(
149        &state,
150        proto_id::QOT_GET_MARKET_STATE,
151        Some(body),
152    )
153    .await
154}
155
156/// POST /api/history-kline — 请求历史K线
157pub async fn request_history_kl(
158    State(state): State<RestState>,
159    Json(body): Json<Value>,
160) -> ApiResult {
161    adapter::proto_request::<qot_request_history_kl::Request, qot_request_history_kl::Response>(
162        &state,
163        proto_id::QOT_REQUEST_HISTORY_KL,
164        Some(body),
165    )
166    .await
167}
168
169// v1.4.30 新增
170
171/// POST /api/trading-days — 查询交易日(对齐 py-futu-api `request_trading_days`)
172pub async fn request_trading_days(
173    State(state): State<RestState>,
174    Json(body): Json<Value>,
175) -> ApiResult {
176    adapter::proto_request::<qot_request_trade_date::Request, qot_request_trade_date::Response>(
177        &state,
178        proto_id::QOT_REQUEST_TRADE_DATE,
179        Some(body),
180    )
181    .await
182}
183
184/// POST /api/rehab — 请求复权因子(对齐 py-futu-api `get_rehab`)
185pub async fn request_rehab(State(state): State<RestState>, Json(body): Json<Value>) -> ApiResult {
186    adapter::proto_request::<qot_request_rehab::Request, qot_request_rehab::Response>(
187        &state,
188        proto_id::QOT_REQUEST_REHAB,
189        Some(body),
190    )
191    .await
192}
193
194/// POST /api/suspend — 获取停牌日(对齐 py-futu-api `get_suspend`)
195pub async fn get_suspend(State(state): State<RestState>, Json(body): Json<Value>) -> ApiResult {
196    adapter::proto_request::<qot_get_suspend::Request, qot_get_suspend::Response>(
197        &state,
198        proto_id::QOT_GET_SUSPEND,
199        Some(body),
200    )
201    .await
202}
203
204// v1.4.30 P2(100% 覆盖)
205
206/// POST /api/history-kl-quota — 历史 K 线配额
207pub async fn request_history_kl_quota(
208    State(state): State<RestState>,
209    Json(body): Json<Value>,
210) -> ApiResult {
211    adapter::proto_request::<
212        qot_request_history_kl_quota::Request,
213        qot_request_history_kl_quota::Response,
214    >(&state, proto_id::QOT_REQUEST_HISTORY_KL_QUOTA, Some(body))
215    .await
216}
217
218/// POST /api/used-quota — 当前 daemon 已用订阅额度与历史 K 线额度
219pub async fn get_used_quota(State(state): State<RestState>, Json(body): Json<Value>) -> ApiResult {
220    adapter::proto_request::<used_quota::Request, used_quota::Response>(
221        &state,
222        proto_id::GET_USED_QUOTA,
223        Some(body),
224    )
225    .await
226}
227
228/// POST /api/holding-change — 持股变动
229pub async fn get_holding_change(
230    State(state): State<RestState>,
231    Json(body): Json<Value>,
232) -> ApiResult {
233    adapter::proto_request::<
234        qot_get_holding_change_list::Request,
235        qot_get_holding_change_list::Response,
236    >(&state, proto_id::QOT_GET_HOLDING_CHANGE_LIST, Some(body))
237    .await
238}
239
240/// POST /api/modify-user-security — 修改自选
241pub async fn modify_user_security(
242    State(state): State<RestState>,
243    Json(body): Json<Value>,
244) -> ApiResult {
245    adapter::proto_request::<qot_modify_user_security::Request, qot_modify_user_security::Response>(
246        &state,
247        proto_id::QOT_MODIFY_USER_SECURITY,
248        Some(body),
249    )
250    .await
251}
252
253/// POST /api/code-change — 代码变更
254pub async fn get_code_change(State(state): State<RestState>, Json(body): Json<Value>) -> ApiResult {
255    adapter::proto_request::<qot_get_code_change::Request, qot_get_code_change::Response>(
256        &state,
257        proto_id::QOT_GET_CODE_CHANGE,
258        Some(body),
259    )
260    .await
261}
262
263/// POST /api/set-price-reminder — 设置到价提醒
264pub async fn set_price_reminder(
265    State(state): State<RestState>,
266    Json(body): Json<Value>,
267) -> ApiResult {
268    adapter::proto_request::<qot_set_price_reminder::Request, qot_set_price_reminder::Response>(
269        &state,
270        proto_id::QOT_SET_PRICE_REMINDER,
271        Some(body),
272    )
273    .await
274}
275
276/// POST /api/price-reminder — 查询到价提醒
277pub async fn get_price_reminder(
278    State(state): State<RestState>,
279    Json(body): Json<Value>,
280) -> ApiResult {
281    adapter::proto_request::<qot_get_price_reminder::Request, qot_get_price_reminder::Response>(
282        &state,
283        proto_id::QOT_GET_PRICE_REMINDER,
284        Some(body),
285    )
286    .await
287}
288
289/// POST /api/option-expiration-date — 期权到期日
290pub async fn get_option_expiration_date(
291    State(state): State<RestState>,
292    Json(body): Json<Value>,
293) -> ApiResult {
294    adapter::proto_request::<
295        qot_get_option_expiration_date::Request,
296        qot_get_option_expiration_date::Response,
297    >(&state, proto_id::QOT_GET_OPTION_EXPIRATION_DATE, Some(body))
298    .await
299}