xt_trader.order_stock_async(acc, code, xtconstant.STOCK_BUY, vol, xtconstant.FIX_PRICE, price, strat, remark) | passorder(23, 1101, account, code, 11, price, vol, strat, 2, userOrderId, C) |
xt_trader.cancel_order_stock_async(acc, order_id) | cancel(sysid, account, accountType, C)(注意:用委托号 m_strOrderSysID,不是内部 order_id) |
xt_trader.query_stock_positions(acc) | get_trade_detail_data(account, accountType, 'position') |
xt_trader.query_stock_asset(acc) | get_trade_detail_data(account, accountType, 'account') |
xt_trader.query_stock_orders(acc) | get_trade_detail_data(account, accountType, 'order') |
xtdata.get_full_tick(codes) | C.get_full_tick(codes)(字段名同:lastPrice/askPrice/bidPrice...) |
xtdata.get_instrument_detail(code) | C.get_instrument_detail(code)(字段名同:UpStopPrice/PreClose...) |
xtdata.get_market_data_ex(...) | C.get_market_data_ex(...)(参数几乎同构) |
xtdata.get_trading_dates('SH', s, e) | C.get_trading_dates('000001.SH', s, e, count, '1d')(仅 after_init 后可用;返回 '20240101' 字符串列表,不是时间戳) |
xtdata.download_history_data(code, period, s, e) | download_history_data(code, period, s, e)(全局函数) |
xtdata.subscribe_quote(code, period, callback=f) | C.subscribe_quote(code, period, callback=f)(在 init 里注册) |
回调类 on_stock_order/on_stock_trade/on_order_error | 模块级函数 order_callback(C, o) / deal_callback(C, d) / orderError_callback(C, args, msg),须先 C.set_account(account) |
| apscheduler / while+sleep | C.run_time("函数名", "3nSecond", "2025-01-01 09:30:00") 或 |