leo-vnpy-ctp


Nameleo-vnpy-ctp JSON
Version 1.0.4 PyPI version JSON
download
home_pagehttps://www.vnpy.com
SummaryCTP gateway for vn.py quant trading framework.
upload_time2023-03-29 07:40:11
maintainer
docs_urlNone
authorXiaoyou Chen
requires_python>=3.7
licenseMIT
keywords quant quantitative investment trading algotrading ctp
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # VeighNa框架的CTP底层接口
## 改动过,针对rpc做扩展
- 支持远程rpc到server,查询米筐数据
- 除了get_contract_option方法自定义了,其他方法和米筐使用方式一样
- 需要手动装下talib  ![img.png](img.png)
```
from client_server.rpc import RpcCli
cli = RpcCli()
df = cli.rpc.get_contract_property(order_book_ids=['10002752'], start_date='20200101',end_date='20210118')
cli.rpc.get_price('000001.XSHE', start_date='2015-04-01', end_date='2015-04-03', adjust_type='none',expect_df=True)


cli.init_backtester()
filter = {"ma_param":60}
cli.load_local_data(table_name='symbol_ma', filter=filter)
```

<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.6.7.0-blueviolet.svg"/>
    <img src ="https://img.shields.io/badge/platform-windows|linux-yellow.svg"/>
    <img src ="https://img.shields.io/badge/python-3.7|3.8|3.9|3.10-blue.svg" />
    <img src ="https://img.shields.io/github/license/vnpy/vnpy.svg?color=orange"/>
</p>

## 说明

基于CTP期货版的6.6.7接口封装开发,接口中自带的是【穿透式实盘环境】的dll文件。

## 安装

