Skip to main content

VeighNa框架的CTP底层接口

改动过,针对rpc做扩展

  • 支持远程rpc到server,查询米筐数据
  • 除了get_contract_option方法自定义了,其他方法和米筐使用方式一样
  • 需要手动装下talib 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)

说明

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

安装

安装环境推荐基于3.3.0版本以上的【VeighNa Studio】。

直接使用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()

Metadata

Release files for leo-vnpy-ctp 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for leo-vnpy-ctp 1.0.4
File Size Uploaded Provenance Actions
leo_vnpy_ctp-1.0.4.tar.gz 8.2 MB Without provenance Details for leo_vnpy_ctp-1.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for leo-vnpy-ctp 1.0.4
File Interpreter ABI Platform Actions
leo_vnpy_ctp-1.0.4-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for leo_vnpy_ctp-1.0.4-cp310-cp310-win_amd64.whl

Total release size: 17.3 MB

Release files / leo_vnpy_ctp-1.0.4.tar.gz

Download URL leo_vnpy_ctp-1.0.4.tar.gz
Size 8.2 MB
Tags Source
SHA-256 checksum
How to use checksums
17294632bf0e00de654577308d9aa7f3652942e76bf9e1e1bc8aebae7bf59a35
BLAKE2b-256 checksum
How to use checksums
a7d32cc98c4dc6e39d4a53d4e93c217c9511782224eba1b371ff70f07a8f540d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.4

Release files / leo_vnpy_ctp-1.0.4-cp310-cp310-win_amd64.whl

Download URL leo_vnpy_ctp-1.0.4-cp310-cp310-win_amd64.whl
Size 9.1 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
e84348b75693fc977362780b1269e78bcdaa94aec60ebdae62263522da13fe54
BLAKE2b-256 checksum
How to use checksums
2acc106aec539eb50cc998bb223f3c8f0bd5897114f2f499512313fb358e3218
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.4

Security for leo-vnpy-ctp 1.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page