# VeighNa框架的恒生UFT接口
<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-3.7.4.1004-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>
## 说明
基于恒生极速API的3.7.4.1004版本开发。
## 安装
安装环境推荐基于3.9.0版本以上的【[**VeighNa Studio**](https://www.vnpy.com)】。
直接使用pip命令:
```
pip install vnpy_uft
```
或者下载源代码后,解压后在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_uft import UftGateway
def main():
"""主入口函数"""
qapp = create_qapp()
event_engine = EventEngine()
main_engine = MainEngine(event_engine)
main_engine.add_gateway(UftGateway)
main_window = MainWindow(main_engine, event_engine)
main_window.showMaximized()
qapp.exec()
if __name__ == "__main__":
main()
```
## 连接
实盘交易时,请将期货公司提供的license.dat文件,放置于程序运行时目录(启动VeighNa Trader后,顶部标题栏所显示的目录)。
期货:
{
"用户名": "xxxxxx",
"密码": "xxxxxx",
"行情服务器": "101.71.12.144:9006",
"交易服务器": "101.71.12.144:9006",
"产品名称": "Hs_JT_1.0",
"授权编码": "20191127JTV1"
}
ETF期权:
{
"用户名": "xxxxxx",
"密码": "xxxxxx",
"行情服务器": "101.71.12.149:8102",
"交易服务器": "101.71.12.149:8102",
"产品名称": "",
"授权编码": ""
}
Raw data
{
"_id": null,
"home_page": "https://www.vnpy.com",
"name": "vnpy-uft",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "quant, quantitative, investment, trading, algotrading",
"author": "Xiaoyou Chen",
"author_email": "xiaoyou.chen@mail.vnpy.com",
"download_url": "https://files.pythonhosted.org/packages/88/9d/05be40bfd393f052935143371b0940e284ba75b45a5fa4f682686cd9c860/vnpy_uft-3.7.4.1004.tar.gz",
"platform": null,
"description": "# VeighNa\u6846\u67b6\u7684\u6052\u751fUFT\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-3.7.4.1004-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\u4e8e\u6052\u751f\u6781\u901fAPI\u76843.7.4.1004\u7248\u672c\u5f00\u53d1\u3002\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_uft\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## \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_uft import UftGateway\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(UftGateway)\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\u5b9e\u76d8\u4ea4\u6613\u65f6\uff0c\u8bf7\u5c06\u671f\u8d27\u516c\u53f8\u63d0\u4f9b\u7684license.dat\u6587\u4ef6\uff0c\u653e\u7f6e\u4e8e\u7a0b\u5e8f\u8fd0\u884c\u65f6\u76ee\u5f55\uff08\u542f\u52a8VeighNa Trader\u540e\uff0c\u9876\u90e8\u6807\u9898\u680f\u6240\u663e\u793a\u7684\u76ee\u5f55\uff09\u3002\r\n\r\n\u671f\u8d27\uff1a\r\n\r\n{\r\n \"\u7528\u6237\u540d\": \"xxxxxx\",\r\n \"\u5bc6\u7801\": \"xxxxxx\",\r\n \"\u884c\u60c5\u670d\u52a1\u5668\": \"101.71.12.144:9006\",\r\n \"\u4ea4\u6613\u670d\u52a1\u5668\": \"101.71.12.144:9006\",\r\n \"\u4ea7\u54c1\u540d\u79f0\": \"Hs_JT_1.0\",\r\n \"\u6388\u6743\u7f16\u7801\": \"20191127JTV1\"\r\n}\r\n\r\nETF\u671f\u6743\uff1a\r\n\r\n{\r\n \"\u7528\u6237\u540d\": \"xxxxxx\",\r\n \"\u5bc6\u7801\": \"xxxxxx\",\r\n \"\u884c\u60c5\u670d\u52a1\u5668\": \"101.71.12.149:8102\",\r\n \"\u4ea4\u6613\u670d\u52a1\u5668\": \"101.71.12.149:8102\",\r\n \"\u4ea7\u54c1\u540d\u79f0\": \"\",\r\n \"\u6388\u6743\u7f16\u7801\": \"\"\r\n}\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "UFT gateway for vn.py quant trading framework.",
"version": "3.7.4.1004",
"project_urls": {
"Homepage": "https://www.vnpy.com"
},
"split_keywords": [
"quant",
" quantitative",
" investment",
" trading",
" algotrading"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "249bc1a4f63e3d5988e081345e07d2dcec482e989446c816748b48fa70af9767",
"md5": "0196ac0ec1de9a9cba8bc4716a3ddad5",
"sha256": "cf782fe906c780dc1bbddbf7326422a54eb7f79ce71a8e4f51436a9b3181a544"
},
"downloads": -1,
"filename": "vnpy_uft-3.7.4.1004-cp310-cp310-win_amd64.whl",
"has_sig": false,
"md5_digest": "0196ac0ec1de9a9cba8bc4716a3ddad5",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.10",
"size": 21449556,
"upload_time": "2024-10-10T05:40:43",
"upload_time_iso_8601": "2024-10-10T05:40:43.144398Z",
"url": "https://files.pythonhosted.org/packages/24/9b/c1a4f63e3d5988e081345e07d2dcec482e989446c816748b48fa70af9767/vnpy_uft-3.7.4.1004-cp310-cp310-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "889d05be40bfd393f052935143371b0940e284ba75b45a5fa4f682686cd9c860",
"md5": "4362558c9323e2449ad645382f299d64",
"sha256": "51d0ab66dab9337f08b1e303c6818f2e30c876d95d3b220fea8d8559199f7157"
},
"downloads": -1,
"filename": "vnpy_uft-3.7.4.1004.tar.gz",
"has_sig": false,
"md5_digest": "4362558c9323e2449ad645382f299d64",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 20649185,
"upload_time": "2024-10-10T05:40:47",
"upload_time_iso_8601": "2024-10-10T05:40:47.902499Z",
"url": "https://files.pythonhosted.org/packages/88/9d/05be40bfd393f052935143371b0940e284ba75b45a5fa4f682686cd9c860/vnpy_uft-3.7.4.1004.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-10 05:40:47",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "vnpy-uft"
}