vnpy_ib 10.30.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,131 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+
113
+ # Spyder project settings
114
+ .spyderproject
115
+ .spyproject
116
+
117
+ # Rope project settings
118
+ .ropeproject
119
+
120
+ # mkdocs documentation
121
+ /site
122
+
123
+ # mypy
124
+ .mypy_cache/
125
+ .dmypy.json
126
+ dmypy.json
127
+
128
+ # Pyre type checker
129
+ .pyre/
130
+ .vscode/settings.json
131
+ .idea
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-present, Xiaoyou Chen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,117 @@
1
+ Metadata-Version: 2.4
2
+ Name: vnpy_ib
3
+ Version: 10.30.1.1
4
+ Summary: IB gateway for VeighNa quant trading framework.
5
+ Project-URL: Homepage, https://www.vnpy.com
6
+ Project-URL: Documentation, https://www.vnpy.com/docs
7
+ Project-URL: Source, https://github.com/vnpy/vnpy_ib/
8
+ Project-URL: Forum, https://www.vnpy.com/forum
9
+ Author-email: Xiaoyou Chen <xiaoyou.chen@mail.vnpy.com>
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: algotrading,investment,quant,quantitative,trading
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Natural Language :: Chinese (Simplified)
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: Implementation :: CPython
23
+ Classifier: Topic :: Office/Business :: Financial :: Investment
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+
27
+ # VeighNa框架的InteractiveBrokers交易接口
28
+
29
+ <p align="center">
30
+ <img src ="https://vnpy.oss-cn-shanghai.aliyuncs.com/vnpy-logo.png"/>
31
+ </p>
32
+
33
+ <p align="center">
34
+ <img src ="https://img.shields.io/badge/version-10.30.1.1-blueviolet.svg"/>
35
+ <img src ="https://img.shields.io/badge/platform-windows|linux|macos-yellow.svg"/>
36
+ <img src ="https://img.shields.io/badge/python-3.10|3.11|3.12|3.13-blue.svg" />
37
+ <img src ="https://img.shields.io/github/license/vnpy/vnpy.svg?color=orange"/>
38
+ </p>
39
+
40
+ ## 说明
41
+
42
+ 基于ibapi的10.30.1版本开发的InteractiveBrokers交易接口。
43
+
44
+ IbGateway中的合约代码支持两种风格:数字代码和字符串代码。
45
+
46
+ 数字代码基于IB平台的ConId,查询方式:在TWS软件中【右键点击任意合约】->【金融产品信息】->【详情】,然后在弹出的网页上即可找到合约的ConId。
47
+
48
+ 字符串代码基于合约的具体描述信息,命名规则和举例:
49
+
50
+ |合约类型|代码规则|代码(symbol)|交易所(exchange)|
51
+ |---|---|---|---|
52
+ |股票|名称-货币-类别|SPY-USD-STK|SMART|
53
+ |外汇|名称-货币-类别|EUR-USD-CASH|IDEALPRO|
54
+ |贵金属|名称-货币-类别|XAUUSD-USD-CMDTY|SMART|
55
+ |期货|名称-到期年月-货币-类别|ES-202002-USD-FUT|GLOBEX|
56
+ |期货(指定乘数)|名称-到期年月-合约乘数-类别|SI-202006-1000-USD-FUT|NYMEX|
57
+ |期货期权|名称-到期年月-期权类型-行权价-合约乘数-货币-类别|ES-2020006-C-2430-50-USD-FOP|GLOBEX|
58
+
59
+ 委托、成交、持仓信息中的合约代码,默认采用数字代码。如果用户使用字符串代码订阅过行情,则使用字符串代码。
60
+
61
+ ## 安装
62
+
63
+ 安装环境推荐基于4.0.0版本以上的【[**VeighNa Studio**](https://www.vnpy.com)】。
64
+
65
+ ### 安装ibapi
66
+
67
+ 在[IB官网](https://interactivebrokers.github.io/#)下载TWS API的msi安装文件,并运行安装。
68
+
69
+ 找到安装目录下的source\pythonclient文件夹,在cmd中运行下述命令安装:
70
+
71
+ ```
72
+ python setup.py install
73
+ ```
74
+
75
+ ### 安装vnpy_ib
76
+
77
+ 直接使用pip命令:
78
+
79
+ ```
80
+ pip install vnpy_ib
81
+ ```
82
+
83
+ 或者下载源代码后,解压后在cmd中运行:
84
+
85
+ ```
86
+ pip install .
87
+ ```
88
+
89
+ ## 使用
90
+
91
+ 以脚本方式启动(script/run.py):
92
+
93
+ ```
94
+ from vnpy.event import EventEngine
95
+ from vnpy.trader.engine import MainEngine
96
+ from vnpy.trader.ui import MainWindow, create_qapp
97
+
98
+ from vnpy_ib import IbGateway
99
+
100
+
101
+ def main():
102
+ """主入口函数"""
103
+ qapp = create_qapp()
104
+
105
+ event_engine = EventEngine()
106
+ main_engine = MainEngine(event_engine)
107
+ main_engine.add_gateway(IbGateway)
108
+
109
+ main_window = MainWindow(main_engine, event_engine)
110
+ main_window.showMaximized()
111
+
112
+ qapp.exec()
113
+
114
+
115
+ if __name__ == "__main__":
116
+ main()
117
+ ```
@@ -0,0 +1,91 @@
1
+ # VeighNa框架的InteractiveBrokers交易接口
2
+
3
+ <p align="center">
4
+ <img src ="https://vnpy.oss-cn-shanghai.aliyuncs.com/vnpy-logo.png"/>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <img src ="https://img.shields.io/badge/version-10.30.1.1-blueviolet.svg"/>
9
+ <img src ="https://img.shields.io/badge/platform-windows|linux|macos-yellow.svg"/>
10
+ <img src ="https://img.shields.io/badge/python-3.10|3.11|3.12|3.13-blue.svg" />
11
+ <img src ="https://img.shields.io/github/license/vnpy/vnpy.svg?color=orange"/>
12
+ </p>
13
+
14
+ ## 说明
15
+
16
+ 基于ibapi的10.30.1版本开发的InteractiveBrokers交易接口。
17
+
18
+ IbGateway中的合约代码支持两种风格:数字代码和字符串代码。
19
+
20
+ 数字代码基于IB平台的ConId,查询方式:在TWS软件中【右键点击任意合约】->【金融产品信息】->【详情】,然后在弹出的网页上即可找到合约的ConId。
21
+
22
+ 字符串代码基于合约的具体描述信息,命名规则和举例:
23
+
24
+ |合约类型|代码规则|代码(symbol)|交易所(exchange)|
25
+ |---|---|---|---|
26
+ |股票|名称-货币-类别|SPY-USD-STK|SMART|
27
+ |外汇|名称-货币-类别|EUR-USD-CASH|IDEALPRO|
28
+ |贵金属|名称-货币-类别|XAUUSD-USD-CMDTY|SMART|
29
+ |期货|名称-到期年月-货币-类别|ES-202002-USD-FUT|GLOBEX|
30
+ |期货(指定乘数)|名称-到期年月-合约乘数-类别|SI-202006-1000-USD-FUT|NYMEX|
31
+ |期货期权|名称-到期年月-期权类型-行权价-合约乘数-货币-类别|ES-2020006-C-2430-50-USD-FOP|GLOBEX|
32
+
33
+ 委托、成交、持仓信息中的合约代码,默认采用数字代码。如果用户使用字符串代码订阅过行情,则使用字符串代码。
34
+
35
+ ## 安装
36
+
37
+ 安装环境推荐基于4.0.0版本以上的【[**VeighNa Studio**](https://www.vnpy.com)】。
38
+
39
+ ### 安装ibapi
40
+
41
+ 在[IB官网](https://interactivebrokers.github.io/#)下载TWS API的msi安装文件,并运行安装。
42
+
43
+ 找到安装目录下的source\pythonclient文件夹,在cmd中运行下述命令安装:
44
+
45
+ ```
46
+ python setup.py install
47
+ ```
48
+
49
+ ### 安装vnpy_ib
50
+
51
+ 直接使用pip命令:
52
+
53
+ ```
54
+ pip install vnpy_ib
55
+ ```
56
+
57
+ 或者下载源代码后,解压后在cmd中运行:
58
+
59
+ ```
60
+ pip install .
61
+ ```
62
+
63
+ ## 使用
64
+
65
+ 以脚本方式启动(script/run.py):
66
+
67
+ ```
68
+ from vnpy.event import EventEngine
69
+ from vnpy.trader.engine import MainEngine
70
+ from vnpy.trader.ui import MainWindow, create_qapp
71
+
72
+ from vnpy_ib import IbGateway
73
+
74
+
75
+ def main():
76
+ """主入口函数"""
77
+ qapp = create_qapp()
78
+
79
+ event_engine = EventEngine()
80
+ main_engine = MainEngine(event_engine)
81
+ main_engine.add_gateway(IbGateway)
82
+
83
+ main_window = MainWindow(main_engine, event_engine)
84
+ main_window.showMaximized()
85
+
86
+ qapp.exec()
87
+
88
+
89
+ if __name__ == "__main__":
90
+ main()
91
+ ```
@@ -0,0 +1,77 @@
1
+ [project]
2
+ name = "vnpy_ib"
3
+ dynamic = ["version"]
4
+ description = "IB gateway for VeighNa quant trading framework."
5
+ readme = "README.md"
6
+ license = {text = "MIT"}
7
+ authors = [{name = "Xiaoyou Chen", email = "xiaoyou.chen@mail.vnpy.com"}]
8
+ classifiers = [
9
+ "Development Status :: 5 - Production/Stable",
10
+ "Operating System :: OS Independent",
11
+ "Programming Language :: Python :: 3",
12
+ "Programming Language :: Python :: 3.10",
13
+ "Programming Language :: Python :: 3.11",
14
+ "Programming Language :: Python :: 3.12",
15
+ "Programming Language :: Python :: 3.13",
16
+ "Topic :: Office/Business :: Financial :: Investment",
17
+ "Programming Language :: Python :: Implementation :: CPython",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Natural Language :: Chinese (Simplified)",
20
+ ]
21
+ requires-python = ">=3.10"
22
+ keywords = ["quant", "quantitative", "investment", "trading", "algotrading"]
23
+
24
+ [project.urls]
25
+ "Homepage" = "https://www.vnpy.com"
26
+ "Documentation" = "https://www.vnpy.com/docs"
27
+ "Source" = "https://github.com/vnpy/vnpy_ib/"
28
+ "Forum" = "https://www.vnpy.com/forum"
29
+
30
+ [build-system]
31
+ requires = ["hatchling>=1.27.0"]
32
+ build-backend = "hatchling.build"
33
+
34
+ [tool.hatch.version]
35
+ path = "vnpy_ib/__init__.py"
36
+ pattern = "__version__ = ['\"](?P<version>[^'\"]+)['\"]"
37
+
38
+ [tool.hatch.build.targets.wheel]
39
+ packages = ["vnpy_ib"]
40
+ include-package-data = true
41
+
42
+ [tool.hatch.build.targets.sdist]
43
+ include = ["vnpy_ib*"]
44
+
45
+ [tool.ruff]
46
+ target-version = "py310"
47
+ output-format = "full"
48
+
49
+ [tool.ruff.lint]
50
+ select = [
51
+ "B", # flake8-bugbear
52
+ "E", # pycodestyle error
53
+ "F", # pyflakes
54
+ "UP", # pyupgrade
55
+ "W", # pycodestyle warning
56
+ ]
57
+ ignore = ["E501"]
58
+
59
+ [tool.mypy]
60
+ python_version = "3.10"
61
+ warn_return_any = true
62
+ warn_unused_configs = true
63
+ disallow_untyped_defs = true
64
+ disallow_incomplete_defs = true
65
+ check_untyped_defs = true
66
+ disallow_untyped_decorators = true
67
+ no_implicit_optional = true
68
+ strict_optional = true
69
+ warn_redundant_casts = true
70
+ warn_unused_ignores = true
71
+ warn_no_return = true
72
+ ignore_missing_imports = true
73
+
74
+ [[tool.mypy.overrides]]
75
+ module = "ibapi.*"
76
+ ignore_errors = true
77
+ ignore_missing_imports = true
@@ -0,0 +1,29 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2015-present, Xiaoyou Chen
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
23
+ from .ib_gateway import IbGateway
24
+
25
+
26
+ __version__ = "10.30.1.1"
27
+
28
+
29
+ __all__ = ["IbGateway"]