vnpy_okx 2026.1.11__tar.gz → 2026.2.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.
- {vnpy_okx-2026.1.11 → vnpy_okx-2026.2.1}/PKG-INFO +2 -2
- {vnpy_okx-2026.1.11 → vnpy_okx-2026.2.1}/README.md +1 -1
- {vnpy_okx-2026.1.11 → vnpy_okx-2026.2.1}/vnpy_okx/__init__.py +1 -1
- {vnpy_okx-2026.1.11 → vnpy_okx-2026.2.1}/vnpy_okx/okx_gateway.py +16 -3
- {vnpy_okx-2026.1.11 → vnpy_okx-2026.2.1}/.gitignore +0 -0
- {vnpy_okx-2026.1.11 → vnpy_okx-2026.2.1}/LICENSE +0 -0
- {vnpy_okx-2026.1.11 → vnpy_okx-2026.2.1}/pyproject.toml +0 -0
- {vnpy_okx-2026.1.11 → vnpy_okx-2026.2.1}/vnpy_okx/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vnpy_okx
|
|
3
|
-
Version: 2026.1
|
|
3
|
+
Version: 2026.2.1
|
|
4
4
|
Summary: OKX trading gateway for VeighNa.
|
|
5
5
|
Project-URL: Homepage, https://www.github.com/veighna-global
|
|
6
6
|
Project-URL: Source, https://www.github.com/veighna-global
|
|
@@ -33,7 +33,7 @@ Description-Content-Type: text/markdown
|
|
|
33
33
|
</p>
|
|
34
34
|
|
|
35
35
|
<p align="center">
|
|
36
|
-
<img src ="https://img.shields.io/badge/version-
|
|
36
|
+
<img src ="https://img.shields.io/badge/version-uv-blueviolet.svg"/>
|
|
37
37
|
<img src ="https://img.shields.io/badge/platform-windows|linux|macos-yellow.svg"/>
|
|
38
38
|
<img src ="https://img.shields.io/badge/python-3.10|3.11|3.12|3.13-blue.svg" />
|
|
39
39
|
<img src ="https://img.shields.io/github/license/veighna-global/vnpy_okx.svg?color=orange"/>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
<img src ="https://img.shields.io/badge/version-
|
|
8
|
+
<img src ="https://img.shields.io/badge/version-uv-blueviolet.svg"/>
|
|
9
9
|
<img src ="https://img.shields.io/badge/platform-windows|linux|macos-yellow.svg"/>
|
|
10
10
|
<img src ="https://img.shields.io/badge/python-3.10|3.11|3.12|3.13-blue.svg" />
|
|
11
11
|
<img src ="https://img.shields.io/github/license/veighna-global/vnpy_okx.svg?color=orange"/>
|
|
@@ -513,6 +513,13 @@ class RestApi(RestClient):
|
|
|
513
513
|
Returns:
|
|
514
514
|
Request: Modified request with authentication parameters
|
|
515
515
|
"""
|
|
516
|
+
# Add simulated trading header for demo server (applies to all requests)
|
|
517
|
+
if self.simulated:
|
|
518
|
+
if not request.headers:
|
|
519
|
+
request.headers = {"x-simulated-trading": "1"}
|
|
520
|
+
else:
|
|
521
|
+
request.headers["x-simulated-trading"] = "1"
|
|
522
|
+
|
|
516
523
|
# Public API does not need to sign
|
|
517
524
|
if "public" in request.path:
|
|
518
525
|
return request
|
|
@@ -740,7 +747,11 @@ class RestApi(RestClient):
|
|
|
740
747
|
base, quote, _ = name.split("-")
|
|
741
748
|
symbol = base + quote + "_SWAP_OKX"
|
|
742
749
|
case Product.FUTURES:
|
|
743
|
-
|
|
750
|
+
symbol_parts: list[str] = name.split("-")
|
|
751
|
+
if len(symbol_parts) < 3:
|
|
752
|
+
continue
|
|
753
|
+
|
|
754
|
+
base, quote, expiry = symbol_parts
|
|
744
755
|
symbol = base + quote + "_" + expiry + "_OKX"
|
|
745
756
|
|
|
746
757
|
if d["tickSz"]:
|
|
@@ -859,6 +870,8 @@ class RestApi(RestClient):
|
|
|
859
870
|
request: Original request object
|
|
860
871
|
"""
|
|
861
872
|
detail: str = self.exception_detail(exc, value, tb, request)
|
|
873
|
+
# Escape curly braces to prevent loguru from interpreting them as format placeholders
|
|
874
|
+
detail = detail.replace("{", "{{").replace("}", "}}")
|
|
862
875
|
|
|
863
876
|
msg: str = f"Exception catched by REST API: {detail}"
|
|
864
877
|
self.gateway.write_log(msg)
|
|
@@ -1625,7 +1638,7 @@ class PrivateApi(WebsocketApi):
|
|
|
1625
1638
|
|
|
1626
1639
|
# Prepare order parameters for OKX API
|
|
1627
1640
|
arg: dict = {
|
|
1628
|
-
"
|
|
1641
|
+
"instIdCode": contract.extra["instIdCode"], # type: ignore
|
|
1629
1642
|
"clOrdId": orderid,
|
|
1630
1643
|
"side": DIRECTION_VT2OKX[req.direction],
|
|
1631
1644
|
"ordType": ORDERTYPE_VT2OKX[req.type],
|
|
@@ -1676,7 +1689,7 @@ class PrivateApi(WebsocketApi):
|
|
|
1676
1689
|
return
|
|
1677
1690
|
|
|
1678
1691
|
# Initialize cancel parameters
|
|
1679
|
-
arg: dict = {"
|
|
1692
|
+
arg: dict = {"instIdCode": contract.extra["instIdCode"]} # type: ignore
|
|
1680
1693
|
|
|
1681
1694
|
# Determine the type of order ID to use for cancellation
|
|
1682
1695
|
# OKX supports both client order ID and exchange order ID for cancellation
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|