# 大富翁交易客户端
trade-client是大富翁量化框架中用来交易的客户端。它对回测和实盘提供了几乎相同的接口,从而使得经过回测的策略,可以无缝切换到实盘环境中。
## 功能
* 进行实盘和回测交易
* 获取账号基本信息,比如本金、资产、持仓、盈亏及盈亏比等。
* 交易函数,比如买入(限价和市价)、卖出(限价和市价)、撤单等
* 查询委托、成交、持仓(当日和指定日期)
* 查询一段时间内的账户评估指标,比如sharpe, sortino, calmar, voliality, win rate, max drawdown等。
* 查询参照标的同期指标。
!!!Warning
在回测模式下,注意可能引起账户数据改变的操作,比如`buy`、`sell`等,必须严格按时间顺序执行,比如下面的例子:
```
client.buy(..., order_time=datetime.datetime(2022, 3, 1, 9, 31))
client.buy(..., order_time=datetime.datetime(2022, 3, 4, 14, 31))
client.buy(..., order_time=datetime.datetime(2022, 3, 4, 14, 32))
client.sell(..., order_time=datetime.datetime(2022, 3, 7, 9, 31))
```
是正确的执行顺序,但下面的执行顺序必然产生错误的结果(实际上服务器也会进行检测并报错误)
```
client.buy(..., order_time=datetime.datetime(2022, 3, 1, 14, 31))
client.buy(..., order_time=datetime.datetime(2022, 3, 1, 9, 31))
client.sell(..., order_time=datetime.datetime(2022, 3, 7, 9, 31))
```
策略需要自行决定是否允许这样的情况发生,以及如果发生失,会产生什么样的后果。
## Credits
This package was created with [zillionare/python project wizard](https://zillionare.github.io/python-project-wizard) project template.
Raw data
{
"_id": null,
"home_page": "https://github.com/zillionare/trader-client",
"name": "zillionare-trader-client",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<3.9",
"maintainer_email": "",
"keywords": "",
"author": "Aaron Yang",
"author_email": "code@jieyu.ai",
"download_url": "https://files.pythonhosted.org/packages/0f/f1/93b7925d8c5e3548b6489b727302e9f05c595ac64bd1d0f2ab49977d3027/zillionare_trader_client-0.4.4.tar.gz",
"platform": null,
"description": "# \u5927\u5bcc\u7fc1\u4ea4\u6613\u5ba2\u6237\u7aef\n\ntrade-client\u662f\u5927\u5bcc\u7fc1\u91cf\u5316\u6846\u67b6\u4e2d\u7528\u6765\u4ea4\u6613\u7684\u5ba2\u6237\u7aef\u3002\u5b83\u5bf9\u56de\u6d4b\u548c\u5b9e\u76d8\u63d0\u4f9b\u4e86\u51e0\u4e4e\u76f8\u540c\u7684\u63a5\u53e3\uff0c\u4ece\u800c\u4f7f\u5f97\u7ecf\u8fc7\u56de\u6d4b\u7684\u7b56\u7565\uff0c\u53ef\u4ee5\u65e0\u7f1d\u5207\u6362\u5230\u5b9e\u76d8\u73af\u5883\u4e2d\u3002\n\n## \u529f\u80fd\n\n* \u8fdb\u884c\u5b9e\u76d8\u548c\u56de\u6d4b\u4ea4\u6613\n* \u83b7\u53d6\u8d26\u53f7\u57fa\u672c\u4fe1\u606f\uff0c\u6bd4\u5982\u672c\u91d1\u3001\u8d44\u4ea7\u3001\u6301\u4ed3\u3001\u76c8\u4e8f\u53ca\u76c8\u4e8f\u6bd4\u7b49\u3002\n* \u4ea4\u6613\u51fd\u6570\uff0c\u6bd4\u5982\u4e70\u5165\uff08\u9650\u4ef7\u548c\u5e02\u4ef7\uff09\u3001\u5356\u51fa\uff08\u9650\u4ef7\u548c\u5e02\u4ef7\uff09\u3001\u64a4\u5355\u7b49\n* \u67e5\u8be2\u59d4\u6258\u3001\u6210\u4ea4\u3001\u6301\u4ed3\uff08\u5f53\u65e5\u548c\u6307\u5b9a\u65e5\u671f\uff09\n* \u67e5\u8be2\u4e00\u6bb5\u65f6\u95f4\u5185\u7684\u8d26\u6237\u8bc4\u4f30\u6307\u6807\uff0c\u6bd4\u5982sharpe, sortino, calmar, voliality, win rate, max drawdown\u7b49\u3002\n* \u67e5\u8be2\u53c2\u7167\u6807\u7684\u540c\u671f\u6307\u6807\u3002\n\n!!!Warning\n \u5728\u56de\u6d4b\u6a21\u5f0f\u4e0b\uff0c\u6ce8\u610f\u53ef\u80fd\u5f15\u8d77\u8d26\u6237\u6570\u636e\u6539\u53d8\u7684\u64cd\u4f5c\uff0c\u6bd4\u5982`buy`\u3001`sell`\u7b49\uff0c\u5fc5\u987b\u4e25\u683c\u6309\u65f6\u95f4\u987a\u5e8f\u6267\u884c\uff0c\u6bd4\u5982\u4e0b\u9762\u7684\u4f8b\u5b50\uff1a\n ```\n client.buy(..., order_time=datetime.datetime(2022, 3, 1, 9, 31))\n client.buy(..., order_time=datetime.datetime(2022, 3, 4, 14, 31))\n client.buy(..., order_time=datetime.datetime(2022, 3, 4, 14, 32))\n client.sell(..., order_time=datetime.datetime(2022, 3, 7, 9, 31))\n ```\n \u662f\u6b63\u786e\u7684\u6267\u884c\u987a\u5e8f\uff0c\u4f46\u4e0b\u9762\u7684\u6267\u884c\u987a\u5e8f\u5fc5\u7136\u4ea7\u751f\u9519\u8bef\u7684\u7ed3\u679c(\u5b9e\u9645\u4e0a\u670d\u52a1\u5668\u4e5f\u4f1a\u8fdb\u884c\u68c0\u6d4b\u5e76\u62a5\u9519\u8bef)\n ```\n client.buy(..., order_time=datetime.datetime(2022, 3, 1, 14, 31))\n client.buy(..., order_time=datetime.datetime(2022, 3, 1, 9, 31))\n client.sell(..., order_time=datetime.datetime(2022, 3, 7, 9, 31))\n ```\n \u7b56\u7565\u9700\u8981\u81ea\u884c\u51b3\u5b9a\u662f\u5426\u5141\u8bb8\u8fd9\u6837\u7684\u60c5\u51b5\u53d1\u751f\uff0c\u4ee5\u53ca\u5982\u679c\u53d1\u751f\u5931\uff0c\u4f1a\u4ea7\u751f\u4ec0\u4e48\u6837\u7684\u540e\u679c\u3002\n\n## Credits\n\nThis package was created with [zillionare/python project wizard](https://zillionare.github.io/python-project-wizard) project template.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Zillionare Trader Client",
"version": "0.4.4",
"project_urls": {
"Homepage": "https://github.com/zillionare/trader-client"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "39ba09eda461c732472787655696f5311b8c03ef7b68187264b17534112d37ae",
"md5": "1192c5e2d9f6fcce1ff5f840b70b498c",
"sha256": "93212a377326fec5e6d1586adab7e31bb984740a980b74d89462dcd2855b76f9"
},
"downloads": -1,
"filename": "zillionare_trader_client-0.4.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1192c5e2d9f6fcce1ff5f840b70b498c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<3.9",
"size": 15612,
"upload_time": "2023-11-05T09:39:50",
"upload_time_iso_8601": "2023-11-05T09:39:50.025988Z",
"url": "https://files.pythonhosted.org/packages/39/ba/09eda461c732472787655696f5311b8c03ef7b68187264b17534112d37ae/zillionare_trader_client-0.4.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0ff193b7925d8c5e3548b6489b727302e9f05c595ac64bd1d0f2ab49977d3027",
"md5": "def8904d34b8d967e4c3078654349ab3",
"sha256": "a6f376c479248addfb0e16324eb3ae946d7ad9198fb2dccab78902605ecf91ad"
},
"downloads": -1,
"filename": "zillionare_trader_client-0.4.4.tar.gz",
"has_sig": false,
"md5_digest": "def8904d34b8d967e4c3078654349ab3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<3.9",
"size": 175337,
"upload_time": "2023-11-05T09:39:52",
"upload_time_iso_8601": "2023-11-05T09:39:52.874355Z",
"url": "https://files.pythonhosted.org/packages/0f/f1/93b7925d8c5e3548b6489b727302e9f05c595ac64bd1d0f2ab49977d3027/zillionare_trader_client-0.4.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-05 09:39:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "zillionare",
"github_project": "trader-client",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "zillionare-trader-client"
}