Skip to main content

VeighNa框架的易盛底层接口

说明

基于易盛的启明星V9API的9.0.3.16接口封装开发,支持启明星后台系统,适用于内盘交易所交易。

安装

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

直接使用pip命令:

pip install vnpy_esunny

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


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

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

    qapp.exec()


if __name__ == "__main__":
    main()

gateway调整说明

对比之前基于易盛的启明星/北斗星兼容交易API的1.0.2.2接口封装开发的esunny_gateway.py,目前的esunny_gateway.py做了以下调整:

  1. QuoteApi中品种查询、合约查询以及行情订阅函数调用时都需要传入session(int)入参;

  2. TradeApi采用vnpy_tap中tap_gateway.py的方式,登录之后先查询资金、持仓、委托、成交推送一次,后续收到更新再继续推送;

  3. TradeApi调用insertOrder函数进行委托时,新增指定TacticsType策略单类型、TriggerCondition触发条件类型、TriggerPriceType触发价格类型字段传N,OrderSource委托来源字段传A(TAPI_ORDER_SOURCE_ESUNNY_API 易盛API)

  4. TradeApi调用insertOrder函数进行委托时,金交所合约的HedgeFlag投机保值/HedgeFlag2投机保值2都和期货委托一致,传TAPI_HEDGEFLAG_T投机(之前esunny_gateway.py中金交所合约是传TAPI_HEDGEFLAG_N无)

Release files for vnpy_esunny 9.0.3.16.3

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

Source distribution (sdist)

Source distribution for vnpy_esunny 9.0.3.16.3
File Size Uploaded
vnpy_esunny-9.0.3.16.3.tar.gz 665.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for vnpy_esunny 9.0.3.16.3
File Interpreter ABI Platform
vnpy_esunny-9.0.3.16.3-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
vnpy_esunny-9.0.3.16.3-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details

Total release size: 3.3 MB

Release files / vnpy_esunny-9.0.3.16.3.tar.gz

Download URL vnpy_esunny-9.0.3.16.3.tar.gz
Size 665.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2c0106888627e634cf9f782d09a798ed162f0a087053b7ead9e17e223ccd7973
BLAKE2b-256 checksum
How to use checksums
78e7a33dec0d79b90f315cf2befc631fe0ad7cef3666b255f8ae783e7d6b4d02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.3

Release files / vnpy_esunny-9.0.3.16.3-cp313-cp313-win_amd64.whl

Download URL vnpy_esunny-9.0.3.16.3-cp313-cp313-win_amd64.whl
Size 1.3 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
bb7ae2fc41f4622f967c2b6b9392d02d81ab3343920a0c49c44d7cf4b0acbb0f
BLAKE2b-256 checksum
How to use checksums
fa86663c0173eab1a97b0a07e59ffed1dad3f7e423509e40ac98375519ff4aac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.3

Release files / vnpy_esunny-9.0.3.16.3-cp310-cp310-win_amd64.whl

Download URL vnpy_esunny-9.0.3.16.3-cp310-cp310-win_amd64.whl
Size 1.3 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
77ec4f2159e79d04707f818cbee625ed5320e14841c98cbba0ddc5081848eeae
BLAKE2b-256 checksum
How to use checksums
6edc20623b9f9a6372d5b184999a11146f296a11b25a68890f77b513313afba2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.3
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