vnpy_okx 2025.11.4__tar.gz → 2025.11.8__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vnpy_okx
3
- Version: 2025.11.4
3
+ Version: 2025.11.8
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.11.04-blueviolet.svg"/>
36
+ <img src ="https://img.shields.io/badge/version-2025.11.08-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.11.04-blueviolet.svg"/>
8
+ <img src ="https://img.shields.io/badge/version-2025.11.08-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"/>
@@ -23,7 +23,7 @@
23
23
  from .okx_gateway import OkxGateway
24
24
 
25
25
 
26
- __version__ = "2025.11.04"
26
+ __version__ = "2025.11.08"
27
27
 
28
28
 
29
29
  __all__ = ["OkxGateway"]
@@ -8,6 +8,7 @@ from datetime import datetime
8
8
  from urllib.parse import urlencode
9
9
  from types import TracebackType
10
10
  from collections.abc import Callable
11
+ from time import sleep
11
12
 
12
13
  from vnpy.event import EventEngine, Event, EVENT_TIMER
13
14
  from vnpy.trader.constant import (
@@ -47,12 +48,6 @@ REAL_PUBLIC_HOST: str = "wss://ws.okx.com:8443/ws/v5/public"
47
48
  REAL_PRIVATE_HOST: str = "wss://ws.okx.com:8443/ws/v5/private"
48
49
  REAL_BUSINESS_HOST: str = "wss://ws.okx.com:8443/ws/v5/business"
49
50
 
50
- # AWS server hosts
51
- AWS_REST_HOST: str = "https://aws.okx.com"
52
- AWS_PUBLIC_HOST: str = "wss://wsaws.okx.com:8443/ws/v5/public"
53
- AWS_PRIVATE_HOST: str = "wss://wsaws.okx.com:8443/ws/v5/private"
54
- AWS_BUSINESS_HOST: str = "wss://wsaws.okx.com:8443/ws/v5/business"
55
-
56
51
  # Demo server hosts
57
52
  DEMO_REST_HOST: str = "https://www.okx.com"
58
53
  DEMO_PUBLIC_HOST: str = "wss://wspap.okx.com:8443/ws/v5/public"
@@ -113,7 +108,7 @@ class OkxGateway(BaseGateway):
113
108
  "API Key": "",
114
109
  "Secret Key": "",
115
110
  "Passphrase": "",
116
- "Server": ["REAL", "AWS", "DEMO"],
111
+ "Server": ["REAL", "DEMO"],
117
112
  "Proxy Host": "",
118
113
  "Proxy Port": 0,
119
114
  "Spread Trading": ["False", "True"],
@@ -566,7 +561,7 @@ class RestApi(RestClient):
566
561
  key: API Key for authentication
567
562
  secret: API Secret for request signing
568
563
  passphrase: API Passphrase for authentication
569
- server: Server type ("REAL", "AWS", or "DEMO")
564
+ server: Server type ("REAL" or "DEMO")
570
565
  proxy_host: Proxy server hostname or IP
571
566
  proxy_port: Proxy server port
572
567
  spread_trading: Whether to enable spread trading
@@ -582,7 +577,6 @@ class RestApi(RestClient):
582
577
 
583
578
  server_hosts: dict[str, str] = {
584
579
  "REAL": REAL_REST_HOST,
585
- "AWS": AWS_REST_HOST,
586
580
  "DEMO": DEMO_REST_HOST,
587
581
  }
588
582
 
@@ -889,6 +883,9 @@ class RestApi(RestClient):
889
883
 
890
884
  # Loop until no more data or request fails
891
885
  while True:
886
+ # Add small delay to avoid rate limit
887
+ sleep(0.1)
888
+
892
889
  # Create query params
893
890
  params: dict = {
894
891
  id_key: contract.name,
@@ -1098,7 +1095,10 @@ class WebsocketApi(WebsocketClient):
1098
1095
  def send_ping(self) -> None:
1099
1096
  """Send heartbeat ping to server"""
1100
1097
  if self.connected:
1101
- self.wsapp.send("ping")
1098
+ try:
1099
+ self.wsapp.send("ping")
1100
+ except Exception:
1101
+ pass
1102
1102
 
1103
1103
 
1104
1104
  class PublicApi(WebsocketApi):
@@ -1124,7 +1124,6 @@ class PublicApi(WebsocketApi):
1124
1124
 
1125
1125
  self.server_hosts: dict[str, str] = {
1126
1126
  "REAL": REAL_PUBLIC_HOST,
1127
- "AWS": AWS_PUBLIC_HOST,
1128
1127
  "DEMO": DEMO_PUBLIC_HOST,
1129
1128
  }
1130
1129
 
@@ -1284,7 +1283,6 @@ class PrivateApi(WebsocketApi):
1284
1283
 
1285
1284
  self.server_hosts: dict[str, str] = {
1286
1285
  "REAL": REAL_PRIVATE_HOST,
1287
- "AWS": AWS_PRIVATE_HOST,
1288
1286
  "DEMO": DEMO_PRIVATE_HOST,
1289
1287
  }
1290
1288
 
@@ -1308,7 +1306,7 @@ class PrivateApi(WebsocketApi):
1308
1306
  key: API Key for authentication
1309
1307
  secret: API Secret for request signing
1310
1308
  passphrase: API Passphrase for authentication
1311
- server: Server type ("REAL", "AWS", or "DEMO")
1309
+ server: Server type ("REAL" or "DEMO")
1312
1310
  proxy_host: Proxy server hostname or IP
1313
1311
  proxy_port: Proxy server port
1314
1312
  """
@@ -1710,7 +1708,6 @@ class BusinessApi(WebsocketApi):
1710
1708
 
1711
1709
  self.server_hosts: dict[str, str] = {
1712
1710
  "REAL": REAL_BUSINESS_HOST,
1713
- "AWS": AWS_BUSINESS_HOST,
1714
1711
  "DEMO": DEMO_BUSINESS_HOST,
1715
1712
  }
1716
1713
 
@@ -1734,7 +1731,7 @@ class BusinessApi(WebsocketApi):
1734
1731
  key: API Key for authentication
1735
1732
  secret: API Secret for request signing
1736
1733
  passphrase: API Passphrase for authentication
1737
- server: Server type ("REAL", "AWS", or "DEMO")
1734
+ server: Server type ("REAL" or "DEMO")
1738
1735
  proxy_host: Proxy server hostname or IP
1739
1736
  proxy_port: Proxy server port
1740
1737
  """
File without changes
File without changes