Skip to main content

futu_backend/
trade_query.rs

1// 交易数据查询
2//
3// CMD 使用必须走 `TRADE_QUERY_COMMANDS` registry。不要在调用点现场写
4// `base_cmd + 10000` 或重复解释 real/sim cmd;历史上真实/模拟 cmd 混用
5// 已多次造成 backend business error。
6
7use futu_cache::trd_cache::{
8    CachedCashInfo, CachedFunds, CachedMarketInfo, CachedPosition, TrdCache,
9};
10use futu_core::error::Result;
11
12use crate::conn::BackendConn;
13use crate::proto_internal::{
14    asset_pl, asset_query, config_base, crypto_risk, crypto_risk_comm, inbound_oe, inbound_read,
15    mobile_fund_asset,
16};
17
18mod account_info;
19mod common;
20mod crypto_account;
21mod crypto_orders;
22mod orders;
23mod sim;
24
25pub use crate::trade_cmd::{
26    CMD_ACCOUNT_INFO, CMD_FUND_BOND_DETAIL_ASSET, CMD_QUERY_FUND,
27    CMD_QUERY_HISTORY_ORDER_FILL_LIST, CMD_QUERY_HISTORY_ORDER_LIST, CMD_QUERY_ORDER_FILL_INFO,
28    CMD_QUERY_ORDER_FILL_LIST, CMD_QUERY_ORDER_INFO, CMD_QUERY_ORDER_LIST, CMD_QUERY_POSITION,
29    CMD_SIM_QUERY_FUND, CMD_SIM_QUERY_HISTORY_ORDER_FILL_LIST, CMD_SIM_QUERY_HISTORY_ORDER_LIST,
30    CMD_SIM_QUERY_ORDER_FILL_INFO, CMD_SIM_QUERY_ORDER_FILL_LIST, CMD_SIM_QUERY_ORDER_INFO,
31    CMD_SIM_QUERY_ORDER_LIST, CMD_SIM_QUERY_POSITION, TRADE_QUERY_COMMANDS, TradeBackendChannel,
32    TradeQueryBodyProto, TradeQueryOperation, trade_query_command,
33};
34
35pub use account_info::{query_account_info, query_position_account_info};
36pub use common::{create_backend_req_id, hash_str_to_u64};
37pub use crypto_account::{query_crypto_account_info, query_crypto_position_account_info};
38pub use crypto_orders::{
39    CryptoCashLogInfo, CryptoMaxBuySellQtyInfo, CryptoMaxBuySellQtyRequest, CryptoOrderFeeInfo,
40    CryptoOrderFeeItem, query_crypto_cash_logs, query_crypto_history_order_fills,
41    query_crypto_history_orders, query_crypto_max_buy_sell_qty, query_crypto_order_fees,
42    query_crypto_order_fills, query_crypto_order_info, query_crypto_order_related_fills,
43    query_crypto_orders, query_crypto_trade_configs,
44};
45pub use orders::{
46    OrderFillInfo, backend_deal_status_to_ftapi, backend_order_fill_qty_price_for_ftapi,
47    backend_order_status_to_ftapi, backend_order_type_to_ftapi,
48    backend_real_market_to_trd_market_like_cpp, derive_backend_market_list,
49    history_order_fill_list_cmd_for_env, history_order_list_cmd_for_env, init_trade_data,
50    is_valid_real_trd_market_like_cpp, order_fill_info_cmd_for_env, order_fill_list_cmd_for_env,
51    order_info_cmd_for_env, order_proto_to_cached_like_cpp,
52    query_order_fill_info_strict_for_push_refresh, query_order_fills,
53    query_order_fills_strict_for_push_refresh, query_order_info_strict_for_push_refresh,
54    query_orders, query_orders_strict, query_orders_strict_for_push_refresh,
55    try_order_fill_proto_to_info_like_cpp,
56};
57pub use sim::{query_funds_sim, query_positions_sim};