lib.rs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. use std::collections::{BTreeMap, HashMap};
  2. use std::fmt;
  3. use std::fmt::Formatter;
  4. use std::io::{Error};
  5. use async_trait::async_trait;
  6. use rust_decimal::Decimal;
  7. use tokio::time::Instant;
  8. use global::trace_stack::TraceStack;
  9. use crate::exchange::ExchangeEnum;
  10. // 引入工具模块
  11. pub mod utils;
  12. // 引入exchange模块
  13. pub mod exchange;
  14. pub mod handle_info;
  15. // 引入binance模块
  16. mod binance_swap;
  17. mod binance_spot;
  18. pub mod binance_swap_handle;
  19. pub mod binance_spot_handle;
  20. // 引入gate模块
  21. mod gate_swap;
  22. mod gate_spot;
  23. pub mod gate_handle;
  24. mod kucoin_swap;
  25. pub mod kucoin_handle;
  26. mod okx_swap;
  27. pub mod okx_handle;
  28. mod bitget_spot;
  29. pub mod bitget_spot_handle;
  30. mod kucoin_spot;
  31. pub mod kucoin_spot_handle;
  32. mod bybit_swap;
  33. mod bybit_swap_handle;
  34. /// 持仓模式枚举
  35. /// - `Both`:单持仓方向
  36. /// - `LONG`:多仓
  37. /// - `SHORT`:空仓
  38. #[derive(Debug, Clone, PartialEq, Eq)]
  39. pub enum PositionModeEnum {
  40. Both,
  41. Long,
  42. Short,
  43. }
  44. /// OrderCommand结构体(下单指令)
  45. /// - `cancel(HashMap<String, Vec<String>)`: 取消订单指令 `{"order_name": [c_id, o_id]}`;
  46. /// - `check(HashMap<String, Vec<String>>)`: balance挂单的冻结数量 `{"order_name": [数量,方向,价格,c_id]}`;
  47. /// - `limits_open(HashMap<String, Vec<String>>)`: 总计交易币数量 `{"order_name": [c_id, o_id]}`;
  48. /// - `limits_close(HashMap<String, Vec<String>>)`: 可用交易币数量 `{"order_name": [c_id, o_id]}`;
  49. #[derive(Debug, Clone, PartialEq, Eq)]
  50. pub struct OrderCommand {
  51. // 取消订单指令,数据结构例子:
  52. pub cancel: HashMap<String, Vec<String>>,
  53. // 检验指令,数据结构例子:(暂没找到例子)
  54. pub check: HashMap<String, Vec<String>>,
  55. // 限开指令,数据结构例子:(暂没找到例子)
  56. pub limits_open: HashMap<String, Vec<String>>,
  57. // 限收指令,数据结构例子:(暂没找到例子)
  58. pub limits_close: HashMap<String, Vec<String>>,
  59. }
  60. impl OrderCommand {
  61. pub fn new() -> OrderCommand {
  62. OrderCommand {
  63. cancel: Default::default(),
  64. check: Default::default(),
  65. limits_open: Default::default(),
  66. limits_close: Default::default(),
  67. }
  68. }
  69. pub fn is_not_empty(&self) -> bool {
  70. let is_empty = self.limits_close.is_empty() && self.limits_open.is_empty() && self.cancel.is_empty() && self.check.is_empty();
  71. if is_empty { false } else { true }
  72. }
  73. }
  74. impl fmt::Display for OrderCommand {
  75. fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
  76. write!(f, "订单触发数据: cancel: {:?}, check: {:?}, limits_open: {:?}, limits_close: {:?}",
  77. self.cancel,
  78. self.check,
  79. self.limits_open,
  80. self.limits_close
  81. )
  82. }
  83. }
  84. /// Account结构体(账户信息)
  85. /// - `coin(String)`: 货币;
  86. /// - `balance(Decimal)`: 总计计价币数量;
  87. /// - `available_balance(Decimal)`: 可用计价币数量;
  88. /// - `frozen_balance(Decimal)`: balance挂单的冻结数量
  89. /// - `stocks(Decimal)`: 总计交易币数量
  90. /// - `available_stocks(Decimal)`: 可用交易币数量
  91. /// - `frozen_stocks(Decimal)`: stocks挂单的冻结数量
  92. #[derive(Debug, Clone, PartialEq, Eq)]
  93. pub struct Account {
  94. pub coin: String,
  95. pub balance: Decimal,
  96. pub available_balance: Decimal,
  97. pub frozen_balance: Decimal,
  98. pub stocks: Decimal,
  99. pub available_stocks: Decimal,
  100. pub frozen_stocks: Decimal,
  101. }
  102. impl Account {
  103. pub fn new() -> Account {
  104. Account {
  105. coin: "".to_string(),
  106. balance: Default::default(),
  107. available_balance: Default::default(),
  108. frozen_balance: Default::default(),
  109. stocks: Default::default(),
  110. available_stocks: Default::default(),
  111. frozen_stocks: Default::default(),
  112. }
  113. }
  114. }
  115. /// Depth结构体(市场深度)
  116. /// - `time(i64)`: 深度更新时间戳(ms);
  117. /// - `asks(Vec<MarketOrder>)`: 卖方深度列表;
  118. /// - `bids(Vec<MarketOrder>)`: 买方深度列表;
  119. #[derive(Debug, Clone, PartialEq, Eq)]
  120. pub struct Depth {
  121. pub time: i64,
  122. pub asks: Vec<MarketOrder>,
  123. pub bids: Vec<MarketOrder>,
  124. }
  125. impl Depth {
  126. pub fn new() -> Depth {
  127. Depth {
  128. time: 0,
  129. asks: vec![],
  130. bids: vec![],
  131. }
  132. }
  133. }
  134. /// 特殊Depth结构体(市场深度)
  135. /// - `name<String>`: 平台信息;
  136. /// - `depth(Vec<Decimal>)`: 深度信息;
  137. /// - `ticker(SpecialTicker)`: 市场行情;
  138. /// - `t(Decimal)`: 数据更新id
  139. /// - `create_at(i64)`: 数据生成时间
  140. #[derive(Debug, Clone, PartialEq, Eq)]
  141. pub struct SpecialDepth {
  142. pub name: String,
  143. pub depth: Vec<Decimal>,
  144. pub ticker: SpecialTicker,
  145. pub t: Decimal,
  146. pub create_at: i64,
  147. }
  148. impl SpecialDepth {
  149. pub fn new() -> SpecialDepth {
  150. SpecialDepth {
  151. name: "".to_string(),
  152. depth: vec![],
  153. ticker: SpecialTicker::new(),
  154. t: Default::default(),
  155. create_at: 0,
  156. }
  157. }
  158. }
  159. /// 特殊Ticker结构体(市场行情)
  160. /// - `sell(Decimal)`: 卖一价
  161. /// - `buy(Decimal)`: 买一价
  162. /// - `mid_price(Decimal)`: 平均价
  163. /// - `t(Decimal)`: 数据更新id
  164. /// - `create_at(i64)`: 数据生成时间
  165. #[derive(Debug, Clone, PartialEq, Eq)]
  166. pub struct SpecialTicker {
  167. pub sell: Decimal,
  168. pub buy: Decimal,
  169. pub mid_price: Decimal,
  170. pub t: Decimal,
  171. pub create_at: i64
  172. }
  173. impl SpecialTicker {
  174. pub fn new() -> SpecialTicker {
  175. SpecialTicker {
  176. sell: Default::default(),
  177. buy: Default::default(),
  178. mid_price: Default::default(),
  179. t: Default::default(),
  180. create_at: 0,
  181. }
  182. }
  183. }
  184. /// MarketOrder结构体(市场深度单)
  185. /// - `price(Decimal)`: 价格
  186. /// - `amount(Decimal)`: 数量
  187. #[derive(Debug, Clone, PartialEq, Eq)]
  188. pub struct MarketOrder {
  189. pub price: Decimal,
  190. pub amount: Decimal,
  191. }
  192. impl MarketOrder {
  193. pub fn new() -> MarketOrder {
  194. MarketOrder {
  195. price: Default::default(),
  196. amount: Default::default(),
  197. }
  198. }
  199. }
  200. /// Record结构体(标准的OHLC结构)
  201. /// - `time(i64)`: 时间戳;
  202. /// - `open(Decimal)`: 开盘价;
  203. /// - `high(Decimal)`: 最高价;
  204. /// - `low(Decimal):` 最低价;
  205. /// - `close(Decimal)`: 收盘价;
  206. /// - `volume(Decimal)`: 交易量;
  207. #[derive(Debug, Clone, PartialEq, Eq)]
  208. pub struct Record {
  209. pub time: i64,
  210. pub open: Decimal,
  211. pub high: Decimal,
  212. pub low: Decimal,
  213. pub close: Decimal,
  214. pub volume: Decimal,
  215. }
  216. impl Record {
  217. pub fn new() -> Record {
  218. Record {
  219. time: 0,
  220. open: Default::default(),
  221. high: Default::default(),
  222. low: Default::default(),
  223. close: Default::default(),
  224. volume: Default::default(),
  225. }
  226. }
  227. }
  228. /// 特殊Order结构体(订单)
  229. /// - `name<String>`: 平台信息;
  230. /// - `order<Vec<Order>>`: 订单信息数组;
  231. #[derive(Debug, Clone, PartialEq, Eq)]
  232. pub struct SpecialOrder {
  233. pub name: String,
  234. pub order: Vec<Order>,
  235. }
  236. impl SpecialOrder {
  237. pub fn new() -> SpecialOrder {
  238. SpecialOrder {
  239. name: "".to_string(),
  240. order: vec![],
  241. }
  242. }
  243. }
  244. /// Order结构体(订单)
  245. /// - `id(String)`: 交易单唯一标识
  246. /// - `custom_id(String)`: 自定义Id
  247. /// - `price(Decimal)`: 下单价格
  248. /// - `amount(Decimal)`: 下单数量
  249. /// - `deal_amount(Decimal)`: 成交数量
  250. /// - `avg_price(Decimal)`: 成交均价
  251. /// - `status(String)`: 订单状态
  252. /// - `order_type(String)`: 订单类型
  253. #[derive(Debug, Clone, PartialEq, Eq)]
  254. pub struct Order {
  255. pub id: String,
  256. pub custom_id: String,
  257. pub price: Decimal,
  258. pub amount: Decimal,
  259. pub deal_amount: Decimal,
  260. pub avg_price: Decimal,
  261. pub status: String,
  262. pub order_type: String,
  263. pub trace_stack: TraceStack,
  264. }
  265. impl Order {
  266. pub fn new() -> Order {
  267. Order {
  268. id: "".to_string(),
  269. custom_id: "".to_string(),
  270. price: Default::default(),
  271. amount: Default::default(),
  272. deal_amount: Default::default(),
  273. avg_price: Default::default(),
  274. status: "".to_string(),
  275. order_type: "".to_string(),
  276. trace_stack: TraceStack::new(0, Instant::now()),
  277. }
  278. }
  279. }
  280. /// Ticker结构体(市场行情)
  281. /// - `time(i64)`: 毫秒级别时间戳
  282. /// - `high(Decimal)`: 最高价
  283. /// - `low(Decimal)`: 最低价
  284. /// - `sell(Decimal)`: 卖一价
  285. /// - `buy(Decimal)`: 买一价
  286. /// - `last(Decimal)`: 最后成交价
  287. /// - `volume(Decimal)`: 最近成交量
  288. #[derive(Debug, Clone, PartialEq, Eq)]
  289. pub struct Ticker {
  290. pub time: i64,
  291. pub high: Decimal,
  292. pub low: Decimal,
  293. pub sell: Decimal,
  294. pub buy: Decimal,
  295. pub last: Decimal,
  296. pub volume: Decimal,
  297. }
  298. impl Ticker {
  299. pub fn new() -> Ticker {
  300. Ticker {
  301. time: 0,
  302. high: Default::default(),
  303. low: Default::default(),
  304. sell: Default::default(),
  305. buy: Default::default(),
  306. last: Default::default(),
  307. volume: Default::default(),
  308. }
  309. }
  310. }
  311. /// Market结构体(交易品种的市场信息)
  312. /// - `symbol(String)`: 交易对
  313. /// - `base_asset(String)`: 交易币
  314. /// - `quote_asset(String)`: 计价币
  315. /// - `tick_size(Decimal)`: 价格最小变动数值
  316. /// - `amount_size(Decimal)`: 下单量最小变动数值
  317. /// - `price_precision(Decimal)`: 价格精度
  318. /// - `amount_precision(Decimal)`: 下单量精度
  319. /// - `min_qty(Decimal)`: 最小下单量
  320. /// - `max_qty(Decimal)`: 最大下单量
  321. /// - `min_notional(Decimal)`: 最小下单金额
  322. /// - `max_notional(Decimal)`: 最大下单金额
  323. /// - `ct_val(Decimal)`: 合约价值
  324. #[derive(Debug, Clone, PartialEq, Eq)]
  325. pub struct Market {
  326. pub symbol: String,
  327. pub base_asset: String,
  328. pub quote_asset: String,
  329. pub tick_size: Decimal,
  330. pub amount_size: Decimal,
  331. pub price_precision: Decimal,
  332. pub amount_precision: Decimal,
  333. pub min_qty: Decimal,
  334. pub max_qty: Decimal,
  335. pub min_notional: Decimal,
  336. pub max_notional: Decimal,
  337. pub ct_val: Decimal,
  338. }
  339. impl Market {
  340. pub fn new() -> Market {
  341. Market {
  342. symbol: "".to_string(),
  343. base_asset: "".to_string(),
  344. quote_asset: "".to_string(),
  345. tick_size: Default::default(),
  346. amount_size: Default::default(),
  347. price_precision: Default::default(),
  348. amount_precision: Default::default(),
  349. min_qty: Default::default(),
  350. max_qty: Default::default(),
  351. min_notional: Default::default(),
  352. max_notional: Default::default(),
  353. ct_val: Default::default(),
  354. }
  355. }
  356. }
  357. /// Position结构体(仓位信息)
  358. /// - `symbol(String)`: 币对
  359. /// - `margin_level(String)`: 持仓杆杠大小
  360. /// - `amount(String)`: 持仓量
  361. /// - `frozen_amount(String)`: 仓位冻结量
  362. /// - `price(Decimal)`: 持仓均价
  363. /// - `profit(Decimal)`: 持仓浮动盈亏
  364. /// - `position_mode(PositionModeEnum)`: 持仓模式
  365. /// - `margin(Decimal)`: 仓位占用的保证金
  366. #[derive(Debug, Clone, PartialEq, Eq)]
  367. pub struct Position {
  368. pub symbol: String,
  369. pub margin_level: Decimal,
  370. pub amount: Decimal,
  371. pub frozen_amount: Decimal,
  372. pub price: Decimal,
  373. pub profit: Decimal,
  374. pub position_mode: PositionModeEnum,
  375. pub margin: Decimal,
  376. }
  377. impl Position {
  378. pub fn new() -> Position {
  379. Position {
  380. symbol: "".to_string(),
  381. margin_level: Default::default(),
  382. amount: Default::default(),
  383. frozen_amount: Default::default(),
  384. price: Default::default(),
  385. profit: Default::default(),
  386. position_mode: PositionModeEnum::Both,
  387. margin: Default::default(),
  388. }
  389. }
  390. }
  391. /// 交易所统一方法接口
  392. ///
  393. /// 使用方法前需实例化
  394. /// ```rust
  395. /// use std::collections::BTreeMap;
  396. /// use standard::exchange::{Exchange, ExchangeEnum};
  397. ///
  398. /// let mut params:BTreeMap<String,String> = BTreeMap::new();
  399. /// params.insert("access_key".to_string(), "your_access_key".to_string());
  400. /// params.insert("access_key".to_string(), "your_secret_key".to_string());
  401. /// let exchange = Exchange::new(ExchangeEnum::BinanceSwap, "BTC_USDT".to_string(), true, params);
  402. /// ```
  403. /// 获取当前交易所交易模式
  404. /// - fn get_self_exchange(&self) -> ExchangeEnum;
  405. /// ```rust
  406. /// # use std::collections::BTreeMap;
  407. /// # use standard::exchange::{Exchange, ExchangeEnum};
  408. /// # let mut params:BTreeMap<String,String> = BTreeMap::new();
  409. /// # params.insert("access_key".to_string(), "your_access_key".to_string());
  410. /// # params.insert("access_key".to_string(), "your_secret_key".to_string());
  411. /// # let exchange = Exchange::new(ExchangeEnum::BinanceSwap, "BTC_USDT".to_string(), true, params);
  412. ///
  413. /// exchange.get_self_exchange();
  414. /// ```
  415. /// 获取当前是否使用高速模式
  416. /// - fn get_self_is_colo(&self) -> bool;
  417. /// ```rust
  418. /// # use std::collections::BTreeMap;
  419. /// # use standard::exchange::{Exchange, ExchangeEnum};
  420. /// # let mut params:BTreeMap<String,String> = BTreeMap::new();
  421. /// # params.insert("access_key".to_string(), "your_access_key".to_string());
  422. /// # params.insert("access_key".to_string(), "your_secret_key".to_string());
  423. /// # let exchange = Exchange::new(ExchangeEnum::BinanceSwap, "BTC_USDT".to_string(), true, params);
  424. ///
  425. /// exchange.get_self_is_colo();
  426. /// ```
  427. /// 获取当前是否使用登录
  428. /// - fn get_self_is_login(&self) -> bool;
  429. /// ```rust
  430. /// # use std::collections::BTreeMap;
  431. /// # use standard::exchange::{Exchange, ExchangeEnum};
  432. /// # let mut params:BTreeMap<String,String> = BTreeMap::new();
  433. /// # params.insert("access_key".to_string(), "your_access_key".to_string());
  434. /// # params.insert("access_key".to_string(), "your_secret_key".to_string());
  435. /// # let exchange = Exchange::new(ExchangeEnum::BinanceSwap, "BTC_USDT".to_string(), true, params);
  436. ///
  437. /// exchange.get_self_is_login();
  438. /// ```
  439. /// 获取登录params信息
  440. /// - fn get_self_params(&self) -> BTreeMap<String, String>;
  441. /// ```rust
  442. /// # use std::collections::BTreeMap;
  443. /// # use standard::exchange::{Exchange, ExchangeEnum};
  444. /// # let mut params:BTreeMap<String,String> = BTreeMap::new();
  445. /// # params.insert("access_key".to_string(), "your_access_key".to_string());
  446. /// # params.insert("access_key".to_string(), "your_secret_key".to_string());
  447. /// # let exchange = Exchange::new(ExchangeEnum::BinanceSwap, "BTC_USDT".to_string(), true, params);
  448. ///
  449. /// exchange.get_self_params();
  450. /// ```
  451. /// 获取账号信息
  452. /// - async fn get_account(&self, symbol: &str) -> Result<Account, Error>;
  453. /// ```rust
  454. /// # use std::collections::BTreeMap;
  455. /// # use standard::exchange::{Exchange, ExchangeEnum};
  456. /// # let mut params:BTreeMap<String,String> = BTreeMap::new();
  457. /// # params.insert("access_key".to_string(), "your_access_key".to_string());
  458. /// # params.insert("access_key".to_string(), "your_secret_key".to_string());
  459. /// # let exchange = Exchange::new(ExchangeEnum::BinanceSwap, "BTC_USDT".to_string(), true, params);
  460. ///
  461. /// exchange.get_account()
  462. /// ```
  463. /// 订阅账号信息
  464. /// ```rust
  465. /// # use std::collections::BTreeMap;
  466. /// # use standard::exchange::{Exchange, ExchangeEnum};
  467. /// # let mut params:BTreeMap<String,String> = BTreeMap::new();
  468. /// # params.insert("access_key".to_string(), "your_access_key".to_string());
  469. /// # params.insert("access_key".to_string(), "your_secret_key".to_string());
  470. /// # let exchange = Exchange::new(ExchangeEnum::BinanceSwap, "BTC_USDT".to_string(), true, params);
  471. ///
  472. /// exchange.subscribe_account();
  473. /// ```
  474. #[async_trait]
  475. pub trait Platform {
  476. fn clone_box(&self) -> Box<dyn Platform + Send + Sync>;
  477. // 获取当前交易所交易模式
  478. fn get_self_exchange(&self) -> ExchangeEnum;
  479. // 获取交易对
  480. fn get_self_symbol(&self) -> String;
  481. // 获取当前是否使用高速模式
  482. fn get_self_is_colo(&self) -> bool;
  483. // 获取登录params信息
  484. fn get_self_params(&self) -> BTreeMap<String, String>;
  485. // 获取market信息
  486. fn get_self_market(&self) -> Market;
  487. // 获取请求时间
  488. fn get_request_delays(&self) -> Vec<i64>;
  489. // 获取请求平均时间
  490. fn get_request_avg_delay(&self) -> Decimal;
  491. // 获取请求最大时间
  492. fn get_request_max_delay(&self) -> i64;
  493. // 获取服务器时间
  494. async fn get_server_time(&mut self) -> Result<String, Error>;
  495. // 获取账号信息
  496. async fn get_account(&mut self) -> Result<Account, Error>;
  497. // 获取现货账号信息
  498. async fn get_spot_account(&mut self) -> Result<Vec<Account>, Error>;
  499. // 获取持仓信息
  500. async fn get_position(&mut self) -> Result<Vec<Position>, Error>;
  501. // 获取所有持仓
  502. async fn get_positions(&mut self) -> Result<Vec<Position>, Error>;
  503. // 获取市场行情
  504. async fn get_ticker(&mut self) -> Result<Ticker, Error>;
  505. // 获取市场行情自定义交易对
  506. async fn get_ticker_symbol(&mut self, symbol: String) -> Result<Ticker, Error>;
  507. // 查询所有的市场信息
  508. async fn get_market(&mut self) -> Result<Market, Error>;
  509. // 查询所有的市场信息自定义交易对
  510. async fn get_market_symbol(&mut self, symbol: String) -> Result<Market, Error>;
  511. // 查询订单详情
  512. async fn get_order_detail(&mut self, order_id: &str, custom_id: &str) -> Result<Order, Error>;
  513. // 获取订单列表
  514. async fn get_orders_list(&mut self, status: &str) -> Result<Vec<Order>, Error>;
  515. // 下单接口
  516. async fn take_order(&mut self, custom_id: &str, origin_side: &str, price: Decimal, amount: Decimal) -> Result<Order, Error>;
  517. // 下单接口自定义交易对
  518. async fn take_order_symbol(&mut self, symbol: String, ct_val: Decimal, custom_id: &str, origin_side: &str, price: Decimal, amount: Decimal) -> Result<Order, Error>;
  519. // 撤销订单
  520. async fn cancel_order(&mut self, order_id: &str, custom_id: &str) -> Result<Order, Error>;
  521. // 批量撤销订单
  522. async fn cancel_orders(&mut self) -> Result<Vec<Order>, Error>;
  523. // 撤销所有订单
  524. async fn cancel_orders_all(&mut self) -> Result<Vec<Order>, Error>;
  525. // 设置持仓模式
  526. async fn set_dual_mode(&mut self, coin: &str, is_dual_mode: bool) -> Result<String, Error>;
  527. // 更新双持仓模式下杠杆
  528. async fn set_dual_leverage(&mut self, leverage: &str) -> Result<String, Error>;
  529. // 设置自动追加保证金
  530. async fn set_auto_deposit_status(&mut self, status: bool) -> Result<String, Error>;
  531. // 交易账户互转
  532. async fn wallet_transfers(&mut self, coin: &str, from: &str, to: &str, amount: Decimal) -> Result<String, Error>;
  533. // 指令下单
  534. async fn command_order(&mut self, order_command: OrderCommand, trace_stack: TraceStack);
  535. }