ccxt 4.3.66__py2.py3-none-any.whl → 4.3.67__py2.py3-none-any.whl
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.
- ccxt/__init__.py +1 -1
- ccxt/abstract/bingx.py +7 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bingx.py +147 -19
- ccxt/async_support/bithumb.py +60 -17
- ccxt/async_support/whitebit.py +1 -1
- ccxt/async_support/zonda.py +1 -1
- ccxt/base/exchange.py +10 -10
- ccxt/bingx.py +147 -19
- ccxt/bithumb.py +59 -17
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitget.py +1 -1
- ccxt/pro/bybit.py +1 -1
- ccxt/pro/coinone.py +1 -1
- ccxt/pro/currencycom.py +1 -1
- ccxt/pro/hollaex.py +1 -1
- ccxt/pro/hyperliquid.py +1 -1
- ccxt/pro/kucoin.py +1 -1
- ccxt/pro/kucoinfutures.py +1 -1
- ccxt/pro/mexc.py +1 -1
- ccxt/pro/okcoin.py +1 -1
- ccxt/pro/okx.py +16 -4
- ccxt/pro/oxfun.py +1 -1
- ccxt/pro/p2b.py +1 -1
- ccxt/pro/poloniex.py +1 -1
- ccxt/pro/whitebit.py +1 -1
- ccxt/test/tests_async.py +58 -28
- ccxt/test/tests_helpers.py +8 -1
- ccxt/test/tests_sync.py +58 -28
- ccxt/whitebit.py +1 -1
- ccxt/zonda.py +1 -1
- {ccxt-4.3.66.dist-info → ccxt-4.3.67.dist-info}/METADATA +4 -4
- {ccxt-4.3.66.dist-info → ccxt-4.3.67.dist-info}/RECORD +37 -37
- {ccxt-4.3.66.dist-info → ccxt-4.3.67.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.3.66.dist-info → ccxt-4.3.67.dist-info}/WHEEL +0 -0
- {ccxt-4.3.66.dist-info → ccxt-4.3.67.dist-info}/top_level.txt +0 -0
ccxt/bingx.py
CHANGED
@@ -297,6 +297,10 @@ class bingx(Exchange, ImplicitAPI):
|
|
297
297
|
'trade/leverage': 2,
|
298
298
|
'trade/forceOrders': 2,
|
299
299
|
'trade/allFillOrders': 2,
|
300
|
+
'trade/openOrders': 2,
|
301
|
+
'trade/orderDetail': 2,
|
302
|
+
'trade/orderHistory': 2,
|
303
|
+
'trade/marginType': 2,
|
300
304
|
'user/commissionRate': 2,
|
301
305
|
'user/positions': 2,
|
302
306
|
'user/balance': 2,
|
@@ -305,9 +309,12 @@ class bingx(Exchange, ImplicitAPI):
|
|
305
309
|
'trade/order': 2,
|
306
310
|
'trade/leverage': 2,
|
307
311
|
'trade/closeAllPositions': 2,
|
312
|
+
'trade/marginType': 2,
|
313
|
+
'trade/positionMargin': 2,
|
308
314
|
},
|
309
315
|
'delete': {
|
310
316
|
'trade/allOpenOrders': 2,
|
317
|
+
'trade/cancelOrder': 2,
|
311
318
|
},
|
312
319
|
},
|
313
320
|
},
|
@@ -2834,7 +2841,8 @@ class bingx(Exchange, ImplicitAPI):
|
|
2834
2841
|
# "clientOrderID": ""
|
2835
2842
|
# }
|
2836
2843
|
#
|
2837
|
-
# inverse swap cancelAllOrders
|
2844
|
+
# inverse swap cancelAllOrders, cancelOrder
|
2845
|
+
# inverse swap cancelAllOrders, cancelOrder, fetchOpenOrders
|
2838
2846
|
#
|
2839
2847
|
# {
|
2840
2848
|
# "symbol": "SOL-USD",
|
@@ -2978,13 +2986,14 @@ class bingx(Exchange, ImplicitAPI):
|
|
2978
2986
|
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
2979
2987
|
"""
|
2980
2988
|
cancels an open order
|
2981
|
-
:see: https://bingx-api.github.io/docs/#/spot/trade-api.html#Cancel%
|
2982
|
-
:see: https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Cancel%
|
2989
|
+
:see: https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20Order
|
2990
|
+
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Cancel%20Order
|
2991
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Cancel%20an%20Order
|
2983
2992
|
:param str id: order id
|
2984
2993
|
:param str symbol: unified symbol of the market the order was made in
|
2985
2994
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2986
2995
|
:param str [params.clientOrderId]: a unique id for the order
|
2987
|
-
:returns dict:
|
2996
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2988
2997
|
"""
|
2989
2998
|
if symbol is None:
|
2990
2999
|
raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
|
@@ -3000,11 +3009,17 @@ class bingx(Exchange, ImplicitAPI):
|
|
3000
3009
|
else:
|
3001
3010
|
request['orderId'] = id
|
3002
3011
|
response = None
|
3003
|
-
|
3004
|
-
|
3005
|
-
|
3012
|
+
type = None
|
3013
|
+
subType = None
|
3014
|
+
type, params = self.handle_market_type_and_params('cancelOrder', market, params)
|
3015
|
+
subType, params = self.handle_sub_type_and_params('cancelOrder', market, params)
|
3016
|
+
if type == 'spot':
|
3017
|
+
response = self.spotV1PrivatePostTradeCancel(self.extend(request, params))
|
3006
3018
|
else:
|
3007
|
-
|
3019
|
+
if subType == 'inverse':
|
3020
|
+
response = self.cswapV1PrivateDeleteTradeCancelOrder(self.extend(request, params))
|
3021
|
+
else:
|
3022
|
+
response = self.swapV2PrivateDeleteTradeOrder(self.extend(request, params))
|
3008
3023
|
#
|
3009
3024
|
# spot
|
3010
3025
|
#
|
@@ -3024,7 +3039,59 @@ class bingx(Exchange, ImplicitAPI):
|
|
3024
3039
|
# }
|
3025
3040
|
# }
|
3026
3041
|
#
|
3027
|
-
# swap
|
3042
|
+
# inverse swap
|
3043
|
+
#
|
3044
|
+
# {
|
3045
|
+
# "code": 0,
|
3046
|
+
# "msg": "",
|
3047
|
+
# "data": {
|
3048
|
+
# "order": {
|
3049
|
+
# "symbol": "SOL-USD",
|
3050
|
+
# "orderId": "1816002957423951872",
|
3051
|
+
# "side": "BUY",
|
3052
|
+
# "positionSide": "Long",
|
3053
|
+
# "type": "Pending",
|
3054
|
+
# "quantity": 0,
|
3055
|
+
# "origQty": "0",
|
3056
|
+
# "price": "150",
|
3057
|
+
# "executedQty": "0",
|
3058
|
+
# "avgPrice": "0",
|
3059
|
+
# "cumQuote": "0",
|
3060
|
+
# "stopPrice": "",
|
3061
|
+
# "profit": "0.0000",
|
3062
|
+
# "commission": "0.000000",
|
3063
|
+
# "status": "CANCELLED",
|
3064
|
+
# "time": 1721803819410,
|
3065
|
+
# "updateTime": 1721803819427,
|
3066
|
+
# "clientOrderId": "",
|
3067
|
+
# "leverage": "",
|
3068
|
+
# "takeProfit": {
|
3069
|
+
# "type": "",
|
3070
|
+
# "quantity": 0,
|
3071
|
+
# "stopPrice": 0,
|
3072
|
+
# "price": 0,
|
3073
|
+
# "workingType": "",
|
3074
|
+
# "stopGuaranteed": ""
|
3075
|
+
# },
|
3076
|
+
# "stopLoss": {
|
3077
|
+
# "type": "",
|
3078
|
+
# "quantity": 0,
|
3079
|
+
# "stopPrice": 0,
|
3080
|
+
# "price": 0,
|
3081
|
+
# "workingType": "",
|
3082
|
+
# "stopGuaranteed": ""
|
3083
|
+
# },
|
3084
|
+
# "advanceAttr": 0,
|
3085
|
+
# "positionID": 0,
|
3086
|
+
# "takeProfitEntrustPrice": 0,
|
3087
|
+
# "stopLossEntrustPrice": 0,
|
3088
|
+
# "orderType": "",
|
3089
|
+
# "workingType": ""
|
3090
|
+
# }
|
3091
|
+
# }
|
3092
|
+
# }
|
3093
|
+
#
|
3094
|
+
# linear swap
|
3028
3095
|
#
|
3029
3096
|
# {
|
3030
3097
|
# "code": 0,
|
@@ -3051,9 +3118,9 @@ class bingx(Exchange, ImplicitAPI):
|
|
3051
3118
|
# }
|
3052
3119
|
# }
|
3053
3120
|
#
|
3054
|
-
data = self.
|
3055
|
-
|
3056
|
-
return self.parse_order(
|
3121
|
+
data = self.safe_dict(response, 'data', {})
|
3122
|
+
order = self.safe_dict(data, 'order', data)
|
3123
|
+
return self.parse_order(order, market)
|
3057
3124
|
|
3058
3125
|
def cancel_all_orders(self, symbol: Str = None, params={}):
|
3059
3126
|
"""
|
@@ -3497,9 +3564,10 @@ class bingx(Exchange, ImplicitAPI):
|
|
3497
3564
|
|
3498
3565
|
def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
3499
3566
|
"""
|
3500
|
-
:see: https://bingx-api.github.io/docs/#/spot/trade-api.html#Query%20Open%20Orders
|
3501
|
-
:see: https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Query%20all%20current%20pending%20orders
|
3502
3567
|
fetch all unfilled currently open orders
|
3568
|
+
:see: https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Current%20Open%20Orders
|
3569
|
+
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Current%20All%20Open%20Orders
|
3570
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20all%20current%20pending%20orders
|
3503
3571
|
:param str symbol: unified market symbol
|
3504
3572
|
:param int [since]: the earliest time in ms to fetch open orders for
|
3505
3573
|
:param int [limit]: the maximum number of open order structures to retrieve
|
@@ -3512,12 +3580,18 @@ class bingx(Exchange, ImplicitAPI):
|
|
3512
3580
|
if symbol is not None:
|
3513
3581
|
market = self.market(symbol)
|
3514
3582
|
request['symbol'] = market['id']
|
3583
|
+
type = None
|
3584
|
+
subType = None
|
3515
3585
|
response = None
|
3516
|
-
|
3517
|
-
|
3518
|
-
|
3586
|
+
type, params = self.handle_market_type_and_params('fetchOpenOrders', market, params)
|
3587
|
+
subType, params = self.handle_sub_type_and_params('fetchOpenOrders', market, params)
|
3588
|
+
if type == 'spot':
|
3589
|
+
response = self.spotV1PrivateGetTradeOpenOrders(self.extend(request, params))
|
3519
3590
|
else:
|
3520
|
-
|
3591
|
+
if subType == 'inverse':
|
3592
|
+
response = self.cswapV1PrivateGetTradeOpenOrders(self.extend(request, params))
|
3593
|
+
else:
|
3594
|
+
response = self.swapV2PrivateGetTradeOpenOrders(self.extend(request, params))
|
3521
3595
|
#
|
3522
3596
|
# spot
|
3523
3597
|
#
|
@@ -3544,7 +3618,61 @@ class bingx(Exchange, ImplicitAPI):
|
|
3544
3618
|
# }
|
3545
3619
|
# }
|
3546
3620
|
#
|
3547
|
-
# swap
|
3621
|
+
# inverse swap
|
3622
|
+
#
|
3623
|
+
# {
|
3624
|
+
# "code": 0,
|
3625
|
+
# "msg": "",
|
3626
|
+
# "data": {
|
3627
|
+
# "orders": [
|
3628
|
+
# {
|
3629
|
+
# "symbol": "SOL-USD",
|
3630
|
+
# "orderId": "1816013900044320768",
|
3631
|
+
# "side": "BUY",
|
3632
|
+
# "positionSide": "Long",
|
3633
|
+
# "type": "LIMIT",
|
3634
|
+
# "quantity": 1,
|
3635
|
+
# "origQty": "",
|
3636
|
+
# "price": "150",
|
3637
|
+
# "executedQty": "0",
|
3638
|
+
# "avgPrice": "0.000",
|
3639
|
+
# "cumQuote": "",
|
3640
|
+
# "stopPrice": "",
|
3641
|
+
# "profit": "0.0000",
|
3642
|
+
# "commission": "0.0000",
|
3643
|
+
# "status": "Pending",
|
3644
|
+
# "time": 1721806428334,
|
3645
|
+
# "updateTime": 1721806428352,
|
3646
|
+
# "clientOrderId": "",
|
3647
|
+
# "leverage": "",
|
3648
|
+
# "takeProfit": {
|
3649
|
+
# "type": "TAKE_PROFIT",
|
3650
|
+
# "quantity": 0,
|
3651
|
+
# "stopPrice": 0,
|
3652
|
+
# "price": 0,
|
3653
|
+
# "workingType": "MARK_PRICE",
|
3654
|
+
# "stopGuaranteed": ""
|
3655
|
+
# },
|
3656
|
+
# "stopLoss": {
|
3657
|
+
# "type": "STOP",
|
3658
|
+
# "quantity": 0,
|
3659
|
+
# "stopPrice": 0,
|
3660
|
+
# "price": 0,
|
3661
|
+
# "workingType": "MARK_PRICE",
|
3662
|
+
# "stopGuaranteed": ""
|
3663
|
+
# },
|
3664
|
+
# "advanceAttr": 0,
|
3665
|
+
# "positionID": 0,
|
3666
|
+
# "takeProfitEntrustPrice": 0,
|
3667
|
+
# "stopLossEntrustPrice": 0,
|
3668
|
+
# "orderType": "",
|
3669
|
+
# "workingType": "MARK_PRICE"
|
3670
|
+
# }
|
3671
|
+
# ]
|
3672
|
+
# }
|
3673
|
+
# }
|
3674
|
+
#
|
3675
|
+
# linear swap
|
3548
3676
|
#
|
3549
3677
|
# {
|
3550
3678
|
# "code": 0,
|
ccxt/bithumb.py
CHANGED
@@ -212,17 +212,56 @@ class bithumb(Exchange, ImplicitAPI):
|
|
212
212
|
:returns dict[]: an array of objects representing market data
|
213
213
|
"""
|
214
214
|
result = []
|
215
|
-
quoteCurrencies = self.
|
215
|
+
quoteCurrencies = self.safe_dict(self.options, 'quoteCurrencies', {})
|
216
216
|
quotes = list(quoteCurrencies.keys())
|
217
|
+
promises = []
|
218
|
+
for i in range(0, len(quotes)):
|
219
|
+
request = {
|
220
|
+
'quoteId': quotes[i],
|
221
|
+
}
|
222
|
+
promises.append(self.publicGetTickerALLQuoteId(self.extend(request, params)))
|
223
|
+
#
|
224
|
+
# {
|
225
|
+
# "status": "0000",
|
226
|
+
# "data": {
|
227
|
+
# "ETH": {
|
228
|
+
# "opening_price": "0.05153399",
|
229
|
+
# "closing_price": "0.05145144",
|
230
|
+
# "min_price": "0.05145144",
|
231
|
+
# "max_price": "0.05160781",
|
232
|
+
# "units_traded": "6.541124172077830855",
|
233
|
+
# "acc_trade_value": "0.33705472498492329997697755",
|
234
|
+
# "prev_closing_price": "0.0515943",
|
235
|
+
# "units_traded_24H": "43.368879902677400513",
|
236
|
+
# "acc_trade_value_24H": "2.24165339555398079994373342",
|
237
|
+
# "fluctate_24H": "-0.00018203",
|
238
|
+
# "fluctate_rate_24H": "-0.35"
|
239
|
+
# },
|
240
|
+
# "XRP": {
|
241
|
+
# "opening_price": "0.00000918",
|
242
|
+
# "closing_price": "0.0000092",
|
243
|
+
# "min_price": "0.00000918",
|
244
|
+
# "max_price": "0.0000092",
|
245
|
+
# "units_traded": "6516.949363",
|
246
|
+
# "acc_trade_value": "0.0598792533602796",
|
247
|
+
# "prev_closing_price": "0.00000916",
|
248
|
+
# "units_traded_24H": "229161.50354738",
|
249
|
+
# "acc_trade_value_24H": "2.0446589371637117",
|
250
|
+
# "fluctate_24H": "0.00000049",
|
251
|
+
# "fluctate_rate_24H": "5.63"
|
252
|
+
# },
|
253
|
+
# ...
|
254
|
+
# "date": "1721675913145"
|
255
|
+
# }
|
256
|
+
# }
|
257
|
+
#
|
258
|
+
results = promises
|
217
259
|
for i in range(0, len(quotes)):
|
218
260
|
quote = quotes[i]
|
219
261
|
quoteId = quote
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
}
|
224
|
-
response = self.publicGetTickerALLQuoteId(self.extend(request, params))
|
225
|
-
data = self.safe_value(response, 'data')
|
262
|
+
response = results[i]
|
263
|
+
data = self.safe_dict(response, 'data')
|
264
|
+
extension = self.safe_dict(quoteCurrencies, quote, {})
|
226
265
|
currencyIds = list(data.keys())
|
227
266
|
for j in range(0, len(currencyIds)):
|
228
267
|
currencyId = currencyIds[j]
|
@@ -286,7 +325,7 @@ class bithumb(Exchange, ImplicitAPI):
|
|
286
325
|
|
287
326
|
def parse_balance(self, response) -> Balances:
|
288
327
|
result: dict = {'info': response}
|
289
|
-
balances = self.
|
328
|
+
balances = self.safe_dict(response, 'data')
|
290
329
|
codes = list(self.currencies.keys())
|
291
330
|
for i in range(0, len(codes)):
|
292
331
|
code = codes[i]
|
@@ -351,7 +390,7 @@ class bithumb(Exchange, ImplicitAPI):
|
|
351
390
|
# }
|
352
391
|
# }
|
353
392
|
#
|
354
|
-
data = self.
|
393
|
+
data = self.safe_dict(response, 'data', {})
|
355
394
|
timestamp = self.safe_integer(data, 'timestamp')
|
356
395
|
return self.parse_order_book(data, symbol, timestamp, 'bids', 'asks', 'price', 'quantity')
|
357
396
|
|
@@ -413,15 +452,18 @@ class bithumb(Exchange, ImplicitAPI):
|
|
413
452
|
"""
|
414
453
|
self.load_markets()
|
415
454
|
result: dict = {}
|
416
|
-
quoteCurrencies = self.
|
455
|
+
quoteCurrencies = self.safe_dict(self.options, 'quoteCurrencies', {})
|
417
456
|
quotes = list(quoteCurrencies.keys())
|
457
|
+
promises = []
|
418
458
|
for i in range(0, len(quotes)):
|
419
|
-
quote = quotes[i]
|
420
|
-
quoteId = quote
|
421
459
|
request: dict = {
|
422
|
-
'quoteId':
|
460
|
+
'quoteId': quotes[i],
|
423
461
|
}
|
424
|
-
|
462
|
+
promises.append(self.publicGetTickerALLQuoteId(self.extend(request, params)))
|
463
|
+
responses = promises
|
464
|
+
for i in range(0, len(quotes)):
|
465
|
+
quote = quotes[i]
|
466
|
+
response = responses[i]
|
425
467
|
#
|
426
468
|
# {
|
427
469
|
# "status":"0000",
|
@@ -443,7 +485,7 @@ class bithumb(Exchange, ImplicitAPI):
|
|
443
485
|
# }
|
444
486
|
# }
|
445
487
|
#
|
446
|
-
data = self.
|
488
|
+
data = self.safe_dict(response, 'data', {})
|
447
489
|
timestamp = self.safe_integer(data, 'date')
|
448
490
|
tickers = self.omit(data, 'date')
|
449
491
|
currencyIds = list(tickers.keys())
|
@@ -805,7 +847,7 @@ class bithumb(Exchange, ImplicitAPI):
|
|
805
847
|
# }
|
806
848
|
#
|
807
849
|
timestamp = self.safe_integer_product(order, 'order_date', 0.001)
|
808
|
-
sideProperty = self.
|
850
|
+
sideProperty = self.safe_string_2(order, 'type', 'side')
|
809
851
|
side = 'buy' if (sideProperty == 'bid') else 'sell'
|
810
852
|
status = self.parse_order_status(self.safe_string(order, 'order_status'))
|
811
853
|
price = self.safe_string_2(order, 'order_price', 'price')
|
@@ -830,7 +872,7 @@ class bithumb(Exchange, ImplicitAPI):
|
|
830
872
|
market = self.safe_market(None, market)
|
831
873
|
symbol = market['symbol']
|
832
874
|
id = self.safe_string(order, 'order_id')
|
833
|
-
rawTrades = self.
|
875
|
+
rawTrades = self.safe_list(order, 'contract', [])
|
834
876
|
return self.safe_order({
|
835
877
|
'info': order,
|
836
878
|
'id': id,
|
ccxt/pro/__init__.py
CHANGED
ccxt/pro/bitget.py
CHANGED
@@ -1678,7 +1678,7 @@ class bitget(ccxt.async_support.bitget):
|
|
1678
1678
|
if topic.find('books') >= 0:
|
1679
1679
|
self.handle_order_book(client, message)
|
1680
1680
|
|
1681
|
-
def ping(self, client):
|
1681
|
+
def ping(self, client: Client):
|
1682
1682
|
return 'ping'
|
1683
1683
|
|
1684
1684
|
def handle_pong(self, client: Client, message):
|
ccxt/pro/bybit.py
CHANGED
@@ -1962,7 +1962,7 @@ class bybit(ccxt.async_support.bybit):
|
|
1962
1962
|
if type == 'AUTH_RESP':
|
1963
1963
|
self.handle_authenticate(client, message)
|
1964
1964
|
|
1965
|
-
def ping(self, client):
|
1965
|
+
def ping(self, client: Client):
|
1966
1966
|
return {
|
1967
1967
|
'req_id': self.request_id(),
|
1968
1968
|
'op': 'ping',
|
ccxt/pro/coinone.py
CHANGED
ccxt/pro/currencycom.py
CHANGED
ccxt/pro/hollaex.py
CHANGED
@@ -546,7 +546,7 @@ class hollaex(ccxt.async_support.hollaex):
|
|
546
546
|
if method is not None:
|
547
547
|
method(client, message)
|
548
548
|
|
549
|
-
def ping(self, client):
|
549
|
+
def ping(self, client: Client):
|
550
550
|
# hollaex does not support built-in ws protocol-level ping-pong
|
551
551
|
return {'op': 'ping'}
|
552
552
|
|
ccxt/pro/hyperliquid.py
CHANGED
ccxt/pro/kucoin.py
CHANGED
@@ -1155,7 +1155,7 @@ class kucoin(ccxt.async_support.kucoin):
|
|
1155
1155
|
if method is not None:
|
1156
1156
|
method(client, message)
|
1157
1157
|
|
1158
|
-
def ping(self, client):
|
1158
|
+
def ping(self, client: Client):
|
1159
1159
|
# kucoin does not support built-in ws protocol-level ping-pong
|
1160
1160
|
# instead it requires a custom json-based text ping-pong
|
1161
1161
|
# https://docs.kucoin.com/#ping
|
ccxt/pro/kucoinfutures.py
CHANGED
@@ -1035,7 +1035,7 @@ class kucoinfutures(ccxt.async_support.kucoinfutures):
|
|
1035
1035
|
else:
|
1036
1036
|
return elementName + 's@all'
|
1037
1037
|
|
1038
|
-
def ping(self, client):
|
1038
|
+
def ping(self, client: Client):
|
1039
1039
|
# kucoin does not support built-in ws protocol-level ping-pong
|
1040
1040
|
# instead it requires a custom json-based text ping-pong
|
1041
1041
|
# https://docs.kucoin.com/#ping
|
ccxt/pro/mexc.py
CHANGED
ccxt/pro/okcoin.py
CHANGED
@@ -573,7 +573,7 @@ class okcoin(ccxt.async_support.okcoin):
|
|
573
573
|
client.resolve(message, 'authenticated')
|
574
574
|
return message
|
575
575
|
|
576
|
-
def ping(self, client):
|
576
|
+
def ping(self, client: Client):
|
577
577
|
# okex does not support built-in ws protocol-level ping-pong
|
578
578
|
# instead it requires custom text-based ping-pong
|
579
579
|
return 'ping'
|
ccxt/pro/okx.py
CHANGED
@@ -13,6 +13,7 @@ from ccxt.base.errors import ExchangeError
|
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
14
14
|
from ccxt.base.errors import ArgumentsRequired
|
15
15
|
from ccxt.base.errors import BadRequest
|
16
|
+
from ccxt.base.errors import InvalidNonce
|
16
17
|
from ccxt.base.errors import ChecksumError
|
17
18
|
|
18
19
|
|
@@ -836,7 +837,7 @@ class okx(ccxt.async_support.okx):
|
|
836
837
|
for i in range(0, len(deltas)):
|
837
838
|
self.handle_delta(bookside, deltas[i])
|
838
839
|
|
839
|
-
def handle_order_book_message(self, client: Client, message, orderbook, messageHash):
|
840
|
+
def handle_order_book_message(self, client: Client, message, orderbook, messageHash, market=None):
|
840
841
|
#
|
841
842
|
# {
|
842
843
|
# "asks": [
|
@@ -851,6 +852,9 @@ class okx(ccxt.async_support.okx):
|
|
851
852
|
# ],
|
852
853
|
# "instId": "BTC-USDT",
|
853
854
|
# "ts": "1626537446491"
|
855
|
+
# "checksum": -855196043,
|
856
|
+
# "prevSeqId": 123456,
|
857
|
+
# "seqId": 123457
|
854
858
|
# }
|
855
859
|
#
|
856
860
|
asks = self.safe_value(message, 'asks', [])
|
@@ -860,9 +864,12 @@ class okx(ccxt.async_support.okx):
|
|
860
864
|
self.handle_deltas(storedAsks, asks)
|
861
865
|
self.handle_deltas(storedBids, bids)
|
862
866
|
marketId = self.safe_string(message, 'instId')
|
863
|
-
symbol = self.safe_symbol(marketId)
|
867
|
+
symbol = self.safe_symbol(marketId, market)
|
864
868
|
checksum = self.handle_option('watchOrderBook', 'checksum', True)
|
869
|
+
seqId = self.safe_integer(message, 'seqId')
|
865
870
|
if checksum:
|
871
|
+
prevSeqId = self.safe_integer(message, 'prevSeqId')
|
872
|
+
nonce = orderbook['nonce']
|
866
873
|
asksLength = len(storedAsks)
|
867
874
|
bidsLength = len(storedBids)
|
868
875
|
payloadArray = []
|
@@ -876,12 +883,17 @@ class okx(ccxt.async_support.okx):
|
|
876
883
|
payload = ':'.join(payloadArray)
|
877
884
|
responseChecksum = self.safe_integer(message, 'checksum')
|
878
885
|
localChecksum = self.crc32(payload, True)
|
886
|
+
error = None
|
887
|
+
if prevSeqId != -1 and nonce != prevSeqId:
|
888
|
+
error = InvalidNonce(self.id + ' watchOrderBook received invalid nonce')
|
879
889
|
if responseChecksum != localChecksum:
|
880
890
|
error = ChecksumError(self.id + ' ' + self.orderbook_checksum_message(symbol))
|
891
|
+
if error is not None:
|
881
892
|
del client.subscriptions[messageHash]
|
882
893
|
del self.orderbooks[symbol]
|
883
894
|
client.reject(error, messageHash)
|
884
895
|
timestamp = self.safe_integer(message, 'ts')
|
896
|
+
orderbook['nonce'] = seqId
|
885
897
|
orderbook['timestamp'] = timestamp
|
886
898
|
orderbook['datetime'] = self.iso8601(timestamp)
|
887
899
|
return orderbook
|
@@ -1001,7 +1013,7 @@ class okx(ccxt.async_support.okx):
|
|
1001
1013
|
orderbook = self.orderbooks[symbol]
|
1002
1014
|
for i in range(0, len(data)):
|
1003
1015
|
update = data[i]
|
1004
|
-
self.handle_order_book_message(client, update, orderbook, messageHash)
|
1016
|
+
self.handle_order_book_message(client, update, orderbook, messageHash, market)
|
1005
1017
|
client.resolve(orderbook, messageHash)
|
1006
1018
|
elif (channel == 'books5') or (channel == 'bbo-tbt'):
|
1007
1019
|
if not (symbol in self.orderbooks):
|
@@ -1728,7 +1740,7 @@ class okx(ccxt.async_support.okx):
|
|
1728
1740
|
future = self.safe_value(client.futures, 'authenticated')
|
1729
1741
|
future.resolve(True)
|
1730
1742
|
|
1731
|
-
def ping(self, client):
|
1743
|
+
def ping(self, client: Client):
|
1732
1744
|
# OKX does not support the built-in WebSocket protocol-level ping-pong.
|
1733
1745
|
# Instead, it requires a custom text-based ping-pong mechanism.
|
1734
1746
|
return 'ping'
|
ccxt/pro/oxfun.py
CHANGED
@@ -914,7 +914,7 @@ class oxfun(ccxt.async_support.oxfun):
|
|
914
914
|
if messageHash in client.subscriptions:
|
915
915
|
del client.subscriptions[messageHash]
|
916
916
|
|
917
|
-
def ping(self, client):
|
917
|
+
def ping(self, client: Client):
|
918
918
|
return 'ping'
|
919
919
|
|
920
920
|
def handle_pong(self, client: Client, message):
|
ccxt/pro/p2b.py
CHANGED
@@ -388,7 +388,7 @@ class p2b(ccxt.async_support.p2b):
|
|
388
388
|
raise ExchangeError(self.id + ' error: ' + self.json(error))
|
389
389
|
return False
|
390
390
|
|
391
|
-
def ping(self, client):
|
391
|
+
def ping(self, client: Client):
|
392
392
|
"""
|
393
393
|
:see: https://github.com/P2B-team/P2B-WSS-Public/blob/main/wss_documentation.md#ping
|
394
394
|
* @param client
|
ccxt/pro/poloniex.py
CHANGED