# vnpy_qmt
QMT Gateway for vnpy
# 实现功能
- 连接mini客户端实现普通买卖
# 安装方式
- 源码安装: 下载源码, 解压, 切换vnpy环境, 在cmd里执行
```commandline
(vnpyO) D:\work\my>cd vnpy_qmt
(vnpyO) D:\work\my\vnpy_qmt>pip install .
```
# 启用通道
1. 需要使用脚本启动方式启动vnpy, 下面是一个示例(文件名如:run.py)
2. 切换到vnpy环境(或者使用vnpy对应的python绝对路径),运行 `python run.py`
```python
# -*- coding:utf-8 -*-
from vnpy.event import EventEngine
from vnpy.trader.engine import MainEngine
from vnpy.trader.ui import MainWindow, create_qapp
# 导入QMT gateway
from vnpy_qmt.qmt_gateway import QmtGateway
from vnpy_ctastrategy import CtaEngine, CtaStrategyApp
def main():
"""Start VN Trader"""
qapp = create_qapp()
event_engine = EventEngine()
main_engine = MainEngine(event_engine)
main_engine.add_app(CtaStrategyApp)
# 添加gateway
main_engine.add_gateway(QmtGateway, gateway_name="QMT")
main_window = MainWindow(main_engine, event_engine)
main_window.showMaximized()
qapp.exec()
if __name__ == "__main__":
main()
```
## 依赖项目
[迅投xtquant官网下载](https://dict.thinktrader.net/nativeApi/download_xtquant.html)
[迅投xtquant介绍](https://dict.thinktrader.net/nativeApi/start_now.html)
# 使用
1. 启动、登录QMT mini客户端
2. 在vn.py连接QMT
![login_qmt.png](doc%2Flogin_qmt.png)
Raw data
{
"_id": null,
"home_page": "https://github.com/fsksf/vnpy_qmt",
"name": "vnpy-qmt",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "vnpy gateway qmt",
"author": "fsksf",
"author_email": "kangyuqiang123@qq.com",
"download_url": "https://files.pythonhosted.org/packages/54/9e/59282165125282bd77b44b2c778c566ae8d557f7c4859e911616fec1d523/vnpy_qmt-0.3.3.tar.gz",
"platform": null,
"description": "# vnpy_qmt\r\nQMT Gateway for vnpy\r\n\r\n# \u5b9e\u73b0\u529f\u80fd\r\n- \u8fde\u63a5mini\u5ba2\u6237\u7aef\u5b9e\u73b0\u666e\u901a\u4e70\u5356\r\n\r\n# \u5b89\u88c5\u65b9\u5f0f\r\n- \u6e90\u7801\u5b89\u88c5\uff1a \u4e0b\u8f7d\u6e90\u7801, \u89e3\u538b, \u5207\u6362vnpy\u73af\u5883, \u5728cmd\u91cc\u6267\u884c\r\n```commandline\r\n(vnpyO) D:\\work\\my>cd vnpy_qmt\r\n(vnpyO) D:\\work\\my\\vnpy_qmt>pip install .\r\n```\r\n# \u542f\u7528\u901a\u9053\r\n1. \u9700\u8981\u4f7f\u7528\u811a\u672c\u542f\u52a8\u65b9\u5f0f\u542f\u52a8vnpy, \u4e0b\u9762\u662f\u4e00\u4e2a\u793a\u4f8b(\u6587\u4ef6\u540d\u5982\uff1arun.py)\r\n2. \u5207\u6362\u5230vnpy\u73af\u5883(\u6216\u8005\u4f7f\u7528vnpy\u5bf9\u5e94\u7684python\u7edd\u5bf9\u8def\u5f84)\uff0c\u8fd0\u884c `python run.py`\r\n```python\r\n\r\n# -*- coding:utf-8 -*-\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# \u5bfc\u5165QMT gateway\r\nfrom vnpy_qmt.qmt_gateway import QmtGateway\r\nfrom vnpy_ctastrategy import CtaEngine, CtaStrategyApp\r\n\r\n\r\ndef main():\r\n \"\"\"Start VN Trader\"\"\"\r\n qapp = create_qapp()\r\n\r\n event_engine = EventEngine()\r\n main_engine = MainEngine(event_engine)\r\n main_engine.add_app(CtaStrategyApp)\r\n # \u6dfb\u52a0gateway\r\n main_engine.add_gateway(QmtGateway, gateway_name=\"QMT\")\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\r\n\r\n## \u4f9d\u8d56\u9879\u76ee\r\n[\u8fc5\u6295xtquant\u5b98\u7f51\u4e0b\u8f7d](https://dict.thinktrader.net/nativeApi/download_xtquant.html)\r\n[\u8fc5\u6295xtquant\u4ecb\u7ecd](https://dict.thinktrader.net/nativeApi/start_now.html)\r\n# \u4f7f\u7528\r\n1. \u542f\u52a8\u3001\u767b\u5f55QMT mini\u5ba2\u6237\u7aef\r\n2. \u5728vn.py\u8fde\u63a5QMT\r\n![login_qmt.png](doc%2Flogin_qmt.png)\r\n",
"bugtrack_url": null,
"license": "",
"summary": "vnpy qmt gateway",
"version": "0.3.3",
"project_urls": {
"Homepage": "https://github.com/fsksf/vnpy_qmt"
},
"split_keywords": [
"vnpy",
"gateway",
"qmt"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3f0f622d958d68483d1d0dffe276d299d2c683b1bed53e1f9f91c1760c68ab73",
"md5": "770fe5421ece722a1ab54b6c7ea43ebf",
"sha256": "e2918db71b5661333edcd4bd0bee5dab89f7aa03c54ab11478c55356f02be621"
},
"downloads": -1,
"filename": "vnpy_qmt-0.3.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "770fe5421ece722a1ab54b6c7ea43ebf",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 12921,
"upload_time": "2024-03-08T14:36:50",
"upload_time_iso_8601": "2024-03-08T14:36:50.535913Z",
"url": "https://files.pythonhosted.org/packages/3f/0f/622d958d68483d1d0dffe276d299d2c683b1bed53e1f9f91c1760c68ab73/vnpy_qmt-0.3.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "549e59282165125282bd77b44b2c778c566ae8d557f7c4859e911616fec1d523",
"md5": "d9ea92592617cef08f7436396ab62d47",
"sha256": "1ce80aef27b1fb18d71ab4f8032927314cd4062a749585e926bb036a35f069ee"
},
"downloads": -1,
"filename": "vnpy_qmt-0.3.3.tar.gz",
"has_sig": false,
"md5_digest": "d9ea92592617cef08f7436396ab62d47",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12501,
"upload_time": "2024-03-08T14:36:51",
"upload_time_iso_8601": "2024-03-08T14:36:51.753616Z",
"url": "https://files.pythonhosted.org/packages/54/9e/59282165125282bd77b44b2c778c566ae8d557f7c4859e911616fec1d523/vnpy_qmt-0.3.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-08 14:36:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fsksf",
"github_project": "vnpy_qmt",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "vnpy-qmt"
}