vnpy_okx 2025.11.8__tar.gz → 2025.12.4__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.8
3
+ Version: 2025.12.4
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.08-blueviolet.svg"/>
36
+ <img src ="https://img.shields.io/badge/version-2025.12.04-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.08-blueviolet.svg"/>
8
+ <img src ="https://img.shields.io/badge/version-2025.12.04-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.08"
26
+ __version__ = "2025.12.04"
27
27
 
28
28
 
29
29
  __all__ = ["OkxGateway"]
@@ -112,6 +112,7 @@ class OkxGateway(BaseGateway):
112
112
  "Proxy Host": "",
113
113
  "Proxy Port": 0,
114
114
  "Spread Trading": ["False", "True"],
115
+ "Margin Currency": ""
115
116
  }
116
117
 
117
118
  exchanges: Exchange = [Exchange.GLOBAL]
@@ -132,6 +133,7 @@ class OkxGateway(BaseGateway):
132
133
  self.proxy_host: str = ""
133
134
  self.proxy_port: int = 0
134
135
  self.spread_trading: bool = False
136
+ self.margin_currency: str = ""
135
137
 
136
138
  self.orders: dict[str, OrderData] = {}
137
139
  self.local_orderids: set[str] = set()
@@ -167,6 +169,7 @@ class OkxGateway(BaseGateway):
167
169
  self.proxy_host = setting["Proxy Host"]
168
170
  self.proxy_port = setting["Proxy Port"]
169
171
  self.spread_trading = setting["Spread Trading"] == "True"
172
+ self.margin_currency = setting["Margin Currency"]
170
173
 
171
174
  self.rest_api.connect(
172
175
  self.key,
@@ -194,6 +197,7 @@ class OkxGateway(BaseGateway):
194
197
  self.server,
195
198
  self.proxy_host,
196
199
  self.proxy_port,
200
+ self.margin_currency,
197
201
  )
198
202
 
199
203
  if self.spread_trading:
@@ -1266,6 +1270,7 @@ class PrivateApi(WebsocketApi):
1266
1270
  self.key: str = ""
1267
1271
  self.secret: bytes = b""
1268
1272
  self.passphrase: str = ""
1273
+ self.margin_currency: str = ""
1269
1274
 
1270
1275
  self.reqid: int = 0
1271
1276
  self.order_count: int = 0
@@ -1296,6 +1301,7 @@ class PrivateApi(WebsocketApi):
1296
1301
  server: str,
1297
1302
  proxy_host: str,
1298
1303
  proxy_port: int,
1304
+ margin_currency: str,
1299
1305
  ) -> None:
1300
1306
  """
1301
1307
  Start server connection.
@@ -1309,10 +1315,12 @@ class PrivateApi(WebsocketApi):
1309
1315
  server: Server type ("REAL" or "DEMO")
1310
1316
  proxy_host: Proxy server hostname or IP
1311
1317
  proxy_port: Proxy server port
1318
+ margin_currency: Margin currency
1312
1319
  """
1313
1320
  self.key = key
1314
1321
  self.secret = secret.encode()
1315
1322
  self.passphrase = passphrase
1323
+ self.margin_currency = margin_currency
1316
1324
 
1317
1325
  self.connect_time = int(datetime.now().strftime("%y%m%d%H%M%S"))
1318
1326
 
@@ -1615,6 +1623,9 @@ class PrivateApi(WebsocketApi):
1615
1623
  "tdMode": "cross" # Only support cross margin mode
1616
1624
  }
1617
1625
 
1626
+ if self.margin_currency:
1627
+ arg["ccy"] = self.margin_currency
1628
+
1618
1629
  # Create websocket request with unique request ID
1619
1630
  self.reqid += 1
1620
1631
  packet: dict = {
File without changes
File without changes
File without changes