安装环境推荐基于3.3.0版本以上的【[**VeighNa Studio**](https://www.vnpy.com)】。

直接使用pip命令:

```
pip install vnpy_ctp
```


或者下载源代码后,解压后在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_ctp import CtpGateway


def main():
    """主入口函数"""
    qapp = create_qapp()

    event_engine = EventEngine()
    main_engine = MainEngine(event_engine)
    main_engine.add_gateway(CtpGateway)
    
    main_window = MainWindow(main_engine, event_engine)
    main_window.showMaximized()

    qapp.exec()


if __name__ == "__main__":
    main()
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://www.vnpy.com",
    "name": "leo-vnpy-ctp",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "quant,quantitative,investment,trading,algotrading,ctp",
    "author": "Xiaoyou Chen",
    "author_email": "xiaoyou.chen@mail.vnpy.com",
    "download_url": "https://files.pythonhosted.org/packages/a7/d3/2cc98c4dc6e39d4a53d4e93c217c9511782224eba1b371ff70f07a8f540d/leo_vnpy_ctp-1.0.4.tar.gz",
    "platform": null,
    "description": "# VeighNa\u6846\u67b6\u7684CTP\u5e95\u5c42\u63a5\u53e3\n## \u6539\u52a8\u8fc7\uff0c\u9488\u5bf9rpc\u505a\u6269\u5c55\n- \u652f\u6301\u8fdc\u7a0brpc\u5230server\uff0c\u67e5\u8be2\u7c73\u7b50\u6570\u636e\n- \u9664\u4e86get_contract_option\u65b9\u6cd5\u81ea\u5b9a\u4e49\u4e86\uff0c\u5176\u4ed6\u65b9\u6cd5\u548c\u7c73\u7b50\u4f7f\u7528\u65b9\u5f0f\u4e00\u6837\n- \u9700\u8981\u624b\u52a8\u88c5\u4e0btalib  ![img.png](img.png)\n```\nfrom client_server.rpc import RpcCli\ncli = RpcCli()\ndf = cli.rpc.get_contract_property(order_book_ids=['10002752'], start_date='20200101',end_date='20210118')\ncli.rpc.get_price('000001.XSHE', start_date='2015-04-01', end_date='2015-04-03', adjust_type='none',expect_df=True)\n\n\ncli.init_backtester()\nfilter = {\"ma_param\":60}\ncli.load_local_data(table_name='symbol_ma', filter=filter)\n```\n\n<p align=\"center\">\n  <img src =\"https://vnpy.oss-cn-shanghai.aliyuncs.com/vnpy-logo.png\"/>\n</p>\n\n<p align=\"center\">\n    <img src =\"https://img.shields.io/badge/version-6.6.7.0-blueviolet.svg\"/>\n    <img src =\"https://img.shields.io/badge/platform-windows|linux-yellow.svg\"/>\n    <img src =\"https://img.shields.io/badge/python-3.7|3.8|3.9|3.10-blue.svg\" />\n    <img src =\"https://img.shields.io/github/license/vnpy/vnpy.svg?color=orange\"/>\n</p>\n\n## \u8bf4\u660e\n\n\u57fa\u4e8eCTP\u671f\u8d27\u7248\u76846.6.7\u63a5\u53e3\u5c01\u88c5\u5f00\u53d1\uff0c\u63a5\u53e3\u4e2d\u81ea\u5e26\u7684\u662f\u3010\u7a7f\u900f\u5f0f\u5b9e\u76d8\u73af\u5883\u3011\u7684dll\u6587\u4ef6\u3002\n\n## \u5b89\u88c5\n\n\u5b89\u88c5\u73af\u5883\u63a8\u8350\u57fa\u4e8e3.3.0\u7248\u672c\u4ee5\u4e0a\u7684\u3010[**VeighNa Studio**](https://www.vnpy.com)\u3011\u3002\n\n\u76f4\u63a5\u4f7f\u7528pip\u547d\u4ee4\uff1a\n\n```\npip install vnpy_ctp\n```\n\n\n\u6216\u8005\u4e0b\u8f7d\u6e90\u4ee3\u7801\u540e\uff0c\u89e3\u538b\u540e\u5728cmd\u4e2d\u8fd0\u884c\uff1a\n\n```\npip install .\n```\n\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\n\n## \u4f7f\u7528\n\n\u4ee5\u811a\u672c\u65b9\u5f0f\u542f\u52a8\uff08script/run.py\uff09\uff1a\n\n```\nfrom vnpy.event import EventEngine\nfrom vnpy.trader.engine import MainEngine\nfrom vnpy.trader.ui import MainWindow, create_qapp\n\nfrom vnpy_ctp import CtpGateway\n\n\ndef main():\n    \"\"\"\u4e3b\u5165\u53e3\u51fd\u6570\"\"\"\n    qapp = create_qapp()\n\n    event_engine = EventEngine()\n    main_engine = MainEngine(event_engine)\n    main_engine.add_gateway(CtpGateway)\n    \n    main_window = MainWindow(main_engine, event_engine)\n    main_window.showMaximized()\n\n    qapp.exec()\n\n\nif __name__ == \"__main__\":\n    main()\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "CTP gateway for vn.py quant trading framework.",
    "version": "1.0.4",
    "split_keywords": [
        "quant",
        "quantitative",
        "investment",
        "trading",
        "algotrading",
        "ctp"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2acc106aec539eb50cc998bb223f3c8f0bd5897114f2f499512313fb358e3218",
                "md5": "f634397c1693cb039d9f40c2a3e54154",
                "sha256": "e84348b75693fc977362780b1269e78bcdaa94aec60ebdae62263522da13fe54"
            },
            "downloads": -1,
            "filename": "leo_vnpy_ctp-1.0.4-cp310-cp310-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "f634397c1693cb039d9f40c2a3e54154",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.7",
            "size": 9082535,
            "upload_time": "2023-03-29T07:39:40",
            "upload_time_iso_8601": "2023-03-29T07:39:40.174362Z",
            "url": "https://files.pythonhosted.org/packages/2a/cc/106aec539eb50cc998bb223f3c8f0bd5897114f2f499512313fb358e3218/leo_vnpy_ctp-1.0.4-cp310-cp310-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a7d32cc98c4dc6e39d4a53d4e93c217c9511782224eba1b371ff70f07a8f540d",
                "md5": "2fe8f1246ecf45d30430206e50510e01",
                "sha256": "17294632bf0e00de654577308d9aa7f3652942e76bf9e1e1bc8aebae7bf59a35"
            },
            "downloads": -1,
            "filename": "leo_vnpy_ctp-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "2fe8f1246ecf45d30430206e50510e01",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 8173028,
            "upload_time": "2023-03-29T07:40:11",
            "upload_time_iso_8601": "2023-03-29T07:40:11.649035Z",
            "url": "https://files.pythonhosted.org/packages/a7/d3/2cc98c4dc6e39d4a53d4e93c217c9511782224eba1b371ff70f07a8f540d/leo_vnpy_ctp-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-29 07:40:11",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "leo-vnpy-ctp"
}
        
Elapsed time: 0.04970s