# VeighNa框架的TTS仿真系统交易接口
<p align="center">
<img src ="https://vnpy.oss-cn-shanghai.aliyuncs.com/vnpy-logo.png"/>
</p>
<p align="center">
<img src ="https://img.shields.io/badge/version-6.7.2.0-blueviolet.svg"/>
<img src ="https://img.shields.io/badge/platform-windows|linux-yellow.svg"/>
<img src ="https://img.shields.io/badge/python-3.10|3.11|3.12-blue.svg"/>
<img src ="https://img.shields.io/github/license/vnpy/vnpy.svg?color=orange"/>
</p>
## 说明
基于TTS的6.7.2接口封装开发,对接类CTP的仿真交易环境。
目前TTS支持的仿真交易包括:
- 期货
- 中金所
- 上期所
- 大商所
- 郑商所
- 广期所
- 能交所
- 股票
- 上交所
- 深交所
## 安装
安装环境推荐基于3.9.0版本以上的【[**VeighNa Studio**](https://www.vnpy.com)】。
直接使用pip命令:
```
pip install vnpy_tts
```
或者下载源代码后,解压后在cmd中运行:
```
pip install .
```
使用源代码安装时需要进行C++编译,因此在执行上述命令之前请确保已经安装了【Visual Studio(Windows)】或者【GCC(Linux)】编译器。
## 使用
以脚本方式启动(script/run.py):
```
from vnpy.event import EventEngine
from vnpy.trader.engine import MainEngine
from vnpy.trader.ui import MainWindow, create_qapp
from vnpy_tts import TtsGateway
def main():
"""主入口函数"""
qapp = create_qapp()
event_engine = EventEngine()
main_engine = MainEngine(event_engine)
main_engine.add_gateway(TtsGateway)
main_window = MainWindow(main_engine, event_engine)
main_window.showMaximized()
qapp.exec()
if __name__ == "__main__":
main()
```
## 连接
模拟账号可通过https://github.com/krenx1983/openctp 获取。
连接信息如下:
```
{
"用户名": "xxxxxx",
"密码": "xxxxxx",
"经纪商代码": "",
"交易服务器": "121.36.146.182:20002",
"行情服务器": "121.36.146.182:20004",
"产品名称": "",
"授权编码": ""
}
```
7x24小时环境:
交易服务器 - 122.37.80.177:20002
行情服务器 - 122.37.80.177:20004
经纪商代码、产品名称、授权编码三项可以不填。
Raw data
{
"_id": null,
"home_page": "https://www.vnpy.com",
"name": "vnpy-tts",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "quant, quantitative, investment, trading, algotrading, ctp",
"author": "Xiaoyou Chen",
"author_email": "xiaoyou.chen@mail.vnpy.com",
"download_url": "https://files.pythonhosted.org/packages/d3/b8/34b3538b7edd1e1670461652205c342bd6a1ec6e17151aef89bde0c18250/vnpy_tts-6.7.2.0.tar.gz",
"platform": null,
"description": "# VeighNa\u6846\u67b6\u7684TTS\u4eff\u771f\u7cfb\u7edf\u4ea4\u6613\u63a5\u53e3\r\n\r\n<p align=\"center\">\r\n <img src =\"https://vnpy.oss-cn-shanghai.aliyuncs.com/vnpy-logo.png\"/>\r\n</p>\r\n\r\n<p align=\"center\">\r\n <img src =\"https://img.shields.io/badge/version-6.7.2.0-blueviolet.svg\"/>\r\n <img src =\"https://img.shields.io/badge/platform-windows|linux-yellow.svg\"/>\r\n <img src =\"https://img.shields.io/badge/python-3.10|3.11|3.12-blue.svg\"/>\r\n <img src =\"https://img.shields.io/github/license/vnpy/vnpy.svg?color=orange\"/>\r\n</p>\r\n\r\n## \u8bf4\u660e\r\n\r\n\u57fa\u4e8eTTS\u76846.7.2\u63a5\u53e3\u5c01\u88c5\u5f00\u53d1\uff0c\u5bf9\u63a5\u7c7bCTP\u7684\u4eff\u771f\u4ea4\u6613\u73af\u5883\u3002\r\n\r\n\u76ee\u524dTTS\u652f\u6301\u7684\u4eff\u771f\u4ea4\u6613\u5305\u62ec\uff1a\r\n\r\n- \u671f\u8d27\r\n - \u4e2d\u91d1\u6240\r\n - \u4e0a\u671f\u6240\r\n - \u5927\u5546\u6240\r\n - \u90d1\u5546\u6240\r\n - \u5e7f\u671f\u6240\r\n - \u80fd\u4ea4\u6240\r\n- \u80a1\u7968\r\n - \u4e0a\u4ea4\u6240\r\n - \u6df1\u4ea4\u6240\r\n\r\n## \u5b89\u88c5\r\n\r\n\u5b89\u88c5\u73af\u5883\u63a8\u8350\u57fa\u4e8e3.9.0\u7248\u672c\u4ee5\u4e0a\u7684\u3010[**VeighNa Studio**](https://www.vnpy.com)\u3011\u3002\r\n\r\n\u76f4\u63a5\u4f7f\u7528pip\u547d\u4ee4\uff1a\r\n\r\n```\r\npip install vnpy_tts\r\n```\r\n\r\n\r\n\u6216\u8005\u4e0b\u8f7d\u6e90\u4ee3\u7801\u540e\uff0c\u89e3\u538b\u540e\u5728cmd\u4e2d\u8fd0\u884c\uff1a\r\n\r\n```\r\npip install .\r\n```\r\n\r\n\u4f7f\u7528\u6e90\u4ee3\u7801\u5b89\u88c5\u65f6\u9700\u8981\u8fdb\u884cC++\u7f16\u8bd1\uff0c\u56e0\u6b64\u5728\u6267\u884c\u4e0a\u8ff0\u547d\u4ee4\u4e4b\u524d\u8bf7\u786e\u4fdd\u5df2\u7ecf\u5b89\u88c5\u4e86\u3010Visual Studio\uff08Windows\uff09\u3011\u6216\u8005\u3010GCC\uff08Linux\uff09\u3011\u7f16\u8bd1\u5668\u3002\r\n\r\n\r\n## \u4f7f\u7528\r\n\r\n\u4ee5\u811a\u672c\u65b9\u5f0f\u542f\u52a8\uff08script/run.py\uff09\uff1a\r\n\r\n```\r\nfrom vnpy.event import EventEngine\r\nfrom vnpy.trader.engine import MainEngine\r\nfrom vnpy.trader.ui import MainWindow, create_qapp\r\n\r\nfrom vnpy_tts import TtsGateway\r\n\r\n\r\ndef main():\r\n \"\"\"\u4e3b\u5165\u53e3\u51fd\u6570\"\"\"\r\n qapp = create_qapp()\r\n\r\n event_engine = EventEngine()\r\n main_engine = MainEngine(event_engine)\r\n main_engine.add_gateway(TtsGateway)\r\n \r\n main_window = MainWindow(main_engine, event_engine)\r\n main_window.showMaximized()\r\n\r\n qapp.exec()\r\n\r\n\r\nif __name__ == \"__main__\":\r\n main()\r\n```\r\n\r\n## \u8fde\u63a5\r\n\r\n\u6a21\u62df\u8d26\u53f7\u53ef\u901a\u8fc7https://github.com/krenx1983/openctp \u83b7\u53d6\u3002\r\n\r\n\u8fde\u63a5\u4fe1\u606f\u5982\u4e0b\uff1a\r\n\r\n```\r\n{\r\n \"\u7528\u6237\u540d\": \"xxxxxx\",\r\n \"\u5bc6\u7801\": \"xxxxxx\",\r\n \"\u7ecf\u7eaa\u5546\u4ee3\u7801\": \"\",\r\n \"\u4ea4\u6613\u670d\u52a1\u5668\": \"121.36.146.182:20002\",\r\n \"\u884c\u60c5\u670d\u52a1\u5668\": \"121.36.146.182:20004\",\r\n \"\u4ea7\u54c1\u540d\u79f0\": \"\",\r\n \"\u6388\u6743\u7f16\u7801\": \"\"\r\n}\r\n```\r\n7x24\u5c0f\u65f6\u73af\u5883\uff1a\r\n \u4ea4\u6613\u670d\u52a1\u5668 - 122.37.80.177:20002\r\n \u884c\u60c5\u670d\u52a1\u5668 - 122.37.80.177:20004\r\n\r\n\u7ecf\u7eaa\u5546\u4ee3\u7801\u3001\u4ea7\u54c1\u540d\u79f0\u3001\u6388\u6743\u7f16\u7801\u4e09\u9879\u53ef\u4ee5\u4e0d\u586b\u3002\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "TTS gateway for VeighNa quant trading framework.",
"version": "6.7.2.0",
"project_urls": {
"Homepage": "https://www.vnpy.com"
},
"split_keywords": [
"quant",
" quantitative",
" investment",
" trading",
" algotrading",
" ctp"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "73ed92cb3be5123fa6393bb79de9cd0a7a05c8f2deb93e1fb8411ef5d300b8c2",
"md5": "168135065471b4bd233905f3051fc7d3",
"sha256": "bcea0a3bd75c3ebf9e93aabfb3b2c5aa6e9e5b8e2baf16478085344b7b32da51"
},
"downloads": -1,
"filename": "vnpy_tts-6.7.2.0-cp310-cp310-win_amd64.whl",
"has_sig": false,
"md5_digest": "168135065471b4bd233905f3051fc7d3",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 2970387,
"upload_time": "2024-03-27T01:21:55",
"upload_time_iso_8601": "2024-03-27T01:21:55.908557Z",
"url": "https://files.pythonhosted.org/packages/73/ed/92cb3be5123fa6393bb79de9cd0a7a05c8f2deb93e1fb8411ef5d300b8c2/vnpy_tts-6.7.2.0-cp310-cp310-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d3b834b3538b7edd1e1670461652205c342bd6a1ec6e17151aef89bde0c18250",
"md5": "39187eee7cbbd72dd276aeb2a87ab2a4",
"sha256": "560a598289b36746eca1fd2218fa2e550023e2b49bc890148e0b295400e0e079"
},
"downloads": -1,
"filename": "vnpy_tts-6.7.2.0.tar.gz",
"has_sig": false,
"md5_digest": "39187eee7cbbd72dd276aeb2a87ab2a4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 2088712,
"upload_time": "2024-03-27T01:21:57",
"upload_time_iso_8601": "2024-03-27T01:21:57.549564Z",
"url": "https://files.pythonhosted.org/packages/d3/b8/34b3538b7edd1e1670461652205c342bd6a1ec6e17151aef89bde0c18250/vnpy_tts-6.7.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-27 01:21:57",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "vnpy-tts"
}