{"id":162,"date":"2024-12-18T15:37:17","date_gmt":"2024-12-18T07:37:17","guid":{"rendered":"https:\/\/khsci.com\/khQuant\/?page_id=162"},"modified":"2024-12-19T17:57:42","modified_gmt":"2024-12-19T09:57:42","slug":"tutor5","status":"publish","type":"page","link":"https:\/\/khsci.com\/khQuant\/tutor5\/","title":{"rendered":"\u5b9e\u76d8\u4ea4\u6613\u63a5\u53e3\u6559\u7a0b"},"content":{"rendered":"<blockquote><p>\n  \u6211\u662fMr.\u770b\u6d77\uff0c\u7531\u4e8e\u6211\u5f00\u53d1\u7684\u770b\u6d77\u91cf\u5316\u4ea4\u6613\u7cfb\u7edf\u662f\u57fa\u4e8eminiQMT\u7684\u884c\u60c5\u548c\u4ea4\u6613\u63a5\u53e3\uff0c\u6240\u4ee5\u5728\u6b64\u6211\u5c06miniQMT\u7684\u4f7f\u7528\u6559\u7a0b\u91c7\u7528\u6848\u4f8b\u96c6\u7684\u5f62\u5f0f\u8fdb\u884c\u8bb2\u89e3\uff0c\u8be5\u624b\u518c\u4f1a\u4e0d\u65ad\u5b8c\u5584\u548c\u4e30\u5bcc\uff0c\u4e3a\u505aminiQMT\u7684\u5f00\u53d1\u7684\u670b\u53cb\u63d0\u4f9b\u4fbf\u5229\u3002<br \/>\n  \u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u672c\u624b\u518c\u4ec5\u4f5c\u4e3a\u5b98\u65b9\u624b\u518c\u7684\u8f85\u52a9\u6559\u7a0b\uff0c\u6700\u6743\u5a01\u7684\u63a5\u53e3\u8bf7\u4ee5\u5b98\u65b9\u8bf4\u660e\u6587\u6863\u4e3a\u51c6\uff1a<br \/>\n  <strong><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/dict.thinktrader.net\/nativeApi\/start_now.html?id=x3GDHP\" title=\"\u5b98\u65b9\u624b\u518c\u8bf7\u70b9\u51fb\u8fd9\u91cc\">\u5b98\u65b9\u624b\u518c\u8bf7\u70b9\u51fb\u8fd9\u91cc<\/a><\/strong>\n<\/p><\/blockquote>\n<hr \/>\n<p>\u5728\u524d\u51e0\u7bc7\u7684\u6587\u7ae0\u4e2d\u8bb2\u5230\uff0c\u6211\u6b63\u5728\u5f00\u53d1\u7684\u770b\u6d77\u91cf\u5316\u4ea4\u6613\u7cfb\u7edf\uff0c\u5e95\u5c42\u662f\u4f7f\u7528miniQMT\u7684Python\u63a5\u53e3\u5b9e\u73b0\u7684\u6570\u636e\u83b7\u53d6\u548c\u4ea4\u6613\u6267\u884c\u3002<\/p>\n<p>\u901a\u8fc7\u524d\u51e0\u7bc7\u6587\u7ae0\u5df2\u7ecf\u57fa\u672c\u4e0a\u5c06\u884c\u60c5\u6a21\u5757XtData\u7684\u4e3b\u8981\u529f\u80fd\u8bb2\u5b8c\u4e86\uff0c\u672c\u6587\u5c06\u7cfb\u7edf\u4ecb\u7ecdXtQuant\u7684\u4ea4\u6613\u6a21\u5757(XtTrade)\u7684\u4f7f\u7528\u65b9\u6cd5\uff0c\u5bf9\u5e38\u7528\u529f\u80fd\u8fdb\u884c\u6f14\u793a\u548c\u8bb2\u89e3\u3002\u7531\u4e8e\u884c\u60c5\u4ea4\u6613\u6a21\u5757\u662f\u6709\u673a\u6574\u4f53\uff0c\u6240\u4ee5\u5c31\u4e0d\u518d\u62c6\u5206\u7ae0\u8282\uff0c\u800c\u662f\u8fd9\u4e00\u7bc7\u6587\u7ae0\u5168\u8bb2\u5b8c\u4e86\u3002<\/p>\n<h2>1. \u57fa\u672c\u6982\u5ff5\u4ecb\u7ecd<\/h2>\n<h3>1.1 XtTrade\u6a21\u5757\u6982\u8ff0<\/h3>\n<p>XtTrade\u662fXtQuant\u4e2d\u4e13\u95e8\u7528\u4e8e\u4ea4\u6613\u7684\u6a21\u5757\u3002\u5b83\u63d0\u4f9b\u4e86\u5b8c\u6574\u7684\u4ea4\u6613\u529f\u80fd\u63a5\u53e3,\u5305\u62ec:<\/p>\n<ul>\n<li>\u7cfb\u7edf\u8bbe\u7f6e\u63a5\u53e3:\u7528\u4e8e\u521b\u5efaAPI\u5b9e\u4f8b\u3001\u6ce8\u518c\u56de\u8c03\u3001\u542f\u52a8\u4ea4\u6613\u7ebf\u7a0b\u7b49\u57fa\u7840\u529f\u80fd<\/li>\n<li>\u64cd\u4f5c\u63a5\u53e3:\u63d0\u4f9b\u4e0b\u5355\u3001\u64a4\u5355\u3001\u8ba2\u9605\u7b49\u4ea4\u6613\u64cd\u4f5c\u529f\u80fd<\/li>\n<li>\u67e5\u8be2\u63a5\u53e3:\u7528\u4e8e\u67e5\u8be2\u8d26\u6237\u8d44\u4ea7\u3001\u6301\u4ed3\u3001\u59d4\u6258\u3001\u6210\u4ea4\u7b49\u4fe1\u606f<\/li>\n<li>\u56de\u8c03\u63a5\u53e3:\u7528\u4e8e\u63a5\u6536\u4ea4\u6613\u63a8\u9001\u4fe1\u606f<\/li>\n<\/ul>\n<h3>1.2 \u4ea4\u6613\u6d41\u7a0b\u6982\u8ff0<\/h3>\n<p>\u4f7f\u7528XtTrade\u8fdb\u884c\u4ea4\u6613\u7684\u57fa\u672c\u6d41\u7a0b\u5982\u4e0b:<\/p>\n<ol>\n<li>\u521b\u5efaAPI\u5b9e\u4f8b\u5e76\u6ce8\u518c\u56de\u8c03<\/li>\n<li>\u542f\u52a8\u4ea4\u6613\u7ebf\u7a0b\u5e76\u5efa\u7acb\u8fde\u63a5<\/li>\n<li>\u8ba2\u9605\u8d26\u6237\u4fe1\u606f<\/li>\n<li>\u8fdb\u884c\u4ea4\u6613\u64cd\u4f5c(\u4e0b\u5355\u3001\u64a4\u5355\u7b49)<\/li>\n<li>\u63a5\u6536\u4ea4\u6613\u63a8\u9001\u4fe1\u606f<\/li>\n<li>\u7a0b\u5e8f\u7ed3\u675f\u65f6\u53d6\u6d88\u8ba2\u9605\u5e76\u65ad\u5f00\u8fde\u63a5<\/li>\n<\/ol>\n<h2>2. \u7cfb\u7edf\u8bbe\u7f6e\u63a5\u53e3\u4f7f\u7528\u6f14\u793a<\/h2>\n<p>\u5728\u5f00\u59cb\u7f16\u5199\u4ea4\u6613\u7b56\u7565\u4e4b\u524d,\u6211\u4eec\u9700\u8981\u5148\u5b8c\u6210\u4ea4\u6613\u7cfb\u7edf\u7684\u521d\u59cb\u5316\u5de5\u4f5c\u3002\u8fd9\u90e8\u5206\u5185\u5bb9\u4e3b\u8981\u5305\u62ec\u521b\u5efaAPI\u5b9e\u4f8b\u3001\u6ce8\u518c\u56de\u8c03\u3001\u542f\u52a8\u4ea4\u6613\u7ebf\u7a0b\u7b49\u57fa\u7840\u8bbe\u7f6e,\u5c5e\u4e8e\u7a0b\u5e8f\u8fd0\u884c\u524d\u7684\u51c6\u5907\u5de5\u4f5c,\u4e0e\u5177\u4f53\u7684\u4ea4\u6613\u7b56\u7565\u5173\u8054\u4e0d\u5927\uff08\u4e0d\u8fc7\u90e8\u5206\u56de\u8c03\u529f\u80fd\u4e2d\u53ef\u4ee5\u8003\u8651\u4e0e\u7b56\u7565\u8854\u63a5\uff09\u3002<\/p>\n<p>\u8ba9\u6211\u4eec\u6309\u7167\u521d\u59cb\u5316\u7684\u6d41\u7a0b,\u9010\u6b65\u4e86\u89e3\u8fd9\u4e9b\u57fa\u7840\u8bbe\u7f6e:<\/p>\n<h3>2.1 \u521b\u5efaAPI\u5b9e\u4f8b<\/h3>\n<p>\u521b\u5efaAPI\u5b9e\u4f8b\u662f\u4f7f\u7528XtTrade\u7684\u7b2c\u4e00\u6b65\u3002\u901a\u8fc7XtQuantTrader\u7c7b\u6765\u521b\u5efa\u5b9e\u4f8b,\u9700\u8981\u63d0\u4f9b\u4e24\u4e2a\u91cd\u8981\u53c2\u6570:path\u548csession&#95;id\u3002\u524d\u8005\u662fMiniQMT\u5ba2\u6237\u7aef\u5b89\u88c5\u8def\u5f84\u4e2duserdata&#95;mini\u6587\u4ef6\u5939\u7684\u5b8c\u6574\u8def\u5f84\uff0c\u7528\u4ee5\u548cminiQMT\u5ba2\u6237\u7aef\u5efa\u7acb\u8fde\u63a5\uff1b\u540e\u8005\u662f\u4e0eMiniQMT\u901a\u4fe1\u7684\u4f1a\u8bddID\uff0c\u4e0d\u540c\u7684\u4f1a\u8bdd\u8981\u4fdd\u8bc1\u4e0d\u91cd\u3002<\/p>\n<p>\u521b\u5efa\u5b9e\u4f8b\u7684\u5199\u6cd5\u5982\u4e0b\uff0c\u5176\u4e2d\u7684session&#95;id\u6211\u7528\u4e86\u6beb\u79d2\u7ea7\u7684\u65f6\u95f4\u6233\uff0c\u53ef\u4ee5\u6bd4\u8f83\u6709\u6548\u5730\u9632\u6b62\u91cd\u590d\uff0c\u5f53\u7136\u5982\u679c\u4f60\u6709\u5176\u4ed6\u65b9\u5f0f\u4e5f\u53ef\u4ee5\u3002<\/p>\n<pre><code class=\"language-python line-numbers\">from xtquant.xttrader import XtQuantTrader\nimport time\n# \u521b\u5efaAPI\u5b9e\u4f8b\npath = \"D:\\\\XX\u8bc1\u5238QMT\u4ea4\u6613\u7aef\\\\userdata_mini\"  # miniQMT\u5ba2\u6237\u7aef\u5b89\u88c5\u76ee\u5f55\u4e0b\u7684userdata_mini\u8def\u5f84\nsession_id = int(time.time() * 1000)  # \u4f7f\u7528\u6beb\u79d2\u7ea7\u65f6\u95f4\u6233\u4f5c\u4e3a\u4f1a\u8bdd\u7f16\u53f7\ntrader = XtQuantTrader(path, session_id)\n<\/code><\/pre>\n<p>\u6ce8\u610f\u4e8b\u9879\uff1a1.\u786e\u4fddpath\u8def\u5f84\u6b63\u786e,\u5426\u5219\u65e0\u6cd5\u4e0eminiQMT\u5efa\u7acb\u8fde\u63a5\uff0c\u9700\u6839\u636e\u672c\u5730\u7535\u8111\u5b9e\u9645\u8def\u5f84\u4fee\u6539\u30022.\u901a\u5e38\u4e00\u4e2a\u7b56\u7565\u53ea\u9700\u8981\u521b\u5efa\u4e00\u4e2aAPI\u5b9e\u4f8b\u3002<\/p>\n<h3>2.2 \u521b\u5efa\u8d44\u91d1\u8d26\u53f7<\/h3>\n<p>\u5728\u8fdb\u884c\u4efb\u4f55\u4ea4\u6613\u64cd\u4f5c\u4e4b\u524d,\u6211\u4eec\u9700\u8981\u5148\u521b\u5efa\u4e00\u4e2a\u8d44\u91d1\u8d26\u53f7\u5bf9\u8c61\u3002\u8fd9\u4e2a\u8d26\u53f7\u5bf9\u8c61\u7528\u6765\u6807\u8bc6\u6211\u4eec\u8981\u64cd\u4f5c\u7684\u8bc1\u5238\u8d26\u6237\uff0c\u9700\u8981\u548c\u767b\u5f55\u7684miniQMT\u7684\u8d26\u53f7\u4fdd\u6301\u4e00\u81f4:<\/p>\n<pre><code class=\"language-python line-numbers\">from xtquant.xttype import StockAccount\n\n# \u521b\u5efa\u8bc1\u5238\u8d26\u6237\u5bf9\u8c61\naccount = StockAccount('XXXXX')  # \u53c2\u6570\u662f\u8d44\u91d1\u8d26\u53f7\n<\/code><\/pre>\n<h3>2.3 \u6ce8\u518c\u56de\u8c03\u7c7b<\/h3>\n<p>\u56de\u8c03\u7c7b\u662f\u5b9e\u73b0\u4ea4\u6613\u7cfb\u7edf\u4e0e\u7528\u6237\u7b56\u7565\u4e4b\u95f4\u901a\u4fe1\u7684\u5173\u952e\u673a\u5236\u3002\u901a\u8fc7\u56de\u8c03\u7c7b\uff0c\u6211\u4eec\u53ef\u4ee5\u5b9e\u65f6\u63a5\u6536\u4ea4\u6613\u72b6\u6001\u53d8\u5316\uff08\u5982\u59d4\u6258\u3001\u6210\u4ea4\u3001\u64a4\u5355\u7b49\uff09\uff0c\u5904\u7406\u5f02\u5e38\u60c5\u51b5\uff08\u5982\u8fde\u63a5\u65ad\u5f00\u3001\u59d4\u6258\u5931\u8d25\u7b49\uff09\uff0c\u5e76\u6839\u636e\u8fd9\u4e9b\u4fe1\u606f\u6267\u884c\u76f8\u5e94\u7684\u4ea4\u6613\u903b\u8f91\u3002<\/p>\n<p>\u56de\u8c03\u7c7b\u53ef\u4ee5\u7406\u89e3\u4e3a\u4e00\u4e2a&#8221;\u4e8b\u4ef6\u76d1\u542c\u5668&#8221;\u3002\u5f53\u6211\u4eec\u8fdb\u884c\u4ea4\u6613\u65f6,\u4f1a\u53d1\u751f\u5404\u79cd\u4e8b\u4ef6:\u6bd4\u5982\u59d4\u6258\u5355\u6210\u4ea4\u4e86\u3001\u64a4\u5355\u6210\u529f\u4e86\u3001\u8fde\u63a5\u65ad\u5f00\u4e86\u7b49\u7b49\u3002\u56de\u8c03\u7c7b\u5c31\u662f\u7528\u6765\u63a5\u6536\u8fd9\u4e9b\u4e8b\u4ef6\u901a\u77e5\u7684\u3002<\/p>\n<p>XtTrade\u6a21\u5757\u4e2d\u89c4\u5b9a\u7684\u56de\u8c03\u5305\u62ec\u5931\u53bb\u8fde\u63a5\u65f6\u63a8\u9001\u4fe1\u606f\u56de\u8c03\u3001\u8d26\u53f7\u72b6\u6001\u4fe1\u606f\u53d8\u52a8\u63a8\u9001\u7b49\u7b49\uff0c\u8fc7\u4f1a\u513f\u4f1a\u8be6\u7ec6\u4ecb\u7ecd\u3002<\/p>\n<p>\u5728\u4f7f\u7528\u56de\u8c03\u51fd\u6570\u65f6\u9700\u8981\u6ce8\u610f\uff0c\u6240\u6709\u7684\u56de\u8c03\u90fd\u662f\u5728\u4e3b\u7ebf\u7a0b\u4e2d\u6267\u884c\u7684\u3002\u8fd9\u610f\u5473\u7740\u5982\u679c\u5728\u56de\u8c03\u51fd\u6570\u4e2d\u6267\u884c\u8017\u65f6\u7684\u64cd\u4f5c\uff0c\u4f1a\u963b\u585e\u540e\u7eed\u56de\u8c03\u6d88\u606f\u7684\u5904\u7406\u3002\u5f53\u56de\u8c03\u51fd\u6570\u6267\u884c\u65f6\u95f4\u8fc7\u957f\u65f6\uff0c\u53ef\u80fd\u4f1a\u9519\u8fc7\u91cd\u8981\u7684\u4ea4\u6613\u4fe1\u606f\uff0c\u6216\u8005\u5bfc\u81f4\u5176\u4ed6\u56de\u8c03\u5904\u7406\u53d1\u751f\u5ef6\u8fdf\uff0c\u4ece\u800c\u5f71\u54cd\u6574\u4e2a\u4ea4\u6613\u7cfb\u7edf\u7684\u54cd\u5e94\u6027\u3002\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d\uff0c\u5efa\u8bae\u5c06\u56de\u8c03\u51fd\u6570\u7684\u5b9e\u73b0\u4fdd\u6301\u7b80\u5355\u548c\u9ad8\u6548\u3002\u53ef\u4ee5\u5728\u56de\u8c03\u51fd\u6570\u4e2d\u8fdb\u884c\u5fc5\u8981\u7684\u65e5\u5fd7\u8bb0\u5f55\u3001\u72b6\u6001\u68c0\u67e5\u7b49\u8f7b\u91cf\u7ea7\u64cd\u4f5c\uff0c\u4f46\u590d\u6742\u7684\u4e1a\u52a1\u903b\u8f91\u6700\u597d\u653e\u5728\u72ec\u7acb\u7684\u5904\u7406\u7ebf\u7a0b\u4e2d\u6267\u884c\u3002\u540c\u65f6\uff0c\u8981\u6ce8\u610f\u505a\u597d\u5f02\u5e38\u5904\u7406\uff0c\u907f\u514d\u56e0\u4e3a\u56de\u8c03\u51fd\u6570\u7684\u5f02\u5e38\u5bfc\u81f4\u6574\u4e2a\u4ea4\u6613\u7cfb\u7edf\u53d7\u5230\u5f71\u54cd\u3002<\/p>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u5305\u542b\u4e3b\u8981\u56de\u8c03\u65b9\u6cd5\u7684\u5b98\u65b9\u793a\u4f8b\uff08<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/dict.thinktrader.net\/nativeApi\/code_examples.html?id=x3GDHP#%E5%85%A8%E6%8E%A8%E8%AE%A2%E9%98%85%E5%AE%9E%E7%9B%98%E7%A4%BA%E4%BE%8B\">\u6848\u4f8b\u8fde\u63a5<\/a>\uff09\uff0c\u5176\u4e2d\u6f14\u793a\u7684\u662f\u6700\u7b80\u5355\u7684\u901a\u8fc7\u6253\u5370\u6765\u8fdb\u884c\u4fe1\u606f\u901a\u77e5\u7684\u5904\u7406\u65b9\u5f0f\uff1a<\/p>\n<pre><code class=\"language-python line-numbers\">from xtquant.xttrader import XtQuantTraderCallback\n\nclass MyXtQuantTraderCallback(XtQuantTraderCallback):\n    def on_disconnected(self):\n        \"\"\"\n        \u8fde\u63a5\u65ad\u5f00\n        :return:\n        \"\"\"\n        print(datetime.datetime.now(),'\u8fde\u63a5\u65ad\u5f00\u56de\u8c03')\n\n    def on_stock_order(self, order):\n        \"\"\"\n        \u59d4\u6258\u56de\u62a5\u63a8\u9001\n        :param order: XtOrder\u5bf9\u8c61\n        :return:\n        \"\"\"\n        print(datetime.datetime.now(), '\u59d4\u6258\u56de\u8c03', order.order_remark)\n\n\n    def on_stock_trade(self, trade):\n        \"\"\"\n        \u6210\u4ea4\u53d8\u52a8\u63a8\u9001\n        :param trade: XtTrade\u5bf9\u8c61\n        :return:\n        \"\"\"\n        print(datetime.datetime.now(), '\u6210\u4ea4\u56de\u8c03', trade.order_remark)\n\n\n    def on_order_error(self, order_error):\n        \"\"\"\n        \u59d4\u6258\u5931\u8d25\u63a8\u9001\n        :param order_error:XtOrderError \u5bf9\u8c61\n        :return:\n        \"\"\"\n        # print(\"on order_error callback\")\n        # print(order_error.order_id, order_error.error_id, order_error.error_msg)\n        print(f\"\u59d4\u6258\u62a5\u9519\u56de\u8c03 {order_error.order_remark} {order_error.error_msg}\")\n\n    def on_cancel_error(self, cancel_error):\n        \"\"\"\n        \u64a4\u5355\u5931\u8d25\u63a8\u9001\n        :param cancel_error: XtCancelError \u5bf9\u8c61\n        :return:\n        \"\"\"\n        print(datetime.datetime.now(), sys._getframe().f_code.co_name)\n\n    def on_order_stock_async_response(self, response):\n        \"\"\"\n        \u5f02\u6b65\u4e0b\u5355\u56de\u62a5\u63a8\u9001\n        :param response: XtOrderResponse \u5bf9\u8c61\n        :return:\n        \"\"\"\n        print(f\"\u5f02\u6b65\u59d4\u6258\u56de\u8c03 {response.order_remark}\")\n\n    def on_cancel_order_stock_async_response(self, response):\n        \"\"\"\n        \u6536\u5230\u64a4\u5355\u56de\u8c03\u4fe1\u606f\n        :param response: XtCancelOrderResponse \u5bf9\u8c61\n        :return:\n        \"\"\"\n        print(datetime.datetime.now(), sys._getframe().f_code.co_name)\n\n    def on_account_status(self, status):\n        \"\"\"\n        \u8d26\u53f7\u72b6\u6001\u4fe1\u606f\u53d8\u52a8\u63a8\u9001\n        :param response: XtAccountStatus \u5bf9\u8c61\n        :return:\n        \"\"\"\n        print(datetime.datetime.now(), sys._getframe().f_code.co_name)\n<\/code><\/pre>\n<p>\u4ee5\u4e0a\u516b\u79cd\u56de\u8c03\u7c7b\u662f\u5b98\u65b9\u6587\u6863\u4e2d\u63d0\u5230\u4e86\u7684\uff0c\u636e\u6211\u67e5\u770bxtquant.xttrader\u7684\u6e90\u7801\uff0c\u6240\u80fd\u652f\u6301\u7684\u56de\u8c03\u7c7b\u5e94\u8be5\u8fd8\u6709\u4ee5\u4e0b\u8fd9\u51e0\u79cd\uff0c\u5927\u5bb6\u53ef\u4ee5\u5728\u5b9e\u6218\u4e2d\u5b9e\u9a8c\u7504\u522b\uff1a<\/p>\n<pre><code class=\"language-python line-numbers\">def on_stock_position(self, position):\n        \"\"\"\n        \u6301\u4ed3\u53d8\u52a8\u63a8\u9001\uff0c\u6839\u636e\uff1ahttps:\/\/blog.csdn.net\/liuyukuan\/article\/details\/128754695\n        :param position: XtPosition\u5bf9\u8c61\n        :return:\n        \"\"\"\n        print(\"on position callback\")\n        print(position.stock_code, position.volume)\n\ndef on_connected(self):\n        \"\"\"\n        \u8fde\u63a5\u6210\u529f\u63a8\u9001\n        \"\"\"\n        pass\n\ndef on_stock_asset(self,asset):\n        \"\"\"\n        \u8d44\u91d1\u53d8\u52a8\u63a8\u9001\uff0c\u6839\u636e\uff1ahttps:\/\/blog.csdn.net\/liuyukuan\/article\/details\/128754695\n        :param asset: XtAsset\u5bf9\u8c61\n        :return:\n        \"\"\"\n        print(\"\u8d44\u91d1\u53d8\u52a8\u63a8\u9001on asset callback\")\n        print(asset.account_id,asset.cash,asset.total_asset)\n<\/code><\/pre>\n<p>\u521b\u5efa\u597d\u56de\u8c03\u7c7b\u540e,\u9700\u8981\u5c06\u5176\u5b9e\u4f8b\u6ce8\u518c\u5230\u4ea4\u6613\u5bf9\u8c61\u4e2d\u624d\u80fd\u751f\u6548\u3002\u8fd9\u4e00\u6b65\u901a\u8fc7register&#95;callback\u65b9\u6cd5\u5b8c\u6210:<\/p>\n<pre><code class=\"language-python line-numbers\"># \u521b\u5efa\u5e76\u6ce8\u518c\u56de\u8c03\u5b9e\u4f8b\ncallback = MyXtQuantTraderCallback()\ntrader.register_callback(callback)\n<\/code><\/pre>\n<p>\u6ce8\u518c\u5b8c\u6210\u540e,\u5f53\u4ea4\u6613\u7cfb\u7edf\u53d1\u751f\u76f8\u5e94\u4e8b\u4ef6\u65f6,XtQuant\u4f1a\u81ea\u52a8\u8c03\u7528\u5bf9\u5e94\u7684\u56de\u8c03\u65b9\u6cd5\u3002\u6bd4\u5982\u5f53\u53d1\u51fa\u4e00\u4e2a\u4e70\u5165\u59d4\u6258\u540e,\u4ea4\u6613\u6240\u8fd4\u56de\u72b6\u6001\u53d8\u5316\u65f6,\u7cfb\u7edf\u4f1a\u81ea\u52a8\u8c03\u7528\u5df2\u6ce8\u518c\u7684MyXtQuantTraderCallback\u4e2d\u7684on&#95;stock&#95;order\u65b9\u6cd5\u3002<\/p>\n<p>\u5728\u4f7f\u7528\u56de\u8c03\u65f6\u9700\u8981\u6ce8\u610f\uff1a1.\u5efa\u8bae\u53ea\u6ce8\u518c\u4e00\u4e2a\u56de\u8c03\u5b9e\u4f8b\uff1b2.\u8981\u505a\u597d\u5f02\u5e38\u5904\u7406,\u907f\u514d\u5f71\u54cd\u5176\u4ed6\u56de\u8c03\u7684\u6267\u884c\uff1b3.\u53ef\u4ee5\u6839\u636e\u9700\u8981\u53ea\u5b9e\u73b0\u5fc5\u8981\u7684\u56de\u8c03\u65b9\u6cd5,\u672a\u5b9e\u73b0\u7684\u65b9\u6cd5\u4f1a\u88ab\u5ffd\u7565\u3002<\/p>\n<h3>2.4 \u542f\u52a8\u4ea4\u6613\u7ebf\u7a0b\u5e76\u5efa\u7acb\u8fde\u63a5<\/h3>\n<p>\u5b8c\u6210\u56de\u8c03\u6ce8\u518c,\u9700\u8981\u542f\u52a8\u4ea4\u6613\u7ebf\u7a0b\u5e76\u5efa\u7acb\u8fde\u63a5\u3002\u8fd9\u4e24\u4e2a\u6b65\u9aa4\u5fc5\u987b\u6309\u987a\u5e8f\u6267\u884c,\u4e14\u90fd\u6210\u529f\u624d\u80fd\u8fdb\u884c\u540e\u7eed\u64cd\u4f5c\u3002<\/p>\n<p>\u6b64\u5916\u8fd8\u53ef\u4ee5\u8bbe\u7f6e\u4e3b\u52a8\u8bf7\u6c42\u63a5\u53e3\u7684\u8fd4\u56de\u662f\u5426\u4f7f\u7528\u4e13\u7528\u7ebf\u7a0b\u3002<\/p>\n<h3>2.4.1 \u542f\u52a8\u4ea4\u6613\u7ebf\u7a0b(start)<\/h3>\n<p>start()\u65b9\u6cd5\u7528\u4e8e\u542f\u52a8\u4ea4\u6613\u7ebf\u7a0b,\u4e3a\u540e\u7eed\u7684\u4ea4\u6613\u64cd\u4f5c\u505a\u51c6\u5907:<\/p>\n<pre><code class=\"language-python line-numbers\"># \u542f\u52a8\u4ea4\u6613\u7ebf\u7a0b\ntrader.start()\n<\/code><\/pre>\n<h3>2.4.2 \u5efa\u7acb\u8fde\u63a5(connect)<\/h3>\n<p>connect()\u65b9\u6cd5\u7528\u4e8e\u4e0eminiQMT\u5efa\u7acb\u8fde\u63a5:<\/p>\n<pre><code class=\"language-python line-numbers\"># \u5efa\u7acb\u8fde\u63a5\nconnect_result = trader.connect()\nif connect_result == 0:\n    print(\"\u8fde\u63a5\u6210\u529f\")\nelse:\n    print(\"\u8fde\u63a5\u5931\u8d25\")\n<\/code><\/pre>\n<p>\u8bf4\u660e:<br \/>\n* \u5fc5\u987b\u5728start()\u4e4b\u540e\u8c03\u7528<br \/>\n* \u8fd4\u56de0\u8868\u793a\u8fde\u63a5\u6210\u529f,\u5176\u4ed6\u503c\u8868\u793a\u5931\u8d25<br \/>\n* \u8fde\u63a5\u65ad\u5f00\u540e\u9700\u8981\u91cd\u65b0\u8c03\u7528\u624d\u80fd\u6062\u590d\u8fde\u63a5<br \/>\n* \u4e0d\u9700\u8981\u53c2\u6570<\/p>\n<h3>2.4.3 \u8bbe\u7f6e\u8bf7\u6c42\u7ebf\u7a0b(set&#95;relaxed&#95;response&#95;order&#95;enabled)<\/h3>\n<p>\u7528\u4e8e\u63a7\u5236\u4e3b\u52a8\u8bf7\u6c42\u63a5\u53e3\u7684\u8fd4\u56de\u662f\u5426\u4f7f\u7528\u4e13\u7528\u7ebf\u7a0b\uff0c\u8fd9\u4e2a\u529f\u80fd\u9700\u8981\u5355\u72ec\u8bf4\u660e\u4e00\u4e0b\uff0c\u56e0\u4e3a\u6839\u636e\u5b98\u65b9\u6587\u6863\uff0c\u5176\u662f\u5426\u5f00\u542f\u9700\u8981\u6839\u636e\u7b56\u7565\u662f\u5b9e\u9645\u60c5\u51b5\u51b3\u5b9a\uff0c\u4ee5\u4e0b\u662f\u5173\u4e8e\u6b64\u529f\u80fd\u7684\u5b98\u65b9\u8bf4\u660e\uff1a<\/p>\n<blockquote><p>\n  set&#95;relaxed&#95;response&#95;order&#95;enabled(enabled)<\/p>\n<p>  \u63a7\u5236\u4e3b\u52a8\u8bf7\u6c42\u63a5\u53e3\u7684\u8fd4\u56de\u662f\u5426\u4ece\u989d\u5916\u7684\u4e13\u7528\u7ebf\u7a0b\u8fd4\u56de\uff0c\u4ee5\u83b7\u5f97\u5bbd\u677e\u7684\u6570\u636e\u65f6\u5e8f<\/p>\n<p>  \u4e0d\u5f00\u542f\uff08enabled=False\uff09\u6548\u679c\uff1a\u5728on&#95;stock&#95;xxx\u56de\u8c03\u51fd\u6570\u91cc\u8c03\u7528XtQuantTrader.query&#95;xxx\u51fd\u6570\u4f1a\u9020\u6210\u56de\u8c03\u7ebf\u7a0b\u5361\u4f4f\uff0c\u540e\u7eed\u56de\u8c03\u4f1a\u63a5\u6536\u4e0d\u5230<\/p>\n<p>  \u5f00\u542f\u6548\u679c\uff08enabled=True\uff09\u6548\u679c\uff1a\u5728on&#95;stock&#95;xxx\u56de\u8c03\u51fd\u6570\u91cc\u8c03\u7528XtQuantTrader.query&#95;xxx\u51fd\u6570\u4e0d\u4f1a\u5361\u4f4f\u56de\u8c03\u7ebf\u7a0b\uff0c\u4f46\u662f\u67e5\u8be2\u548c\u63a8\u9001\u7684\u6570\u636e\u5728\u65f6\u5e8f\u4e0a\u4f1a\u53d8\u5f97\u4e0d\u786e\u5b9a\uff0c\u53c2\u8003\u4e0b\u9762\u7684\u5907\u6ce8\u8bf4\u660e<\/p>\n<p>  \u53c2\u6570\uff1a<\/p>\n<p>  enabled &#8211; bool \u662f\u5426\u5f00\u542f\uff0c\u9ed8\u8ba4\u4e3aFalse\u5173\u95ed<\/p>\n<p>  \u8fd4\u56de\uff1a\u65e0<\/p>\n<p>  \u5907\u6ce8\uff1a\u5982\u679c\u5f00\u542f\uff0c\u5728on&#95;stock&#95;order\u7b49\u63a8\u9001\u56de\u8c03\u4e2d\u8c03\u7528\u540c\u6b65\u8bf7\u6c42\u4e0d\u4f1a\u5361\u4f4f\uff0c\u4f46\u67e5\u8be2\u548c\u63a8\u9001\u7684\u6570\u636e\u5728\u65f6\u5e8f\u4e0a\u4f1a\u53d8\u5f97\u4e0d\u786e\u5b9a\n<\/p><\/blockquote>\n<pre><code class=\"language-python line-numbers\">timeline    t1  t2  t3  t4\ncallback    push1   push2   push3   resp4\ndo      query4 ------------------^\n<\/code><\/pre>\n<blockquote><p>\n  \u4f8b\u5982\uff1a\u5206\u522b\u5728t1 t2 t3\u65f6\u523b\u5230\u8fbe\u4e09\u6761\u59d4\u6258\u6570\u636e\uff0c\u5728on&#95;push1\u4e2d\u8c03\u7528\u540c\u6b65\u59d4\u6258\u67e5\u8be2\u63a5\u53e3query&#95;orders()<\/p>\n<p>  \u672a\u5f00\u542f\u5bbd\u677e\u65f6\u5e8f\u65f6\uff0c\u67e5\u8be2\u8fd4\u56deresp4\u4f1a\u5728t4\u65f6\u523b\u6392\u961f\u5230push3\u5b8c\u6210\u4e4b\u540e\u5904\u7406\uff0c\u8fd9\u4f7f\u5f97\u540c\u6b65\u7b49\u5f85\u7ed3\u679c\u7684\u67e5\u8be2\u4e0d\u80fd\u8fd4\u56de\u800c\u5361\u4f4f\u6267\u884c<\/p>\n<p>  \u5f00\u542f\u5bbd\u677e\u65f6\u5e8f\u65f6\uff0c\u67e5\u8be2\u8fd4\u56de\u7684resp4\u7531\u4e13\u7528\u7ebf\u7a0b\u8fd4\u56de\uff0c\u7a0b\u5e8f\u6b63\u5e38\u6267\u884c\uff0c\u4f46\u6b64\u65f6\u67e5\u5230\u7684resp4\u662fpush3\u4e4b\u540e\u7684\u72b6\u6001\uff0c\u4e5f\u5c31\u662f\u8bf4resp4\u4e2d\u7684\u59d4\u6258\u8981\u6bd4push2 push3\u8fd9\u4e24\u4e2a\u524d\u4e00\u65f6\u523b\u63a8\u9001\u7684\u6570\u636e\u65b0\uff0c\u4f46\u5728\u66f4\u65e9\u7684t1\u65f6\u523b\u5c31\u8fdb\u5165\u4e86\u5904\u7406<\/p>\n<p>  \u4f7f\u7528\u4e2d\u8bf7\u6839\u636e\u7b56\u7565\u5b9e\u9645\u60c5\u51b5\u6765\u5f00\u542f\uff0c\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u63a8\u8350\u5728on&#95;stock&#95;order\u7b49\u63a8\u9001\u56de\u8c03\u4e2d\u4f7f\u7528\u67e5\u8be2\u63a5\u53e3\u7684\u5f02\u6b65\u7248\u672c\uff0c\u5982query&#95;stock&#95;orders&#95;async\n<\/p><\/blockquote>\n<p>\u7136\u800c\u6211\u5728\u5b98\u65b9\u6587\u6863\u672a\u627e\u5230query&#95;stock&#95;orders&#95;async\u7684\u66f4\u591a\u8bf4\u660e\u3002<\/p>\n<p>\u603b\u800c\u8a00\u4e4b\uff0c\u8fd9\u91cc\u8bf7\u5927\u5bb6\u6839\u636e\u5404\u81ea\u7b56\u7565\u4ed4\u7ec6\u659f\u914c\u8bbe\u7f6e\u3002<\/p>\n<h3>2.5 \u8fd0\u884c\u4e0e\u505c\u6b62<\/h3>\n<p>XtTrade\u63d0\u4f9b\u4e86run&#95;forever()\u51fd\u6570\uff0c\u4f5c\u4e3a\u4fdd\u6301\u7a0b\u5e8f\u8fd0\u884c\u7684\u65b9\u5f0f\uff1a<\/p>\n<pre><code class=\"language-python line-numbers\">#xt_trader\u4e3aXtQuant API\u5b9e\u4f8b\u5bf9\u8c61\ntrader.run_forever()  # \u4f1a\u4e00\u76f4\u963b\u585e,\u76f4\u5230\u8c03\u7528stop()\u6216\u6309Ctrl+C\n<\/code><\/pre>\n<p>\u7ed3\u675f\u7684\u4e5f\u5f88\u7b80\u5355\uff0c\u8fd0\u884c\u5982\u4e0b\u4ee3\u7801\u5373\u53ef\uff1a<\/p>\n<pre><code class=\"language-python line-numbers\">#xt_trader\u4e3aXtQuant API\u5b9e\u4f8b\u5bf9\u8c61\nxt_trader.stop()\n<\/code><\/pre>\n<p>\u6ce8\u610f\uff1a<br \/>\n* run&#95;forever(): \u963b\u585e\u5f53\u524d\u7ebf\u7a0b,\u9002\u5408\u5355\u4e00\u7b56\u7565\u7a0b\u5e8f<br \/>\n* stop(): \u505c\u6b62\u4ea4\u6613\u7ebf\u7a0b,\u9000\u51fa\u7a0b\u5e8f\u65f6\u8c03\u7528<\/p>\n<h3>2.6 \u5b8c\u6574\u7684\u521d\u59cb\u5316\u793a\u4f8b<\/h3>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u5b8c\u6574\u521d\u59cb\u5316\u793a\u4f8b\uff0c\u4e3a\u4e86\u4e0d\u8d58\u8ff0\u56de\u8c03\u7c7b\u7b80\u5355\u5730\u5217\u4e3e\u4e86\u4e09\u4e2a\uff0c\u5b9e\u9645\u4f7f\u7528\u4e2d\u8981\u6839\u636e\u9700\u6c42\u6dfb\u52a0\u3002\u6b64\u5916miniQMT\u7684\u8def\u5f84\u548c\u8d44\u91d1\u8d26\u53f7\u4e5f\u8981\u6839\u636e\u4f60\u7684\u5b9e\u9645\u60c5\u51b5\u586b\u5199\u3002\u8fd0\u884c\u4e0b\u8fb9\u4ee3\u7801\uff0c\u5982\u679c\u8fde\u63a5\u6b63\u5e38\u5c06\u4f1a\u5728\u547d\u4ee4\u884c\u7a97\u53e3\u8f93\u51fa0\u3002<\/p>\n<p>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5bf9\u884c\u60c5\u6570\u636e\u7684\u8ba2\u9605\u4e00\u822c\u4e5f\u5728\u521d\u59cb\u5316\u4e2d\u5b8c\u6210\uff0c\u5728\u4e0b\u4f8b\u4e2d\u5c31\u4e0d\u6f14\u793a\u4e86\u3002<\/p>\n<pre><code class=\"language-python line-numbers\">from xtquant.xttrader import XtQuantTrader, XtQuantTraderCallback\nfrom xtquant.xttype import StockAccount\nimport time\n\n# 1. \u521b\u5efa\u56de\u8c03\u7c7b\nclass MyCallback(XtQuantTraderCallback):\n    def on_disconnected(self):\n        \"\"\"\u8fde\u63a5\u65ad\u5f00\u65f6\u56de\u8c03\"\"\"\n        print(\"\u8fde\u63a5\u65ad\u5f00\")\n\n    def on_stock_order(self, order):\n        \"\"\"\u59d4\u6258\u56de\u62a5\u63a8\u9001\"\"\"\n        print(f\"\u6536\u5230\u59d4\u6258\u56de\u62a5: {order.stock_code} {order.order_status}\")\n\n    def on_stock_trade(self, trade):\n        \"\"\"\u6210\u4ea4\u56de\u62a5\u63a8\u9001\"\"\"\n        print(f\"\u6536\u5230\u6210\u4ea4\u56de\u62a5: {trade.stock_code} {trade.traded_volume}\")\n   #\u8fd8\u6709\u5176\u4ed6\u56de\u8c03\u7c7b\u4e0d\u4e00\u4e00\u5217\u4e3e\uff0c\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u7f16\u5199\n\n# 2. \u521b\u5efaAPI\u5b9e\u4f8b\npath = r'D:\\XX\u8bc1\u5238QMT\u4ea4\u6613\u7aef\\userdata_mini'  # miniQMT\u5ba2\u6237\u7aef\u5b89\u88c5\u76ee\u5f55\u4e0b\u7684userdata_mini\u8def\u5f84\nsession_id = int(time.time() * 1000)  # \u4f7f\u7528\u6beb\u79d2\u7ea7\u65f6\u95f4\u6233\u4f5c\u4e3a\u4f1a\u8bdd\u7f16\u53f7\ntrader = XtQuantTrader(path, session_id)\n\n# 3. \u521b\u5efa\u8d44\u91d1\u8d26\u53f7\naccount = StockAccount('XXX')  # \u8fd9\u91cc\u586b\u5199\u5b9e\u9645\u7684\u8d44\u91d1\u8d26\u53f7\n\n# 4. \u6ce8\u518c\u56de\u8c03\u5b9e\u4f8b\ncallback = MyCallback()\ntrader.register_callback(callback)\n\n# 5. \u542f\u52a8\u4ea4\u6613\u7ebf\u7a0b\ntrader.start()\n\n# 6. \u5efa\u7acb\u8fde\u63a5\nconnect_result = trader.connect()\nprint(f\"\u8fde\u63a5\u7ed3\u679c: {connect_result}\")  # 0\u8868\u793a\u6210\u529f\n\n# 7. \u4fdd\u6301\u7a0b\u5e8f\u8fd0\u884c\ntry:\n    trader.run_forever()\nexcept KeyboardInterrupt:  #\u5728\u547d\u4ee4\u884c\u8f93\u5165Ctrl+C\n    print(\"\u7a0b\u5e8f\u7ed3\u675f\")\n<\/code><\/pre>\n<h2>3. \u64cd\u4f5c\u63a5\u53e3\u4f7f\u7528\u6f14\u793a<\/h2>\n<p>\u4e0a\u8fb9\u8bb2\u4e86\u521d\u59cb\u5316\u8981\u7528\u5230\u7684\u4e00\u7cfb\u5217\u8bbe\u7f6e\u3002\u73b0\u5728\u8bb2\u4e00\u8bb2\u5728\u5b9e\u76d8\u64cd\u4f5c\u4e2d\u8981\u7528\u5230\u7684\u4e00\u4e9b\u63a5\u53e3\u3002<\/p>\n<p>\u64cd\u4f5c\u63a5\u53e3\u4e3b\u8981\u5305\u62ec\u8ba2\u9605\u8d26\u6237\u3001\u62a5\u5355\u3001\u64a4\u5355\u7b49\u529f\u80fd\u3002<\/p>\n<h3>3.1 \u8d26\u6237\u8ba2\u9605\u4e0e\u53cd\u8ba2\u9605<\/h3>\n<p>\u4f7f\u7528subscribe\u8ba2\u9605\u8d26\u53f7\u4fe1\u606f\uff0c\u5305\u62ec\u8d44\u91d1\u8d26\u53f7\u3001\u59d4\u6258\u4fe1\u606f\u3001\u6210\u4ea4\u4fe1\u606f\u3001\u6301\u4ed3\u4fe1\u606f\u3002\u4f7f\u7528unsubscribe\u53cd\u8ba2\u9605\u8d26\u53f7\u4fe1\u606f\uff0c\u8ba2\u9605\/\u53cd\u8ba2\u9605\u6210\u529f\u8fd4\u56de0\uff0c\u8ba2\u9605\/\u53cd\u8ba2\u9605\u5931\u8d25\u8fd4\u56de-1\u3002<\/p>\n<p>\u8d26\u6237\u8ba2\u9605\u4e5f\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u64cd\u4f5c\uff0c\u53ef\u4ee5\u5c06\u8fd9\u4e00\u6b65\u653e\u5728\u521d\u59cb\u5316\u5f53\u4e2d\u3002<\/p>\n<pre><code class=\"language-python line-numbers\"># \u793a\u610f\u4ee3\u7801\uff0c\u65e0\u6cd5\u76f4\u63a5\u8fd0\u884c\naccount = StockAccount('XXX')\n#xt_trader\u4e3aXtQuant API\u5b9e\u4f8b\u5bf9\u8c61\nsubscribe_result = xt_trader.subscribe(account)      #\u8ba2\u9605\nunsubscribe_result = xt_trader.unsubscribe(account)  #\u53cd\u8ba2\u9605\n<\/code><\/pre>\n<h3>3.2 \u80a1\u7968\u4ea4\u6613\u64cd\u4f5c<\/h3>\n<p>\u5e38\u7528\u7684\u80a1\u7968\u64cd\u4f5c\u5176\u5b9e\u5c31\u4e24\u79cd\uff1a\u62a5\u5355\u548c\u64a4\u5355\uff0c\u800c\u5176\u4e2d\u53c8\u5206\u540c\u6b65\u64cd\u4f5c\u548c\u5f02\u6b65\u64cd\u4f5c\u4e24\u79cd\u3002\u6240\u4ee5\u5e38\u7528\u51fd\u6570\u6709\u56db\u4e2a\uff1a<\/p>\n<p>\u80a1\u7968\u540c\u6b65\u62a5\u5355\uff08order&#95;stock\uff09\u3001\u80a1\u7968\u5f02\u6b65\u62a5\u5355\uff08order&#95;stock&#95;async\uff09\u3001\u80a1\u7968\u540c\u6b65\u64a4\u5355\uff08cancel&#95;order&#95;stock\uff09\u3001\u80a1\u7968\u5f02\u6b65\u64a4\u5355\uff08cancel&#95;order&#95;stock&#95;async\uff09\uff0c\u8fd9\u51e0\u4e2a\u51fd\u6570\u63a5\u53e3\u8bf4\u660e\u89c1\u9644\u5f55\u3002<\/p>\n<p>\u5173\u4e8e\u540c\u6b65\u548c\u5f02\u6b65\u7684\u533a\u522b\uff1a\u540c\u6b65\u6307\u7a0b\u5e8f\u6309\u7167\u987a\u5e8f\u9010\u6b65\u6267\u884c\uff0c\u76f4\u5230\u4e00\u4e2a\u64cd\u4f5c\u5b8c\u6210\u540e\u624d\u80fd\u6267\u884c\u4e0b\u4e00\u4e2a\u64cd\u4f5c\uff1b\u5f02\u6b65\u662f\u6307\u7a0b\u5e8f\u53ef\u4ee5\u7ee7\u7eed\u6267\u884c\u540e\u7eed\u64cd\u4f5c\uff0c\u4e0d\u9700\u8981\u7b49\u5f85\u67d0\u4e2a\u64cd\u4f5c\u7684\u5b8c\u6210\u3002<\/p>\n<p>\u8fd9\u91cc\u5f15\u7528\u5176\u4ed6\u6587\u7ae0\u91cc\u7684\u4e00\u6bb5\u63cf\u8ff0\uff08<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/mp.weixin.qq.com\/s\/qSzbIncJDCCJlHQPzijdrQ\">\u8bf4\u4e00\u8bf4qmt\u7684\u8fd0\u884c\u903b\u8f91\u2014\u2014\uff08\u9644\u5f02\u6b65\u7f16\u7a0b\u4ee3\u7801\uff09<\/a>\uff09\uff1a<\/p>\n<blockquote><p>\n  \u90a3\u540c\u6b65\u7f16\u7a0b\u548c\u5f02\u6b65\u7f16\u7a0b\u6709\u5565\u4e0d\u4e00\u6837\u5462\uff1f\u8fd8\u662f\u7528\u6211\u5988\u505a\u996d\u7684\u4f8b\u5b50\u6765\u8bf4\uff0c\u540c\u6b65\u7f16\u7a0b\u662f\u7b49\u4e00\u4ef6\u4e8b\u505a\u5b8c\u4ee5\u540e\uff0c\u518d\u53bb\u505a\u53e6\u5916\u4e00\u4ef6\u4e8b\u60c5\uff0c\u5f02\u6b65\u5c31\u662f\u53ef\u4ee5\u5728\u4e00\u4ef6\u4e8b\u6ca1\u505a\u5b8c\u7684\u60c5\u51b5\u4e0b\uff0c\u53bb\u505a\u5176\u4ed6\u7684\u4e8b\u60c5\uff0c\u6240\u4ee5\u5f02\u6b65\u6700\u5927\u7684\u597d\u5904\u5c31\u662f\u5feb\uff0c\u90a3\u76f8\u5e94\u7684\uff0c\u4e5f\u4f1a\u589e\u52a0\u505a\u4e8b\u60c5\u7684\u590d\u6742\u5ea6\uff0c\u5927\u5bb6\u81ea\u5df1\u505a\u8fc7\u996d\u5c31\u77e5\u9053\uff0c\u5982\u679c\u540c\u65f6\u505a\u5f88\u591a\u4e8b\u60c5\uff0c\u6709\u53ef\u80fd\u4f1a\u5fd9\u5f97\u624b\u5fd9\u811a\u4e71\u7684\uff0c\u540c\u6b65\u7684\u597d\u5904\u5c31\u662f\u7b80\u5355\uff0c\u4e00\u6b65\u4e00\u6b65\u5f80\u4e0b\u8d70\uff0c\u80af\u5b9a\u4e0d\u4f1a\u51fa\u9519\u3002\n<\/p><\/blockquote>\n<p>\u5f02\u6b65\u4ea4\u6613\u662f\u548c\u4e4b\u524d\u8bb2\u5230\u7684\u56de\u8c03\u76f8\u5173\u8054\u7684\uff1a\u5bf9\u80a1\u7968\u8fdb\u884c\u5f02\u6b65\u4e0b\u5355\u64cd\u4f5c\uff0c\u5f02\u6b65\u4e0b\u5355\u63a5\u53e3\u5982\u679c\u6b63\u5e38\u8fd4\u56de\u4e86\u4e0b\u5355\u8bf7\u6c42\u5e8f\u53f7seq\uff0c\u4f1a\u6536\u5230on&#95;order&#95;stock&#95;async&#95;response\u7684\u59d4\u6258\u53cd\u9988\uff1b\u6211\u731c\u6d4b\uff08\u56e0\u4e3a\u5b98\u7f51\u6587\u6863\u6ca1\u8bf4\uff09\uff0c\u5bf9\u80a1\u7968\u8fdb\u884c\u5f02\u6b65\u64a4\u5355\uff0c\u5982\u679c\u6b63\u5e38\u8fd4\u56de\u64a4\u5355\u8bf7\u6c42\u5e8f\u53f7\uff0c\u4f1a\u6536\u5230on&#95;cancel&#95;order&#95;stock&#95;async&#95;response\u7684\u59d4\u6258\u53cd\u9988\u3002<\/p>\n<pre><code class=\"language-python line-numbers\"># \u8be5\u4ee3\u7801\u4ec5\u505a\u6848\u4f8b\u6f14\u793a\uff0c\u4e0d\u80fd\u76f4\u63a5\u8fd0\u884c\nfrom xtquant import xtconstant\n\n# 1. \u540c\u6b65\u4e0b\u5355\norder_id = trader.order_stock(\n    account=account,  # \u8d26\u6237\n    stock_code=\"XXXXXX.SH\",  # \u80a1\u7968\u4ee3\u7801\n    order_type=xtconstant.STOCK_BUY,  # \u4e70\u5165\n    order_volume=100,  # \u59d4\u6258\u6570\u91cf\uff0c\u5355\u4f4d\u662f\u80a1\n    price_type=xtconstant.FIX_PRICE,  # \u9650\u4ef7\u59d4\u6258\n    price=10.5,  # \u59d4\u6258\u4ef7\u683c\n    strategy_name=\"strategy1\",  # \u7b56\u7565\u540d\u79f0\n    order_remark=\"test\"  # \u59d4\u6258\u5907\u6ce8\n)\nprint(f\"\u4e0b\u5355\u7ed3\u679c\u8ba2\u5355\u53f7: {order_id}\")\n\n# 2. \u5f02\u6b65\u4e0b\u5355\nseq = trader.order_stock_async(\n    account=account,\n    stock_code=\"XXXXXX.SH\",\n    order_type=xtconstant.STOCK_BUY,\n    order_volume=100,\n    price_type=xtconstant.FIX_PRICE,\n    price=10.5,\n    strategy_name=\"strategy1\",\n    order_remark=\"test\"\n)\nprint(f\"\u5f02\u6b65\u4e0b\u5355\u8bf7\u6c42\u5e8f\u53f7: {seq}\")\n\n# 3. \u540c\u6b65\u64a4\u5355\ncancel_result = trader.cancel_order_stock(\n    account=account,\n    order_id=order_id  # \u8981\u64a4\u9500\u7684\u8ba2\u5355\u53f7\n)\nprint(f\"\u64a4\u5355\u7ed3\u679c: {cancel_result}\")  # 0\u8868\u793a\u6210\u529f\n\n# 4. \u5f02\u6b65\u64a4\u5355\ncancel_seq = trader.cancel_order_stock_async(\n    account=account,\n    order_id=order_id\n)\nprint(f\"\u5f02\u6b65\u64a4\u5355\u8bf7\u6c42\u5e8f\u53f7: {cancel_seq}\")\n<\/code><\/pre>\n<h2>4.\u67e5\u8be2\u63a5\u53e3\u4f7f\u7528\u6f14\u793a<\/h2>\n<p>\u67e5\u8be2\u63a5\u53e3\u7528\u4e8e\u83b7\u53d6\u8d26\u6237\u76f8\u5173\u4fe1\u606f,\u5305\u62ec\u8d44\u4ea7\u3001\u6301\u4ed3\u3001\u59d4\u6258\u3001\u6210\u4ea4\u7b49\u3002\u67e5\u8be2\u63a5\u53e3\u7684\u8bf4\u660e\u6211\u9644\u5728\u6587\u672b\u4e86\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u4e3b\u8981\u67e5\u8be2\u63a5\u53e3\u7684\u4f7f\u7528\u793a\u4f8b:<\/p>\n<pre><code class=\"language-python line-numbers\"># \u8be5\u4ee3\u7801\u4ec5\u505a\u6848\u4f8b\u6f14\u793a\uff0c\u4e0d\u80fd\u76f4\u63a5\u8fd0\u884c\n# 1. \u67e5\u8be2\u8d44\u4ea7\nasset = trader.query_stock_asset(account)\nif asset:\n    print(f\"\u53ef\u7528\u8d44\u91d1: {asset.cash}\")\n    print(f\"\u603b\u8d44\u4ea7: {asset.total_asset}\")\n\n# 2. \u67e5\u8be2\u5f53\u65e5\u59d4\u6258\norders = trader.query_stock_orders(account)\nif orders:\n    print(f\"\u4eca\u65e5\u59d4\u6258\u6570\u91cf: {len(orders)}\")\n    for order in orders:\n        print(f\"\u59d4\u6258: {order.stock_code} {order.order_volume} {order.price}\")\n\n# 3. \u67e5\u8be2\u5f53\u65e5\u6210\u4ea4\ntrades = trader.query_stock_trades(account)\nif trades:\n    print(f\"\u4eca\u65e5\u6210\u4ea4\u6570\u91cf: {len(trades)}\")\n    for trade in trades:\n        print(f\"\u6210\u4ea4: {trade.stock_code} {trade.traded_volume} {trade.traded_price}\")\n\n# 4. \u67e5\u8be2\u6301\u4ed3\npositions = trader.query_stock_positions(account)\nif positions:\n    print(f\"\u6301\u4ed3\u6570\u91cf: {len(positions)}\")\n    for pos in positions:\n        print(f\"\u6301\u4ed3: {pos.stock_code} {pos.volume} {pos.can_use_volume}\")\n\n# 5. \u67e5\u8be2\u5355\u4e2a\u80a1\u7968\u6301\u4ed3\nposition = trader.query_stock_position(account, \"XXX.SH\")\nif position:\n    print(f\"\u6301\u4ed3\u6570\u91cf: {position.volume}\")\n    print(f\"\u53ef\u7528\u6570\u91cf: {position.can_use_volume}\")\n<\/code><\/pre>\n<p>\u4ee5\u4e0a\u7684\u521d\u59cb\u5316\u3001\u67e5\u8be2\u3001\u5b9e\u76d8\u63a5\u53e3\u7ec4\u5408\u5230\u4e00\u8d77\u5c31\u53ef\u4ee5\u5b9e\u73b0\u4ee3\u7801\u7684\u5b9e\u76d8\u64cd\u4f5c\u4e86\uff0c\u8fd9\u91cc\u6211\u4e0d\u7ed9\u5927\u5bb6\u653e\u5b9e\u76d8\u6848\u4f8b\u4ee3\u7801\u4e86\uff0c\u4ee5\u514d\u8bfb\u8005\u8bef\u64cd\u4f5c\u3002<\/p>\n<p>\u5b98\u65b9\u5e2e\u52a9\u6587\u6863\u4e2d\u63d0\u4f9b\u4e86\u51e0\u4e2a\u5b9e\u76d8\u7684\u6848\u4f8b\uff0c\u8bf7\u611f\u5174\u8da3\u7684\u670b\u53cb\u8df3\u8f6c\u9605\u8bfb\uff1a<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/dict.thinktrader.net\/nativeApi\/code_examples.html?id=x3GDHP#%E4%BA%A4%E6%98%93%E7%A4%BA%E4%BE%8B\">\u5b8c\u6574\u5b9e\u4f8b | \u8fc5\u6295\u77e5\u8bc6\u5e93<\/a><\/p>\n<h2>5. \u9644\u5f55-\u4ea4\u6613\u6a21\u5757\u51fd\u6570\u63a5\u53e3<\/h2>\n<p>\u6ce8\u610f\uff1a\u5b9a\u4e49\u53ef\u80fd\u4f1a\u6709\u53d8\u52a8\uff0c\u4ee5\u5b98\u7f51\u4fe1\u606f\u4e3a\u51c6\u3002<\/p>\n<h3>5.1 \u80a1\u7968\u540c\u6b65\u62a5\u5355<\/h3>\n<pre><code class=\"language-python line-numbers\">order_stock(account, stock_code, order_type, order_volume, price_type, price, strategy_name, order_remark) \n<\/code><\/pre>\n<ul>\n<li>\u91ca\u4e49<\/li>\n<li>\u5bf9\u80a1\u7968\u8fdb\u884c\u4e0b\u5355\u64cd\u4f5c<\/li>\n<li>\u53c2\u6570<\/li>\n<li>account &#8211; StockAccount \u8d44\u91d1\u8d26\u53f7<\/li>\n<li>stock&#95;code &#8211; str \u8bc1\u5238\u4ee3\u7801\uff0c\u5982&#8217;600000.SH&#8217;<\/li>\n<li>order&#95;type &#8211; int \u59d4\u6258\u7c7b\u578b<\/li>\n<li>order&#95;volume &#8211; int \u59d4\u6258\u6570\u91cf\uff0c\u80a1\u7968\u4ee5&#8217;\u80a1&#8217;\u4e3a\u5355\u4f4d\uff0c\u503a\u5238\u4ee5&#8217;\u5f20&#8217;\u4e3a\u5355\u4f4d<\/li>\n<li>price&#95;type &#8211; int \u62a5\u4ef7\u7c7b\u578b<\/li>\n<li>price &#8211; float \u59d4\u6258\u4ef7\u683c<\/li>\n<li>strategy&#95;name &#8211; str \u7b56\u7565\u540d\u79f0<\/li>\n<li>order&#95;remark &#8211; str \u59d4\u6258\u5907\u6ce8<\/li>\n<li>\u8fd4\u56de<\/li>\n<li>\u7cfb\u7edf\u751f\u6210\u7684\u8ba2\u5355\u7f16\u53f7\uff0c\u6210\u529f\u59d4\u6258\u540e\u7684\u8ba2\u5355\u7f16\u53f7\u4e3a\u5927\u4e8e0\u7684\u6b63\u6574\u6570\uff0c\u5982\u679c\u4e3a-1\u8868\u793a\u59d4\u6258\u5931\u8d25<\/li>\n<li>\u5907\u6ce8<\/li>\n<li>\u65e0<\/li>\n<\/ul>\n<h3>5.2 \u80a1\u7968\u5f02\u6b65\u62a5\u5355<\/h3>\n<pre><code class=\"language-python line-numbers\">order_stock_async(account, stock_code, order_type, order_volume, price_type, price, strategy_name, order_remark) \n<\/code><\/pre>\n<ul>\n<li>\u91ca\u4e49<\/li>\n<li>\u5bf9\u80a1\u7968\u8fdb\u884c\u5f02\u6b65\u4e0b\u5355\u64cd\u4f5c\uff0c\u5f02\u6b65\u4e0b\u5355\u63a5\u53e3\u5982\u679c\u6b63\u5e38\u8fd4\u56de\u4e86\u4e0b\u5355\u8bf7\u6c42\u5e8f\u53f7seq\uff0c\u4f1a\u6536\u5230on&#95;order&#95;stock&#95;async&#95;response\u7684\u59d4\u6258\u53cd\u9988<\/li>\n<li>\u53c2\u6570<\/li>\n<li>account &#8211; StockAccount \u8d44\u91d1\u8d26\u53f7<\/li>\n<li>stock&#95;code &#8211; str \u8bc1\u5238\u4ee3\u7801\uff0c \u5982&#8217;600000.SH&#8217;<\/li>\n<li>order&#95;type &#8211; int \u59d4\u6258\u7c7b\u578b<\/li>\n<li>order&#95;volume &#8211; int \u59d4\u6258\u6570\u91cf\uff0c\u80a1\u7968\u4ee5&#8217;\u80a1&#8217;\u4e3a\u5355\u4f4d\uff0c\u503a\u5238\u4ee5&#8217;\u5f20&#8217;\u4e3a\u5355\u4f4d<\/li>\n<li>price&#95;type &#8211; int \u62a5\u4ef7\u7c7b\u578b<\/li>\n<li>price &#8211; float \u59d4\u6258\u4ef7\u683c<\/li>\n<li>strategy&#95;name &#8211; str \u7b56\u7565\u540d\u79f0<\/li>\n<li>order&#95;remark &#8211; str \u59d4\u6258\u5907\u6ce8<\/li>\n<li>\u8fd4\u56de<\/li>\n<li>\u8fd4\u56de\u4e0b\u5355\u8bf7\u6c42\u5e8f\u53f7seq\uff0c\u6210\u529f\u59d4\u6258\u540e\u7684\u4e0b\u5355\u8bf7\u6c42\u5e8f\u53f7\u4e3a\u5927\u4e8e0\u7684\u6b63\u6574\u6570\uff0c\u5982\u679c\u4e3a-1\u8868\u793a\u59d4\u6258\u5931\u8d25<\/li>\n<li>\u5907\u6ce8<\/li>\n<li>\u5982\u679c\u5931\u8d25\uff0c\u5219\u901a\u8fc7\u4e0b\u5355\u5931\u8d25\u4e3b\u63a8\u63a5\u53e3\u8fd4\u56de\u4e0b\u5355\u5931\u8d25\u4fe1\u606f<\/li>\n<\/ul>\n<h3>5.3 \u80a1\u7968\u540c\u6b65\u64a4\u5355<\/h3>\n<pre><code class=\"language-python line-numbers\">cancel_order_stock(account, order_id) \n<\/code><\/pre>\n<ul>\n<li>\u91ca\u4e49<\/li>\n<li>\u6839\u636e\u8ba2\u5355\u7f16\u53f7\u5bf9\u59d4\u6258\u8fdb\u884c\u64a4\u5355\u64cd\u4f5c<\/li>\n<li>\u53c2\u6570<\/li>\n<li>account &#8211; StockAccount \u8d44\u91d1\u8d26\u53f7<\/li>\n<li>order&#95;id &#8211; int \u540c\u6b65\u4e0b\u5355\u63a5\u53e3\u8fd4\u56de\u7684\u8ba2\u5355\u7f16\u53f7,\u5bf9\u4e8e\u671f\u8d27\u6765\u8bf4\uff0c\u662forder\u7ed3\u6784\u4e2d\u7684order&#95;sysid\u5b57\u6bb5<\/li>\n<li>\u8fd4\u56de<\/li>\n<li>\u8fd4\u56de\u662f\u5426\u6210\u529f\u53d1\u51fa\u64a4\u5355\u6307\u4ee4\uff0c0: \u6210\u529f, -1: \u8868\u793a\u64a4\u5355\u5931\u8d25<\/li>\n<li>\u5907\u6ce8<\/li>\n<li>\u65e0<\/li>\n<\/ul>\n<h3>5.4 \u80a1\u7968\u5f02\u6b65\u64a4\u5355<\/h3>\n<pre><code class=\"language-python line-numbers\">cancel_order_stock_async(account, order_id) \n<\/code><\/pre>\n<ul>\n<li>\u91ca\u4e49<\/li>\n<li>\u6839\u636e\u8ba2\u5355\u7f16\u53f7\u5bf9\u59d4\u6258\u8fdb\u884c\u5f02\u6b65\u64a4\u5355\u64cd\u4f5c<\/li>\n<li>\u53c2\u6570<\/li>\n<li>account &#8211; StockAccount \u8d44\u91d1\u8d26\u53f7<\/li>\n<li>order&#95;id &#8211; int \u4e0b\u5355\u63a5\u53e3\u8fd4\u56de\u7684\u8ba2\u5355\u7f16\u53f7\uff0c\u5bf9\u4e8e\u671f\u8d27\u6765\u8bf4\uff0c\u662forder\u7ed3\u6784\u4e2d\u7684order&#95;sysid<\/li>\n<li>\u8fd4\u56de<\/li>\n<li>\u8fd4\u56de\u64a4\u5355\u8bf7\u6c42\u5e8f\u53f7, \u6210\u529f\u59d4\u6258\u540e\u7684\u64a4\u5355\u8bf7\u6c42\u5e8f\u53f7\u4e3a\u5927\u4e8e0\u7684\u6b63\u6574\u6570, \u5982\u679c\u4e3a-1\u8868\u793a\u59d4\u6258\u5931\u8d25<\/li>\n<li>\u5907\u6ce8<\/li>\n<li>\u5982\u679c\u5931\u8d25\uff0c\u5219\u901a\u8fc7\u64a4\u5355\u5931\u8d25\u4e3b\u63a8\u63a5\u53e3\u8fd4\u56de\u64a4\u5355\u5931\u8d25\u4fe1\u606f<\/li>\n<\/ul>\n<h3>5.5 \u8d44\u4ea7\u67e5\u8be2<\/h3>\n<pre><code class=\"language-python line-numbers\">query_stock_asset(account) \n<\/code><\/pre>\n<ul>\n<li>\u91ca\u4e49<\/li>\n<li>\u67e5\u8be2\u8d44\u91d1\u8d26\u53f7\u5bf9\u5e94\u7684\u8d44\u4ea7<\/li>\n<li>\u53c2\u6570<\/li>\n<li>account &#8211; StockAccount \u8d44\u91d1\u8d26\u53f7<\/li>\n<li>\u8fd4\u56de<\/li>\n<li>\u8be5\u8d26\u53f7\u5bf9\u5e94\u7684\u8d44\u4ea7\u5bf9\u8c61<a class=\"wp-editor-md-post-content-link\" href=\"http:\/\/dict.thinktrader.net\/nativeApi\/xttrader.html#%E8%B5%84%E4%BA%A7xtasset\">XtAsset\u5728\u65b0\u7a97\u53e3\u6253\u5f00<\/a>\u6216\u8005None<\/li>\n<li>\u5907\u6ce8<\/li>\n<li>\u8fd4\u56deNone\u8868\u793a\u67e5\u8be2\u5931\u8d25<\/li>\n<\/ul>\n<h3>5.6 \u59d4\u6258\u67e5\u8be2<\/h3>\n<pre><code class=\"language-python line-numbers\">query_stock_orders(account, cancelable_only = False) \n<\/code><\/pre>\n<ul>\n<li>\u91ca\u4e49<\/li>\n<li>\u67e5\u8be2\u8d44\u91d1\u8d26\u53f7\u5bf9\u5e94\u7684\u5f53\u65e5\u6240\u6709\u59d4\u6258<\/li>\n<li>\u53c2\u6570<\/li>\n<li>account &#8211; StockAccount \u8d44\u91d1\u8d26\u53f7<\/li>\n<li>cancelable&#95;only &#8211; bool \u4ec5\u67e5\u8be2\u53ef\u64a4\u59d4\u6258<\/li>\n<li>\u8fd4\u56de<\/li>\n<li>\u8be5\u8d26\u53f7\u5bf9\u5e94\u7684\u5f53\u65e5\u6240\u6709\u59d4\u6258\u5bf9\u8c61<a class=\"wp-editor-md-post-content-link\" href=\"http:\/\/dict.thinktrader.net\/nativeApi\/xttrader.html#%E5%A7%94%E6%89%98xtorder\">XtOrder\u5728\u65b0\u7a97\u53e3\u6253\u5f00<\/a>\u7ec4\u6210\u7684list\u6216\u8005None<\/li>\n<li>\u5907\u6ce8<\/li>\n<li>None\u8868\u793a\u67e5\u8be2\u5931\u8d25\u6216\u8005\u5f53\u65e5\u59d4\u6258\u5217\u8868\u4e3a\u7a7a<\/li>\n<\/ul>\n<h3>5.7 \u6210\u4ea4\u67e5\u8be2<\/h3>\n<pre><code class=\"language-python line-numbers\">query_stock_trades(account)\n<\/code><\/pre>\n<ul>\n<li>\u91ca\u4e49<\/li>\n<li>\u67e5\u8be2\u8d44\u91d1\u8d26\u53f7\u5bf9\u5e94\u7684\u5f53\u65e5\u6240\u6709\u6210\u4ea4<\/li>\n<li>\u53c2\u6570<\/li>\n<li>account &#8211; StockAccount \u8d44\u91d1\u8d26\u53f7<\/li>\n<li>\u8fd4\u56de<\/li>\n<li>\u8be5\u8d26\u53f7\u5bf9\u5e94\u7684\u5f53\u65e5\u6240\u6709\u6210\u4ea4\u5bf9\u8c61<a class=\"wp-editor-md-post-content-link\" href=\"http:\/\/dict.thinktrader.net\/nativeApi\/xttrader.html#%E6%88%90%E4%BA%A4xttrade\">XtTrade\u5728\u65b0\u7a97\u53e3\u6253\u5f00<\/a>\u7ec4\u6210\u7684list\u6216\u8005None<\/li>\n<li>\u5907\u6ce8<\/li>\n<li>None\u8868\u793a\u67e5\u8be2\u5931\u8d25\u6216\u8005\u5f53\u65e5\u6210\u4ea4\u5217\u8868\u4e3a\u7a7a<\/li>\n<\/ul>\n<h3>5.8 \u6301\u4ed3\u67e5\u8be2<\/h3>\n<pre><code class=\"language-python line-numbers\">query_stock_positions(account) \n<\/code><\/pre>\n<ul>\n<li>\u91ca\u4e49<\/li>\n<li>\u67e5\u8be2\u8d44\u91d1\u8d26\u53f7\u5bf9\u5e94\u7684\u6301\u4ed3<\/li>\n<li>\u53c2\u6570<\/li>\n<li>account &#8211; StockAccount \u8d44\u91d1\u8d26\u53f7<\/li>\n<li>\u8fd4\u56de<\/li>\n<li>\u8be5\u8d26\u53f7\u5bf9\u5e94\u7684\u6700\u65b0\u6301\u4ed3\u5bf9\u8c61<a class=\"wp-editor-md-post-content-link\" href=\"http:\/\/dict.thinktrader.net\/nativeApi\/xttrader.html#%E6%8C%81%E4%BB%93xtposition\">XtPosition\u5728\u65b0\u7a97\u53e3\u6253\u5f00<\/a>\u7ec4\u6210\u7684list\u6216\u8005None<\/li>\n<li>\u5907\u6ce8<\/li>\n<li>None\u8868\u793a\u67e5\u8be2\u5931\u8d25\u6216\u8005\u5f53\u65e5\u6301\u4ed3\u5217\u8868\u4e3a\u7a7a<\/li>\n<\/ul>\n<h2>6. \u76f8\u5173\u6570\u636e\u5b57\u5178<\/h2>\n<p>\u8be5\u90e8\u5206\u5185\u5bb9\u6bd4\u8f83\u591a\uff0c\u4f46\u662f\u5f88\u5b9e\u7528\uff0c\u56e0\u4e3a\u76ee\u524d\u53ea\u7814\u7a76\u80a1\u7968\u4ea4\u6613\uff0c\u6211\u628a\u76f8\u5173\u7684\u6458\u8fc7\u6765\u4e86\u3002\u6ce8\u610f\uff1a\u5b9a\u4e49\u53ef\u80fd\u4f1a\u6709\u53d8\u52a8\uff0c\u4ee5\u5b98\u7f51\u4fe1\u606f\u4e3a\u51c6\u3002<\/p>\n<h3>6.1 \u59d4\u6258\u7c7b\u578b(order&#95;type)<\/h3>\n<ul>\n<li>\u80a1\u7968<\/li>\n<li>\u4e70\u5165 &#8211; xtconstant.STOCK&#95;BUY<\/li>\n<li>\u5356\u51fa &#8211; xtconstant.STOCK&#95;SELL<\/li>\n<\/ul>\n<h3>6.2 \u62a5\u4ef7\u7c7b\u578b(price&#95;type)<\/h3>\n<ul>\n<li>\u6700\u65b0\u4ef7 &#8211; xtconstant.LATEST&#95;PRICE<\/li>\n<li>\u6307\u5b9a\u4ef7 &#8211; xtconstant.FIX&#95;PRICE<\/li>\n<\/ul>\n<h3>6.3 \u59d4\u6258\u72b6\u6001(order&#95;status)<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u679a\u4e3e\u53d8\u91cf\u540d<\/th>\n<th>\u503c<\/th>\n<th>\u542b\u4e49<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>xtconstant.ORDER&#95;UNREPORTED<\/td>\n<td>48<\/td>\n<td>\u672a\u62a5<\/td>\n<\/tr>\n<tr>\n<td>xtconstant.ORDER&#95;WAIT&#95;REPORTING<\/td>\n<td>49<\/td>\n<td>\u5f85\u62a5<\/td>\n<\/tr>\n<tr>\n<td>xtconstant.ORDER&#95;REPORTED<\/td>\n<td>50<\/td>\n<td>\u5df2\u62a5<\/td>\n<\/tr>\n<tr>\n<td>xtconstant.ORDER&#95;REPORTED&#95;CANCEL<\/td>\n<td>51<\/td>\n<td>\u5df2\u62a5\u5f85\u64a4<\/td>\n<\/tr>\n<tr>\n<td>xtconstant.ORDER&#95;PARTSUCC&#95;CANCEL<\/td>\n<td>52<\/td>\n<td>\u90e8\u6210\u5f85\u64a4<\/td>\n<\/tr>\n<tr>\n<td>xtconstant.ORDER&#95;PART&#95;CANCEL<\/td>\n<td>53<\/td>\n<td>\u90e8\u64a4\uff08\u5df2\u7ecf\u6709\u4e00\u90e8\u5206\u6210\u4ea4\uff0c\u5269\u4e0b\u7684\u5df2\u7ecf\u64a4\u5355\uff09<\/td>\n<\/tr>\n<tr>\n<td>xtconstant.ORDER&#95;CANCELED<\/td>\n<td>54<\/td>\n<td>\u5df2\u64a4<\/td>\n<\/tr>\n<tr>\n<td>xtconstant.ORDER&#95;PART&#95;SUCC<\/td>\n<td>55<\/td>\n<td>\u90e8\u6210\uff08\u5df2\u7ecf\u6709\u4e00\u90e8\u5206\u6210\u4ea4\uff0c\u5269\u4e0b\u7684\u5f85\u6210\u4ea4\uff09<\/td>\n<\/tr>\n<tr>\n<td>xtconstant.ORDER&#95;SUCCEEDED<\/td>\n<td>56<\/td>\n<td>\u5df2\u6210<\/td>\n<\/tr>\n<tr>\n<td>xtconstant.ORDER&#95;JUNK<\/td>\n<td>57<\/td>\n<td>\u5e9f\u5355<\/td>\n<\/tr>\n<tr>\n<td>xtconstant.ORDER&#95;UNKNOWN<\/td>\n<td>255<\/td>\n<td>\u672a\u77e5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>6.4 \u8d26\u53f7\u72b6\u6001(account&#95;status)<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u679a\u4e3e\u53d8\u91cf\u540d<\/th>\n<th>\u503c<\/th>\n<th>\u542b\u4e49<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>xtconstant.ACCOUNT&#95;STATUS&#95;INVALID<\/td>\n<td>-1<\/td>\n<td>\u65e0\u6548<\/td>\n<\/tr>\n<tr>\n<td>xtconstant.ACCOUNT&#95;STATUS&#95;OK<\/td>\n<td>0<\/td>\n<td>\u6b63\u5e38<\/td>\n<\/tr>\n<tr>\n<td>xtconstant.ACCOUNT&#95;STATUS&#95;WAITING&#95;LOGIN<\/td>\n<td>1<\/td>\n<td>\u8fde\u63a5\u4e2d<\/td>\n<\/tr>\n<tr>\n<td>xtconstant.ACCOUNT&#95;STATUSING<\/td>\n<td>2<\/td>\n<td>\u767b\u9646\u4e2d<\/td>\n<\/tr>\n<tr>\n<td>xtconstant.ACCOUNT&#95;STATUS&#95;FAIL<\/td>\n<td>3<\/td>\n<td>\u5931\u8d25<\/td>\n<\/tr>\n<tr>\n<td>xtconstant.ACCOUNT&#95;STATUS&#95;INITING<\/td>\n<td>4<\/td>\n<td>\u521d\u59cb\u5316\u4e2d<\/td>\n<\/tr>\n<tr>\n<td>xtconstant.ACCOUNT&#95;STATUS&#95;CORRECTING<\/td>\n<td>5<\/td>\n<td>\u6570\u636e\u5237\u65b0\u6821\u6b63\u4e2d<\/td>\n<\/tr>\n<tr>\n<td>xtconstant.ACCOUNT&#95;STATUS&#95;CLOSED<\/td>\n<td>6<\/td>\n<td>\u6536\u76d8\u540e<\/td>\n<\/tr>\n<tr>\n<td>xtconstant.ACCOUNT&#95;STATUS&#95;ASSIS&#95;FAIL<\/td>\n<td>7<\/td>\n<td>\u7a7f\u900f\u526f\u94fe\u63a5\u65ad\u5f00<\/td>\n<\/tr>\n<tr>\n<td>xtconstant.ACCOUNT&#95;STATUS&#95;DISABLEBYSYS<\/td>\n<td>8<\/td>\n<td>\u7cfb\u7edf\u505c\u7528\uff08\u603b\u7ebf\u4f7f\u7528-\u5bc6\u7801\u9519\u8bef\u8d85\u9650\uff09<\/td>\n<\/tr>\n<tr>\n<td>xtconstant.ACCOUNT&#95;STATUS&#95;DISABLEBYUSER<\/td>\n<td>9<\/td>\n<td>\u7528\u6237\u505c\u7528\uff08\u603b\u7ebf\u4f7f\u7528\uff09<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>6.5 \u8d44\u4ea7XtAsset<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u5c5e\u6027<\/th>\n<th>\u7c7b\u578b<\/th>\n<th>\u6ce8\u91ca<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>account&#95;type<\/td>\n<td>int<\/td>\n<td>\u8d26\u53f7\u7c7b\u578b<\/td>\n<\/tr>\n<tr>\n<td>account&#95;id<\/td>\n<td>str<\/td>\n<td>\u8d44\u91d1\u8d26\u53f7<\/td>\n<\/tr>\n<tr>\n<td>cash<\/td>\n<td>float<\/td>\n<td>\u53ef\u7528\u91d1\u989d<\/td>\n<\/tr>\n<tr>\n<td>frozen&#95;cash<\/td>\n<td>float<\/td>\n<td>\u51bb\u7ed3\u91d1\u989d<\/td>\n<\/tr>\n<tr>\n<td>market&#95;value<\/td>\n<td>float<\/td>\n<td>\u6301\u4ed3\u5e02\u503c<\/td>\n<\/tr>\n<tr>\n<td>total&#95;asset<\/td>\n<td>float<\/td>\n<td>\u603b\u8d44\u4ea7<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>6.6 \u59d4\u6258XtOrder<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u5c5e\u6027<\/th>\n<th>\u7c7b\u578b<\/th>\n<th>\u6ce8\u91ca<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>account&#95;type<\/td>\n<td>int<\/td>\n<td>\u8d26\u53f7\u7c7b\u578b\uff0c\u53c2\u89c1\u6570\u636e\u5b57\u5178\u5728\u65b0\u7a97\u53e3\u6253\u5f00<\/td>\n<\/tr>\n<tr>\n<td>account&#95;id<\/td>\n<td>str<\/td>\n<td>\u8d44\u91d1\u8d26\u53f7<\/td>\n<\/tr>\n<tr>\n<td>stock&#95;code<\/td>\n<td>str<\/td>\n<td>\u8bc1\u5238\u4ee3\u7801\uff0c\u4f8b\u5982&#8221;600000.SH&#8221;<\/td>\n<\/tr>\n<tr>\n<td>order&#95;id<\/td>\n<td>int<\/td>\n<td>\u8ba2\u5355\u7f16\u53f7<\/td>\n<\/tr>\n<tr>\n<td>order&#95;sysid<\/td>\n<td>str<\/td>\n<td>\u67dc\u53f0\u5408\u540c\u7f16\u53f7<\/td>\n<\/tr>\n<tr>\n<td>order&#95;time<\/td>\n<td>int<\/td>\n<td>\u62a5\u5355\u65f6\u95f4<\/td>\n<\/tr>\n<tr>\n<td>order&#95;type<\/td>\n<td>int<\/td>\n<td>\u59d4\u6258\u7c7b\u578b\uff0c\u53c2\u89c1\u6570\u636e\u5b57\u5178\u5728\u65b0\u7a97\u53e3\u6253\u5f00<\/td>\n<\/tr>\n<tr>\n<td>order&#95;volume<\/td>\n<td>int<\/td>\n<td>\u59d4\u6258\u6570\u91cf<\/td>\n<\/tr>\n<tr>\n<td>price&#95;type<\/td>\n<td>int<\/td>\n<td>\u62a5\u4ef7\u7c7b\u578b\uff0c\u8be5\u5b57\u6bb5\u5728\u8fd4\u56de\u65f6\u4e3a\u67dc\u53f0\u8fd4\u56de\u7c7b\u578b\uff0c\u4e0d\u7b49\u4ef7\u4e8e\u4e0b\u5355\u4f20\u5165\u7684price&#95;type\uff0c\u679a\u4e3e\u503c\u4e0d\u4e00\u6837\u529f\u80fd\u4e00\u6837\uff0c\u53c2\u89c1\u6570\u636e\u5b57\u5178\u5728\u65b0\u7a97\u53e3\u6253\u5f00<\/td>\n<\/tr>\n<tr>\n<td>price<\/td>\n<td>float<\/td>\n<td>\u59d4\u6258\u4ef7\u683c<\/td>\n<\/tr>\n<tr>\n<td>traded&#95;volume<\/td>\n<td>int<\/td>\n<td>\u6210\u4ea4\u6570\u91cf<\/td>\n<\/tr>\n<tr>\n<td>traded&#95;price<\/td>\n<td>float<\/td>\n<td>\u6210\u4ea4\u5747\u4ef7<\/td>\n<\/tr>\n<tr>\n<td>order&#95;status<\/td>\n<td>int<\/td>\n<td>\u59d4\u6258\u72b6\u6001\uff0c\u53c2\u89c1\u6570\u636e\u5b57\u5178\u5728\u65b0\u7a97\u53e3\u6253\u5f00<\/td>\n<\/tr>\n<tr>\n<td>status&#95;msg<\/td>\n<td>str<\/td>\n<td>\u59d4\u6258\u72b6\u6001\u63cf\u8ff0\uff0c\u5982\u5e9f\u5355\u539f\u56e0<\/td>\n<\/tr>\n<tr>\n<td>strategy&#95;name<\/td>\n<td>str<\/td>\n<td>\u7b56\u7565\u540d\u79f0<\/td>\n<\/tr>\n<tr>\n<td>order&#95;remark<\/td>\n<td>str<\/td>\n<td>\u59d4\u6258\u5907\u6ce8<\/td>\n<\/tr>\n<tr>\n<td>direction<\/td>\n<td>int<\/td>\n<td>\u591a\u7a7a\u65b9\u5411\uff0c\u80a1\u7968\u4e0d\u9002\u7528\uff1b\u53c2\u89c1\u6570\u636e\u5b57\u5178\u5728\u65b0\u7a97\u53e3\u6253\u5f00<\/td>\n<\/tr>\n<tr>\n<td>offset&#95;flag<\/td>\n<td>int<\/td>\n<td>\u4ea4\u6613\u64cd\u4f5c\uff0c\u7528\u6b64\u5b57\u6bb5\u533a\u5206\u80a1\u7968\u4e70\u5356\uff0c\u671f\u8d27\u5f00\u3001\u5e73\u4ed3\uff0c\u671f\u6743\u4e70\u5356\u7b49\uff1b\u53c2\u89c1\u6570\u636e\u5b57\u5178\u5728\u65b0\u7a97\u53e3\u6253\u5f00<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>6.7 \u6210\u4ea4XtTrade<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u5c5e\u6027<\/th>\n<th>\u7c7b\u578b<\/th>\n<th>\u6ce8\u91ca<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>account&#95;type<\/td>\n<td>int<\/td>\n<td>\u8d26\u53f7\u7c7b\u578b\uff0c\u53c2\u89c1\u6570\u636e\u5b57\u5178\u5728\u65b0\u7a97\u53e3\u6253\u5f00<\/td>\n<\/tr>\n<tr>\n<td>account&#95;id<\/td>\n<td>str<\/td>\n<td>\u8d44\u91d1\u8d26\u53f7<\/td>\n<\/tr>\n<tr>\n<td>stock&#95;code<\/td>\n<td>str<\/td>\n<td>\u8bc1\u5238\u4ee3\u7801<\/td>\n<\/tr>\n<tr>\n<td>order&#95;type<\/td>\n<td>int<\/td>\n<td>\u59d4\u6258\u7c7b\u578b\uff0c\u53c2\u89c1\u6570\u636e\u5b57\u5178\u5728\u65b0\u7a97\u53e3\u6253\u5f00<\/td>\n<\/tr>\n<tr>\n<td>traded&#95;id<\/td>\n<td>str<\/td>\n<td>\u6210\u4ea4\u7f16\u53f7<\/td>\n<\/tr>\n<tr>\n<td>traded&#95;time<\/td>\n<td>int<\/td>\n<td>\u6210\u4ea4\u65f6\u95f4<\/td>\n<\/tr>\n<tr>\n<td>traded&#95;price<\/td>\n<td>float<\/td>\n<td>\u6210\u4ea4\u5747\u4ef7<\/td>\n<\/tr>\n<tr>\n<td>traded&#95;volume<\/td>\n<td>int<\/td>\n<td>\u6210\u4ea4\u6570\u91cf<\/td>\n<\/tr>\n<tr>\n<td>traded&#95;amount<\/td>\n<td>float<\/td>\n<td>\u6210\u4ea4\u91d1\u989d<\/td>\n<\/tr>\n<tr>\n<td>order&#95;id<\/td>\n<td>int<\/td>\n<td>\u8ba2\u5355\u7f16\u53f7<\/td>\n<\/tr>\n<tr>\n<td>order&#95;sysid<\/td>\n<td>str<\/td>\n<td>\u67dc\u53f0\u5408\u540c\u7f16\u53f7<\/td>\n<\/tr>\n<tr>\n<td>strategy&#95;name<\/td>\n<td>str<\/td>\n<td>\u7b56\u7565\u540d\u79f0<\/td>\n<\/tr>\n<tr>\n<td>order&#95;remark<\/td>\n<td>str<\/td>\n<td>\u59d4\u6258\u5907\u6ce8<\/td>\n<\/tr>\n<tr>\n<td>direction<\/td>\n<td>int<\/td>\n<td>\u591a\u7a7a\u65b9\u5411\uff0c\u80a1\u7968\u4e0d\u9002\u7528\uff1b\u53c2\u89c1\u6570\u636e\u5b57\u5178\u5728\u65b0\u7a97\u53e3\u6253\u5f00<\/td>\n<\/tr>\n<tr>\n<td>offset&#95;flag<\/td>\n<td>int<\/td>\n<td>\u4ea4\u6613\u64cd\u4f5c\uff0c\u7528\u6b64\u5b57\u6bb5\u533a\u5206\u80a1\u7968\u4e70\u5356\uff0c\u671f\u8d27\u5f00\u3001\u5e73\u4ed3\uff0c\u671f\u6743\u4e70\u5356\u7b49\uff1b\u53c2\u89c1\u6570\u636e\u5b57\u5178\u5728\u65b0\u7a97\u53e3\u6253\u5f00<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>6.8 \u6301\u4ed3XtPosition<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u5c5e\u6027<\/th>\n<th>\u7c7b\u578b<\/th>\n<th>\u6ce8\u91ca<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>account&#95;type<\/td>\n<td>int<\/td>\n<td>\u8d26\u53f7\u7c7b\u578b\uff0c\u53c2\u89c1\u6570\u636e\u5b57\u5178\u5728\u65b0\u7a97\u53e3\u6253\u5f00<\/td>\n<\/tr>\n<tr>\n<td>account&#95;id<\/td>\n<td>str<\/td>\n<td>\u8d44\u91d1\u8d26\u53f7<\/td>\n<\/tr>\n<tr>\n<td>stock&#95;code<\/td>\n<td>str<\/td>\n<td>\u8bc1\u5238\u4ee3\u7801<\/td>\n<\/tr>\n<tr>\n<td>volume<\/td>\n<td>int<\/td>\n<td>\u6301\u4ed3\u6570\u91cf<\/td>\n<\/tr>\n<tr>\n<td>can&#95;use&#95;volume<\/td>\n<td>int<\/td>\n<td>\u53ef\u7528\u6570\u91cf<\/td>\n<\/tr>\n<tr>\n<td>open&#95;price<\/td>\n<td>float<\/td>\n<td>\u5f00\u4ed3\u4ef7<\/td>\n<\/tr>\n<tr>\n<td>market&#95;value<\/td>\n<td>float<\/td>\n<td>\u5e02\u503c<\/td>\n<\/tr>\n<tr>\n<td>frozen&#95;volume<\/td>\n<td>int<\/td>\n<td>\u51bb\u7ed3\u6570\u91cf<\/td>\n<\/tr>\n<tr>\n<td>on&#95;road&#95;volume<\/td>\n<td>int<\/td>\n<td>\u5728\u9014\u80a1\u4efd<\/td>\n<\/tr>\n<tr>\n<td>yesterday&#95;volume<\/td>\n<td>int<\/td>\n<td>\u6628\u591c\u62e5\u80a1<\/td>\n<\/tr>\n<tr>\n<td>avg&#95;price<\/td>\n<td>float<\/td>\n<td>\u6210\u672c\u4ef7<\/td>\n<\/tr>\n<tr>\n<td>direction<\/td>\n<td>int<\/td>\n<td>\u591a\u7a7a\u65b9\u5411\uff0c\u80a1\u7968\u4e0d\u9002\u7528<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>6.9 \u5f02\u6b65\u4e0b\u5355\u59d4\u6258\u53cd\u9988XtOrderResponse<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u5c5e\u6027<\/th>\n<th>\u7c7b\u578b<\/th>\n<th>\u6ce8\u91ca<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>account&#95;type<\/td>\n<td>int<\/td>\n<td>\u8d26\u53f7\u7c7b\u578b\uff0c\u53c2\u89c1\u6570\u636e\u5b57\u5178\u5728\u65b0\u7a97\u53e3\u6253\u5f00<\/td>\n<\/tr>\n<tr>\n<td>account&#95;id<\/td>\n<td>str<\/td>\n<td>\u8d44\u91d1\u8d26\u53f7<\/td>\n<\/tr>\n<tr>\n<td>order&#95;id<\/td>\n<td>int<\/td>\n<td>\u8ba2\u5355\u7f16\u53f7<\/td>\n<\/tr>\n<tr>\n<td>strategy&#95;name<\/td>\n<td>str<\/td>\n<td>\u7b56\u7565\u540d\u79f0<\/td>\n<\/tr>\n<tr>\n<td>order&#95;remark<\/td>\n<td>str<\/td>\n<td>\u59d4\u6258\u5907\u6ce8<\/td>\n<\/tr>\n<tr>\n<td>seq<\/td>\n<td>int<\/td>\n<td>\u5f02\u6b65\u4e0b\u5355\u7684\u8bf7\u6c42\u5e8f\u53f7<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>6.10 \u5f02\u6b65\u64a4\u5355\u59d4\u6258\u53cd\u9988XtCancelOrderResponse<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u5c5e\u6027<\/th>\n<th>\u7c7b\u578b<\/th>\n<th>\u6ce8\u91ca<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>account&#95;type<\/td>\n<td>int<\/td>\n<td>\u8d26\u53f7\u7c7b\u578b\uff0c\u53c2\u89c1\u6570\u636e\u5b57\u5178\u5728\u65b0\u7a97\u53e3\u6253\u5f00<\/td>\n<\/tr>\n<tr>\n<td>account&#95;id<\/td>\n<td>str<\/td>\n<td>\u8d44\u91d1\u8d26\u53f7<\/td>\n<\/tr>\n<tr>\n<td>order&#95;id<\/td>\n<td>int<\/td>\n<td>\u8ba2\u5355\u7f16\u53f7<\/td>\n<\/tr>\n<tr>\n<td>order&#95;sysid<\/td>\n<td>str<\/td>\n<td>\u67dc\u53f0\u59d4\u6258\u7f16\u53f7<\/td>\n<\/tr>\n<tr>\n<td>cancel&#95;result<\/td>\n<td>int<\/td>\n<td>\u64a4\u5355\u7ed3\u679c<\/td>\n<\/tr>\n<tr>\n<td>seq<\/td>\n<td>int<\/td>\n<td>\u5f02\u6b65\u64a4\u5355\u7684\u8bf7\u6c42\u5e8f\u53f7<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>6.11 \u4e0b\u5355\u5931\u8d25\u9519\u8befXtOrderError<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u5c5e\u6027<\/th>\n<th>\u7c7b\u578b<\/th>\n<th>\u6ce8\u91ca<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>account&#95;type<\/td>\n<td>int<\/td>\n<td>\u8d26\u53f7\u7c7b\u578b\uff0c\u53c2\u89c1\u6570\u636e\u5b57\u5178\u5728\u65b0\u7a97\u53e3\u6253\u5f00<\/td>\n<\/tr>\n<tr>\n<td>account&#95;id<\/td>\n<td>str<\/td>\n<td>\u8d44\u91d1\u8d26\u53f7<\/td>\n<\/tr>\n<tr>\n<td>order&#95;id<\/td>\n<td>int<\/td>\n<td>\u8ba2\u5355\u7f16\u53f7<\/td>\n<\/tr>\n<tr>\n<td>error&#95;id<\/td>\n<td>int<\/td>\n<td>\u4e0b\u5355\u5931\u8d25\u9519\u8bef\u7801<\/td>\n<\/tr>\n<tr>\n<td>error&#95;msg<\/td>\n<td>str<\/td>\n<td>\u4e0b\u5355\u5931\u8d25\u5177\u4f53\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td>strategy&#95;name<\/td>\n<td>str<\/td>\n<td>\u7b56\u7565\u540d\u79f0<\/td>\n<\/tr>\n<tr>\n<td>order&#95;remark<\/td>\n<td>str<\/td>\n<td>\u59d4\u6258\u5907\u6ce8<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>6.12 \u64a4\u5355\u5931\u8d25\u9519\u8befXtCancelError<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u5c5e\u6027<\/th>\n<th>\u7c7b\u578b<\/th>\n<th>\u6ce8\u91ca<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>account&#95;type<\/td>\n<td>int<\/td>\n<td>\u8d26\u53f7\u7c7b\u578b\uff0c\u53c2\u89c1\u6570\u636e\u5b57\u5178\u5728\u65b0\u7a97\u53e3\u6253\u5f00<\/td>\n<\/tr>\n<tr>\n<td>account&#95;id<\/td>\n<td>str<\/td>\n<td>\u8d44\u91d1\u8d26\u53f7<\/td>\n<\/tr>\n<tr>\n<td>order&#95;id<\/td>\n<td>int<\/td>\n<td>\u8ba2\u5355\u7f16\u53f7<\/td>\n<\/tr>\n<tr>\n<td>market<\/td>\n<td>int<\/td>\n<td>\u4ea4\u6613\u5e02\u573a 0:\u4e0a\u6d77 1:\u6df1\u5733<\/td>\n<\/tr>\n<tr>\n<td>order&#95;sysid<\/td>\n<td>str<\/td>\n<td>\u67dc\u53f0\u59d4\u6258\u7f16\u53f7<\/td>\n<\/tr>\n<tr>\n<td>error&#95;id<\/td>\n<td>int<\/td>\n<td>\u4e0b\u5355\u5931\u8d25\u9519\u8bef\u7801<\/td>\n<\/tr>\n<tr>\n<td>error&#95;msg<\/td>\n<td>str<\/td>\n<td>\u4e0b\u5355\u5931\u8d25\u5177\u4f53\u4fe1\u606f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>6.13 \u8d26\u53f7\u4fe1\u606fXtAccountInfo<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u5c5e\u6027<\/th>\n<th>\u7c7b\u578b<\/th>\n<th>\u6ce8\u91ca<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>account&#95;type<\/td>\n<td>int<\/td>\n<td>\u8d26\u53f7\u7c7b\u578b\uff0c\u53c2\u89c1\u6570\u636e\u5b57\u5178\u5728\u65b0\u7a97\u53e3\u6253\u5f00<\/td>\n<\/tr>\n<tr>\n<td>account&#95;id<\/td>\n<td>str<\/td>\n<td>\u8d44\u91d1\u8d26\u53f7<\/td>\n<\/tr>\n<tr>\n<td>broker&#95;type<\/td>\n<td>int<\/td>\n<td>\u540c account&#95;type<\/td>\n<\/tr>\n<tr>\n<td>platform&#95;id<\/td>\n<td>int<\/td>\n<td>\u5e73\u53f0\u53f7<\/td>\n<\/tr>\n<tr>\n<td>account&#95;classification<\/td>\n<td>int<\/td>\n<td>\u8d26\u53f7\u5206\u7c7b<\/td>\n<\/tr>\n<tr>\n<td>login&#95;status<\/td>\n<td>int<\/td>\n<td>\u8d26\u53f7\u72b6\u6001\uff0c\u53c2\u89c1\u6570\u636e\u5b57\u5178<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h1>\u5f00\u901aminiQMT<\/h1>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/khsci.com\/khQuant\/miniqmt\/\" title=\"\u5982\u679c\u4f60\u8fd8\u6ca1\u6709\u5f00\u901aminiQMT\uff0c\u53ef\u4ee5\u70b9\u51fb\u6b64\u5904\u5f00\u901a\uff0c\u4f4e\u8d39\u7387\u3001\u4f4e\u95e8\u69db\uff0c\u6b22\u8fce\u54a8\u8be2\u3002\">\u5982\u679c\u4f60\u8fd8\u6ca1\u6709\u5f00\u901aminiQMT\uff0c\u53ef\u4ee5\u70b9\u51fb\u6b64\u5904\u5f00\u901a\uff0c\u4f4e\u8d39\u7387\u3001\u4f4e\u95e8\u69db\uff0c\u6b22\u8fce\u54a8\u8be2\u3002<\/a><\/p>\n<h1>\u5f00\u53d1\u65e5\u5fd7<\/h1>\n<p>\u6211\u6b63\u5728\u7d27\u9523\u5bc6\u9f13\u5730\u5f00\u53d1\u7cfb\u7edf\uff0c\u5b8c\u5584\u529f\u80fd\uff0c<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/khsci.com\/khQuant\/log\/\" title=\"\u70b9\u51fb\u6b64\u5904\u4e86\u89e3\u6700\u65b0\u8fdb\u5c55\u3002\">\u70b9\u51fb\u6b64\u5904\u4e86\u89e3\u6700\u65b0\u8fdb\u5c55\u3002<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u662fMr.\u770b\u6d77\uff0c\u7531\u4e8e\u6211\u5f00\u53d1\u7684\u770b\u6d77\u91cf\u5316\u4ea4\u6613\u7cfb\u7edf\u662f\u57fa\u4e8eminiQMT\u7684\u884c\u60c5\u548c\u4ea4\u6613\u63a5\u53e3\uff0c\u6240\u4ee5\u5728\u6b64\u6211\u5c06miniQMT\u7684 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"template\/caidan.php","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-162","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/khsci.com\/khQuant\/wp-json\/wp\/v2\/pages\/162","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/khsci.com\/khQuant\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/khsci.com\/khQuant\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/khsci.com\/khQuant\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/khsci.com\/khQuant\/wp-json\/wp\/v2\/comments?post=162"}],"version-history":[{"count":8,"href":"https:\/\/khsci.com\/khQuant\/wp-json\/wp\/v2\/pages\/162\/revisions"}],"predecessor-version":[{"id":173,"href":"https:\/\/khsci.com\/khQuant\/wp-json\/wp\/v2\/pages\/162\/revisions\/173"}],"wp:attachment":[{"href":"https:\/\/khsci.com\/khQuant\/wp-json\/wp\/v2\/media?parent=162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}