vnpy_okx 2025.12.4__tar.gz → 2025.12.28__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.12.4 → vnpy_okx-2025.12.28}/PKG-INFO +2 -2
- {vnpy_okx-2025.12.4 → vnpy_okx-2025.12.28}/README.md +1 -1
- {vnpy_okx-2025.12.4 → vnpy_okx-2025.12.28}/vnpy_okx/__init__.py +1 -1
- {vnpy_okx-2025.12.4 → vnpy_okx-2025.12.28}/vnpy_okx/okx_gateway.py +12 -9
- {vnpy_okx-2025.12.4 → vnpy_okx-2025.12.28}/.gitignore +0 -0
- {vnpy_okx-2025.12.4 → vnpy_okx-2025.12.28}/LICENSE +0 -0
- {vnpy_okx-2025.12.4 → vnpy_okx-2025.12.28}/pyproject.toml +0 -0
- {vnpy_okx-2025.12.4 → vnpy_okx-2025.12.28}/vnpy_okx/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vnpy_okx
|
|
3
|
-
Version: 2025.12.
|
|
3
|
+
Version: 2025.12.28
|
|
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-2025.12.
|
|
36
|
+
<img src ="https://img.shields.io/badge/version-2025.12.28-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-2025.12.
|
|
8
|
+
<img src ="https://img.shields.io/badge/version-2025.12.28-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"/>
|
|
@@ -9,6 +9,7 @@ from urllib.parse import urlencode
|
|
|
9
9
|
from types import TracebackType
|
|
10
10
|
from collections.abc import Callable
|
|
11
11
|
from time import sleep
|
|
12
|
+
from decimal import Decimal
|
|
12
13
|
|
|
13
14
|
from vnpy.event import EventEngine, Event, EVENT_TIMER
|
|
14
15
|
from vnpy.trader.constant import (
|
|
@@ -1433,8 +1434,8 @@ class PrivateApi(WebsocketApi):
|
|
|
1433
1434
|
balance=float(detail["eq"]),
|
|
1434
1435
|
gateway_name=self.gateway_name,
|
|
1435
1436
|
)
|
|
1436
|
-
account.available = float(detail["
|
|
1437
|
-
account.frozen =
|
|
1437
|
+
account.available = float(detail["availBal"])
|
|
1438
|
+
account.frozen = float(Decimal(detail["eq"]) - Decimal(detail["availBal"]))
|
|
1438
1439
|
self.gateway.on_account(account)
|
|
1439
1440
|
|
|
1440
1441
|
def on_position(self, packet: dict) -> None:
|
|
@@ -1515,10 +1516,11 @@ class PrivateApi(WebsocketApi):
|
|
|
1515
1516
|
"""
|
|
1516
1517
|
# Wrong parameters
|
|
1517
1518
|
if packet["code"] != "0":
|
|
1518
|
-
code: str = packet["code"]
|
|
1519
1519
|
msg: str = packet["msg"]
|
|
1520
|
-
|
|
1521
|
-
|
|
1520
|
+
if msg:
|
|
1521
|
+
code: str = packet["code"]
|
|
1522
|
+
self.gateway.write_log(f"Cancel order failed, status code: {code}, message: {msg}")
|
|
1523
|
+
return
|
|
1522
1524
|
|
|
1523
1525
|
# Failed to process
|
|
1524
1526
|
data: list = packet["data"]
|
|
@@ -1659,7 +1661,7 @@ class PrivateApi(WebsocketApi):
|
|
|
1659
1661
|
return
|
|
1660
1662
|
|
|
1661
1663
|
# Initialize cancel parameters
|
|
1662
|
-
arg: dict = {}
|
|
1664
|
+
arg: dict = {"instId": contract.name}
|
|
1663
1665
|
|
|
1664
1666
|
# Determine the type of order ID to use for cancellation
|
|
1665
1667
|
# OKX supports both client order ID and exchange order ID for cancellation
|
|
@@ -1953,10 +1955,11 @@ class BusinessApi(WebsocketApi):
|
|
|
1953
1955
|
"""
|
|
1954
1956
|
# Wrong parameters
|
|
1955
1957
|
if packet["code"] != "0":
|
|
1956
|
-
code: str = packet["code"]
|
|
1957
1958
|
msg: str = packet["msg"]
|
|
1958
|
-
|
|
1959
|
-
|
|
1959
|
+
if msg:
|
|
1960
|
+
code: str = packet["code"]
|
|
1961
|
+
self.gateway.write_log(f"Cancel order failed, status code: {code}, message: {msg}")
|
|
1962
|
+
return
|
|
1960
1963
|
|
|
1961
1964
|
# Failed to process
|
|
1962
1965
|
data: list = packet["data"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|