{"id":16939098,"url":"https://github.com/vnpy/vnpy_ib","last_synced_at":"2025-03-22T12:32:13.456Z","repository":{"id":38315300,"uuid":"411480580","full_name":"vnpy/vnpy_ib","owner":"vnpy","description":"VeighNa框架的InteractiveBrokers交易接口","archived":false,"fork":false,"pushed_at":"2024-03-22T03:24:06.000Z","size":84,"stargazers_count":27,"open_issues_count":1,"forks_count":27,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-03-22T11:10:34.843Z","etag":null,"topics":["interactivebrokers","python","veighna","vnpy"],"latest_commit_sha":null,"homepage":"https://www.vnpy.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vnpy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-09-29T00:37:28.000Z","updated_at":"2024-04-15T06:23:16.026Z","dependencies_parsed_at":"2023-10-11T01:40:47.050Z","dependency_job_id":"33445259-3fa5-4c45-a7f2-b2411ea6852b","html_url":"https://github.com/vnpy/vnpy_ib","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vnpy%2Fvnpy_ib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vnpy%2Fvnpy_ib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vnpy%2Fvnpy_ib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vnpy%2Fvnpy_ib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vnpy","download_url":"https://codeload.github.com/vnpy/vnpy_ib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244959444,"owners_count":20538625,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["interactivebrokers","python","veighna","vnpy"],"created_at":"2024-10-13T21:03:39.162Z","updated_at":"2025-03-22T12:32:13.441Z","avatar_url":"https://github.com/vnpy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VeighNa框架的InteractiveBrokers交易接口\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src =\"https://vnpy.oss-cn-shanghai.aliyuncs.com/vnpy-logo.png\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src =\"https://img.shields.io/badge/version-10.19.1.12-blueviolet.svg\"/\u003e\n    \u003cimg src =\"https://img.shields.io/badge/platform-windows|linux|macos-yellow.svg\"/\u003e\n    \u003cimg src =\"https://img.shields.io/badge/python-3.10|3.11|3.12-blue.svg\" /\u003e\n    \u003cimg src =\"https://img.shields.io/github/license/vnpy/vnpy.svg?color=orange\"/\u003e\n\u003c/p\u003e\n\n## 说明\n\n基于ibapi的10.19.1版本开发的InteractiveBrokers交易接口。\n\nIbGateway中的合约代码支持两种风格：数字代码和字符串代码。\n\n数字代码基于IB平台的ConId，查询方式：在TWS软件中【右键点击任意合约】-\u003e【金融产品信息】-\u003e【详情】，然后在弹出的网页上即可找到合约的ConId。\n\n字符串代码基于合约的具体描述信息，命名规则和举例：\n\n|合约类型|代码规则|代码（symbol）|交易所（exchange）|\n|---|---|---|---|\n|股票|名称-货币-类别|SPY-USD-STK|SMART|\n|外汇|名称-货币-类别|EUR-USD-CASH|IDEALPRO|\n|贵金属|名称-货币-类别|XAUUSD-USD-CMDTY|SMART|\n|期货|名称-到期年月-货币-类别|ES-202002-USD-FUT|GLOBEX|\n|期货（指定乘数）|名称-到期年月-合约乘数-类别|SI-202006-1000-USD-FUT|NYMEX|\n|期货期权|名称-到期年月-期权类型-行权价-合约乘数-货币-类别|ES-2020006-C-2430-50-USD-FOP|GLOBEX|\n\n委托、成交、持仓信息中的合约代码，默认采用数字代码。如果用户使用字符串代码订阅过行情，则使用字符串代码。\n\n## 安装\n\n安装环境推荐基于3.9.0版本以上的【[**VeighNa Studio**](https://www.vnpy.com)】。\n\n### 安装ibapi\n\n在[IB官网](https://interactivebrokers.github.io/#)下载TWS API的msi安装文件，并运行安装。\n\n找到安装目录下的source\\pythonclient文件夹，在cmd中运行下述命令安装：\n\n```\npython setup.py install\n```\n\n### 安装vnpy_ib\n\n直接使用pip命令：\n\n```\npip install vnpy_ib\n```\n\n或者下载源代码后，解压后在cmd中运行：\n\n```\npip install .\n```\n\n## 使用\n\n以脚本方式启动（script/run.py）：\n\n```\nfrom vnpy.event import EventEngine\nfrom vnpy.trader.engine import MainEngine\nfrom vnpy.trader.ui import MainWindow, create_qapp\n\nfrom vnpy_ib import IbGateway\n\n\ndef main():\n    \"\"\"主入口函数\"\"\"\n    qapp = create_qapp()\n\n    event_engine = EventEngine()\n    main_engine = MainEngine(event_engine)\n    main_engine.add_gateway(IbGateway)\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvnpy%2Fvnpy_ib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvnpy%2Fvnpy_ib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvnpy%2Fvnpy_ib/lists"}