vnpy_okx 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_okx-2025.6.17/.gitignore +129 -0
- vnpy_okx-2025.6.17/LICENSE +21 -0
- vnpy_okx-2025.6.17/PKG-INFO +95 -0
- vnpy_okx-2025.6.17/README.md +67 -0
- vnpy_okx-2025.6.17/pyproject.toml +85 -0
- vnpy_okx-2025.6.17/vnpy_okx/__init__.py +29 -0
- vnpy_okx-2025.6.17/vnpy_okx/okx_gateway.py +1502 -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,95 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vnpy_okx
|
|
3
|
+
Version: 2025.6.17
|
|
4
|
+
Summary: OKX 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,btc,crypto,investment,okx,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
|
+
# OKX trading gateway for VeighNa Evo
|
|
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|3.13-blue.svg" />
|
|
39
|
+
<img src ="https://img.shields.io/github/license/veighna-global/vnpy_okx.svg?color=orange"/>
|
|
40
|
+
</p>
|
|
41
|
+
|
|
42
|
+
## Introduction
|
|
43
|
+
|
|
44
|
+
This gateway is developed based on OKX's V5 REST and Websocket API, and supports spot, linear contract and inverse contract trading.
|
|
45
|
+
|
|
46
|
+
**For derivatives contract trading, please notice:**
|
|
47
|
+
|
|
48
|
+
1. Only supports one-way position mode.
|
|
49
|
+
|
|
50
|
+
## Install
|
|
51
|
+
|
|
52
|
+
Users can easily install ``vnpy_okx`` by pip according to the following command.
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
pip install vnpy_okx
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Also, users can install ``vnpy_okx`` using the source code. Clone the repository and install as follows:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
git clone https://github.com/veighna-global/vnpy_okx.git && cd vnpy_okx
|
|
62
|
+
|
|
63
|
+
python setup.py install
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## A Simple Example
|
|
67
|
+
|
|
68
|
+
Save this as run.py.
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
from vnpy.event import EventEngine
|
|
72
|
+
from vnpy.trader.engine import MainEngine
|
|
73
|
+
from vnpy.trader.ui import MainWindow, create_qapp
|
|
74
|
+
|
|
75
|
+
from vnpy_okx import OkxGateway
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def main() -> None:
|
|
79
|
+
"""main entry"""
|
|
80
|
+
qapp = create_qapp()
|
|
81
|
+
|
|
82
|
+
event_engine = EventEngine()
|
|
83
|
+
main_engine = MainEngine(event_engine)
|
|
84
|
+
main_engine.add_gateway(OkxGateway)
|
|
85
|
+
|
|
86
|
+
main_window = MainWindow(main_engine, event_engine)
|
|
87
|
+
main_window.showMaximized()
|
|
88
|
+
|
|
89
|
+
qapp.exec()
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
if __name__ == "__main__":
|
|
93
|
+
main()
|
|
94
|
+
|
|
95
|
+
```
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# OKX trading gateway for VeighNa Evo
|
|
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|3.13-blue.svg" />
|
|
11
|
+
<img src ="https://img.shields.io/github/license/veighna-global/vnpy_okx.svg?color=orange"/>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
## Introduction
|
|
15
|
+
|
|
16
|
+
This gateway is developed based on OKX's V5 REST and Websocket API, and supports spot, linear contract and inverse contract trading.
|
|
17
|
+
|
|
18
|
+
**For derivatives contract trading, please notice:**
|
|
19
|
+
|
|
20
|
+
1. Only supports one-way position mode.
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
Users can easily install ``vnpy_okx`` by pip according to the following command.
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
pip install vnpy_okx
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Also, users can install ``vnpy_okx`` using the source code. Clone the repository and install as follows:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
git clone https://github.com/veighna-global/vnpy_okx.git && cd vnpy_okx
|
|
34
|
+
|
|
35
|
+
python setup.py install
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## A Simple Example
|
|
39
|
+
|
|
40
|
+
Save this as run.py.
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
from vnpy.event import EventEngine
|
|
44
|
+
from vnpy.trader.engine import MainEngine
|
|
45
|
+
from vnpy.trader.ui import MainWindow, create_qapp
|
|
46
|
+
|
|
47
|
+
from vnpy_okx import OkxGateway
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def main() -> None:
|
|
51
|
+
"""main entry"""
|
|
52
|
+
qapp = create_qapp()
|
|
53
|
+
|
|
54
|
+
event_engine = EventEngine()
|
|
55
|
+
main_engine = MainEngine(event_engine)
|
|
56
|
+
main_engine.add_gateway(OkxGateway)
|
|
57
|
+
|
|
58
|
+
main_window = MainWindow(main_engine, event_engine)
|
|
59
|
+
main_window.showMaximized()
|
|
60
|
+
|
|
61
|
+
qapp.exec()
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
if __name__ == "__main__":
|
|
65
|
+
main()
|
|
66
|
+
|
|
67
|
+
```
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "vnpy_okx"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
description = "OKX 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", "okx", "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_okx/__init__.py"
|
|
40
|
+
pattern = "__version__ = ['\"](?P<version>[^'\"]+)['\"]"
|
|
41
|
+
|
|
42
|
+
[tool.hatch.build.targets.wheel]
|
|
43
|
+
packages = ["vnpy_okx"]
|
|
44
|
+
include-package-data = true
|
|
45
|
+
|
|
46
|
+
[tool.hatch.build.targets.sdist]
|
|
47
|
+
include = ["vnpy_okx*"]
|
|
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,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 .okx_gateway import OkxGateway
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
__version__ = "2025.06.17"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
__all__ = ["OkxGateway"]
|