vnpy_binance 2025.6.17__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.
- vnpy_binance-2025.6.17/.gitignore +129 -0
- vnpy_binance-2025.6.17/LICENSE +21 -0
- vnpy_binance-2025.6.17/PKG-INFO +98 -0
- vnpy_binance-2025.6.17/README.md +70 -0
- vnpy_binance-2025.6.17/pyproject.toml +85 -0
- vnpy_binance-2025.6.17/vnpy_binance/__init__.py +35 -0
- vnpy_binance-2025.6.17/vnpy_binance/inverse_gateway.py +1656 -0
- vnpy_binance-2025.6.17/vnpy_binance/linear_gateway.py +1653 -0
- vnpy_binance-2025.6.17/vnpy_binance/spot_gateway.py +1572 -0
|
@@ -0,0 +1,129 @@
|
|
|
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/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
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,98 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vnpy_binance
|
|
3
|
+
Version: 2025.6.17
|
|
4
|
+
Summary: BINANCE trading gateway for VeighNa.
|
|
5
|
+
Project-URL: Homepage, https://www.github.com/veighna-global
|
|
6
|
+
Project-URL: Source, https://www.github.com/veighna-global
|
|
7
|
+
Author-email: VeighNa Global <veighna@hotmail.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: algotrading,binance,btc,crypto,investment,quant,quantitative,trading
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Natural Language :: English
|
|
14
|
+
Classifier: Operating System :: MacOS
|
|
15
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
16
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
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
|
+
Requires-Dist: vnpy-rest
|
|
26
|
+
Requires-Dist: vnpy-websocket
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# Binance trading gateway for VeighNa
|
|
30
|
+
|
|
31
|
+
<p align="center">
|
|
32
|
+
<img src ="https://github.com/veighna-global/vnpy_evo/blob/dev/logo.png" width="300" height="300"/>
|
|
33
|
+
</p>
|
|
34
|
+
|
|
35
|
+
<p align="center">
|
|
36
|
+
<img src ="https://img.shields.io/badge/version-2025.06.17-blueviolet.svg"/>
|
|
37
|
+
<img src ="https://img.shields.io/badge/platform-windows|linux|macos-yellow.svg"/>
|
|
38
|
+
<img src ="https://img.shields.io/badge/python-3.10|3.11|3.12-blue.svg"/>
|
|
39
|
+
<img src ="https://img.shields.io/github/license/veighna-global/vnpy_binance.svg?color=orange"/>
|
|
40
|
+
</p>
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## Introduction
|
|
44
|
+
|
|
45
|
+
This gateway is developed based on Binance's REST and Websocket API, and supports spot, linear contract and inverse contract trading.
|
|
46
|
+
|
|
47
|
+
**For derivatives contract trading, please notice:**
|
|
48
|
+
|
|
49
|
+
1. Only supports cross margin mode.
|
|
50
|
+
2. Only supports one-way position mode.
|
|
51
|
+
|
|
52
|
+
## Install
|
|
53
|
+
|
|
54
|
+
Users can easily install ``vnpy_binance`` by pip according to the following command.
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
pip install vnpy_binance
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Also, users can install ``vnpy_binance`` using the source code. Clone the repository and install as follows:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
git clone https://github.com/veighna-global/vnpy_binance.git && cd vnpy_binance
|
|
64
|
+
|
|
65
|
+
python setup.py install
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## A Simple Example
|
|
69
|
+
|
|
70
|
+
Save this as run.py.
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
from vnpy.event import EventEngine
|
|
74
|
+
from vnpy.trader.engine import MainEngine
|
|
75
|
+
from vnpy.trader.ui import MainWindow, create_qapp
|
|
76
|
+
|
|
77
|
+
from vnpy_binance import (
|
|
78
|
+
BinanceLinearGateway,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def main() -> None:
|
|
83
|
+
"""main entry"""
|
|
84
|
+
qapp = create_qapp()
|
|
85
|
+
|
|
86
|
+
event_engine = EventEngine()
|
|
87
|
+
main_engine = MainEngine(event_engine)
|
|
88
|
+
main_engine.add_gateway(BinanceLinearGateway)
|
|
89
|
+
|
|
90
|
+
main_window = MainWindow(main_engine, event_engine)
|
|
91
|
+
main_window.showMaximized()
|
|
92
|
+
|
|
93
|
+
qapp.exec()
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
if __name__ == "__main__":
|
|
97
|
+
main()
|
|
98
|
+
```
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Binance trading gateway for VeighNa
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src ="https://github.com/veighna-global/vnpy_evo/blob/dev/logo.png" width="300" height="300"/>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<img src ="https://img.shields.io/badge/version-2025.06.17-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-blue.svg"/>
|
|
11
|
+
<img src ="https://img.shields.io/github/license/veighna-global/vnpy_binance.svg?color=orange"/>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Introduction
|
|
16
|
+
|
|
17
|
+
This gateway is developed based on Binance's REST and Websocket API, and supports spot, linear contract and inverse contract trading.
|
|
18
|
+
|
|
19
|
+
**For derivatives contract trading, please notice:**
|
|
20
|
+
|
|
21
|
+
1. Only supports cross margin mode.
|
|
22
|
+
2. Only supports one-way position mode.
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
|
|
26
|
+
Users can easily install ``vnpy_binance`` by pip according to the following command.
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
pip install vnpy_binance
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Also, users can install ``vnpy_binance`` using the source code. Clone the repository and install as follows:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
git clone https://github.com/veighna-global/vnpy_binance.git && cd vnpy_binance
|
|
36
|
+
|
|
37
|
+
python setup.py install
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## A Simple Example
|
|
41
|
+
|
|
42
|
+
Save this as run.py.
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
from vnpy.event import EventEngine
|
|
46
|
+
from vnpy.trader.engine import MainEngine
|
|
47
|
+
from vnpy.trader.ui import MainWindow, create_qapp
|
|
48
|
+
|
|
49
|
+
from vnpy_binance import (
|
|
50
|
+
BinanceLinearGateway,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def main() -> None:
|
|
55
|
+
"""main entry"""
|
|
56
|
+
qapp = create_qapp()
|
|
57
|
+
|
|
58
|
+
event_engine = EventEngine()
|
|
59
|
+
main_engine = MainEngine(event_engine)
|
|
60
|
+
main_engine.add_gateway(BinanceLinearGateway)
|
|
61
|
+
|
|
62
|
+
main_window = MainWindow(main_engine, event_engine)
|
|
63
|
+
main_window.showMaximized()
|
|
64
|
+
|
|
65
|
+
qapp.exec()
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
if __name__ == "__main__":
|
|
69
|
+
main()
|
|
70
|
+
```
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "vnpy_binance"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
description = "BINANCE trading gateway for VeighNa."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = {text = "MIT"}
|
|
7
|
+
authors = [{name = "VeighNa Global", email = "veighna@hotmail.com"}]
|
|
8
|
+
classifiers = [
|
|
9
|
+
"Development Status :: 5 - Production/Stable",
|
|
10
|
+
"Operating System :: Microsoft :: Windows",
|
|
11
|
+
"Operating System :: POSIX :: Linux",
|
|
12
|
+
"Operating System :: MacOS",
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"Programming Language :: Python :: 3.10",
|
|
15
|
+
"Programming Language :: Python :: 3.11",
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Programming Language :: Python :: 3.13",
|
|
18
|
+
"Topic :: Office/Business :: Financial :: Investment",
|
|
19
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
20
|
+
"License :: OSI Approved :: MIT License",
|
|
21
|
+
"Natural Language :: English",
|
|
22
|
+
]
|
|
23
|
+
requires-python = ">=3.10"
|
|
24
|
+
keywords = ["quant", "quantitative", "investment", "trading", "algotrading", "binance", "btc", "crypto"]
|
|
25
|
+
dependencies = [
|
|
26
|
+
"vnpy_rest",
|
|
27
|
+
"vnpy_websocket",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
"Homepage" = "https://www.github.com/veighna-global"
|
|
32
|
+
"Source" = "https://www.github.com/veighna-global"
|
|
33
|
+
|
|
34
|
+
[build-system]
|
|
35
|
+
requires = ["hatchling>=1.27.0"]
|
|
36
|
+
build-backend = "hatchling.build"
|
|
37
|
+
|
|
38
|
+
[tool.hatch.version]
|
|
39
|
+
path = "vnpy_binance/__init__.py"
|
|
40
|
+
pattern = "__version__ = ['\"](?P<version>[^'\"]+)['\"]"
|
|
41
|
+
|
|
42
|
+
[tool.hatch.build.targets.wheel]
|
|
43
|
+
packages = ["vnpy_binance"]
|
|
44
|
+
include-package-data = true
|
|
45
|
+
|
|
46
|
+
[tool.hatch.build.targets.sdist]
|
|
47
|
+
include = ["vnpy_binance*"]
|
|
48
|
+
|
|
49
|
+
[tool.ruff]
|
|
50
|
+
target-version = "py310"
|
|
51
|
+
output-format = "full"
|
|
52
|
+
|
|
53
|
+
[tool.ruff.lint]
|
|
54
|
+
select = [
|
|
55
|
+
"B", # flake8-bugbear
|
|
56
|
+
"E", # pycodestyle error
|
|
57
|
+
"F", # pyflakes
|
|
58
|
+
"UP", # pyupgrade
|
|
59
|
+
"W", # pycodestyle warning
|
|
60
|
+
]
|
|
61
|
+
ignore = ["E501"]
|
|
62
|
+
|
|
63
|
+
[tool.mypy]
|
|
64
|
+
python_version = "3.10"
|
|
65
|
+
warn_return_any = true
|
|
66
|
+
warn_unused_configs = true
|
|
67
|
+
disallow_untyped_defs = true
|
|
68
|
+
disallow_incomplete_defs = true
|
|
69
|
+
check_untyped_defs = true
|
|
70
|
+
disallow_untyped_decorators = true
|
|
71
|
+
no_implicit_optional = true
|
|
72
|
+
strict_optional = true
|
|
73
|
+
warn_redundant_casts = true
|
|
74
|
+
warn_unused_ignores = true
|
|
75
|
+
warn_no_return = true
|
|
76
|
+
ignore_missing_imports = true
|
|
77
|
+
|
|
78
|
+
[[tool.mypy.overrides]]
|
|
79
|
+
module = [
|
|
80
|
+
"vnpy.*",
|
|
81
|
+
"vnpy_rest.*",
|
|
82
|
+
"vnpy_websocket.*"
|
|
83
|
+
]
|
|
84
|
+
ignore_errors = true
|
|
85
|
+
ignore_missing_imports = true
|
|
@@ -0,0 +1,35 @@
|
|
|
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 .linear_gateway import BinanceLinearGateway
|
|
24
|
+
from .inverse_gateway import BinanceInverseGateway
|
|
25
|
+
from .spot_gateway import BinanceSpotGateway
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
__version__ = "2025.06.17"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
__all__ = [
|
|
32
|
+
"BinanceLinearGateway",
|
|
33
|
+
"BinanceInverseGateway",
|
|
34
|
+
"BinanceSpotGateway"
|
|
35
|
+
]
|