ccxt 4.3.65__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/base/ws/fast_client.py +2 -1
- ccxt/async_support/base/ws/future.py +13 -2
- ccxt/async_support/bingx.py +147 -19
- ccxt/async_support/bithumb.py +60 -17
- ccxt/async_support/hyperliquid.py +60 -7
- ccxt/async_support/kraken.py +25 -0
- 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/hyperliquid.py +60 -7
- ccxt/kraken.py +25 -0
- 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 +103 -3
- 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 +21 -9
- 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.65.dist-info → ccxt-4.3.67.dist-info}/METADATA +5 -4
- {ccxt-4.3.65.dist-info → ccxt-4.3.67.dist-info}/RECORD +43 -43
- {ccxt-4.3.65.dist-info → ccxt-4.3.67.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.3.65.dist-info → ccxt-4.3.67.dist-info}/WHEEL +0 -0
- {ccxt-4.3.65.dist-info → ccxt-4.3.67.dist-info}/top_level.txt +0 -0
ccxt/base/exchange.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
__version__ = '4.3.
|
7
|
+
__version__ = '4.3.67'
|
8
8
|
|
9
9
|
# -----------------------------------------------------------------------------
|
10
10
|
|
@@ -2225,7 +2225,7 @@ class Exchange(object):
|
|
2225
2225
|
def parse_transfer(self, transfer: dict, currency: Currency = None):
|
2226
2226
|
raise NotSupported(self.id + ' parseTransfer() is not supported yet')
|
2227
2227
|
|
2228
|
-
def parse_account(self, account):
|
2228
|
+
def parse_account(self, account: dict):
|
2229
2229
|
raise NotSupported(self.id + ' parseAccount() is not supported yet')
|
2230
2230
|
|
2231
2231
|
def parse_ledger_entry(self, item: dict, currency: Currency = None):
|
@@ -2462,7 +2462,7 @@ class Exchange(object):
|
|
2462
2462
|
},
|
2463
2463
|
}, currency)
|
2464
2464
|
|
2465
|
-
def safe_market_structure(self, market=None):
|
2465
|
+
def safe_market_structure(self, market: dict = None):
|
2466
2466
|
cleanStructure = {
|
2467
2467
|
'id': None,
|
2468
2468
|
'lowercaseId': None,
|
@@ -2622,7 +2622,7 @@ class Exchange(object):
|
|
2622
2622
|
superWithRestDescribe = self.deep_extend(extendedRestDescribe, wsBaseDescribe)
|
2623
2623
|
return superWithRestDescribe
|
2624
2624
|
|
2625
|
-
def safe_balance(self, balance:
|
2625
|
+
def safe_balance(self, balance: dict):
|
2626
2626
|
balances = self.omit(balance, ['info', 'timestamp', 'datetime', 'free', 'used', 'total'])
|
2627
2627
|
codes = list(balances.keys())
|
2628
2628
|
balance['free'] = {}
|
@@ -2656,7 +2656,7 @@ class Exchange(object):
|
|
2656
2656
|
balance['debt'] = debtBalance
|
2657
2657
|
return balance
|
2658
2658
|
|
2659
|
-
def safe_order(self, order:
|
2659
|
+
def safe_order(self, order: dict, market: Market = None):
|
2660
2660
|
# parses numbers
|
2661
2661
|
# * it is important pass the trades rawTrades
|
2662
2662
|
amount = self.omit_zero(self.safe_string(order, 'amount'))
|
@@ -2961,7 +2961,7 @@ class Exchange(object):
|
|
2961
2961
|
'cost': self.parse_number(cost),
|
2962
2962
|
}
|
2963
2963
|
|
2964
|
-
def safe_liquidation(self, liquidation:
|
2964
|
+
def safe_liquidation(self, liquidation: dict, market: Market = None):
|
2965
2965
|
contracts = self.safe_string(liquidation, 'contracts')
|
2966
2966
|
contractSize = self.safe_string(market, 'contractSize')
|
2967
2967
|
price = self.safe_string(liquidation, 'price')
|
@@ -2978,7 +2978,7 @@ class Exchange(object):
|
|
2978
2978
|
liquidation['quoteValue'] = self.parse_number(quoteValue)
|
2979
2979
|
return liquidation
|
2980
2980
|
|
2981
|
-
def safe_trade(self, trade:
|
2981
|
+
def safe_trade(self, trade: dict, market: Market = None):
|
2982
2982
|
amount = self.safe_string(trade, 'amount')
|
2983
2983
|
price = self.safe_string(trade, 'price')
|
2984
2984
|
cost = self.safe_string(trade, 'cost')
|
@@ -3120,7 +3120,7 @@ class Exchange(object):
|
|
3120
3120
|
result = self.array_concat(result, reducedFeeValues)
|
3121
3121
|
return result
|
3122
3122
|
|
3123
|
-
def safe_ticker(self, ticker:
|
3123
|
+
def safe_ticker(self, ticker: dict, market: Market = None):
|
3124
3124
|
open = self.omit_zero(self.safe_string(ticker, 'open'))
|
3125
3125
|
close = self.omit_zero(self.safe_string(ticker, 'close'))
|
3126
3126
|
last = self.omit_zero(self.safe_string(ticker, 'last'))
|
@@ -3553,7 +3553,7 @@ class Exchange(object):
|
|
3553
3553
|
self.options['limitsLoaded'] = self.milliseconds()
|
3554
3554
|
return self.markets
|
3555
3555
|
|
3556
|
-
def safe_position(self, position):
|
3556
|
+
def safe_position(self, position: dict):
|
3557
3557
|
# simplified version of: /pull/12765/
|
3558
3558
|
unrealizedPnlString = self.safe_string(position, 'unrealisedPnl')
|
3559
3559
|
initialMarginString = self.safe_string(position, 'initialMargin')
|
@@ -5721,7 +5721,7 @@ class Exchange(object):
|
|
5721
5721
|
params = self.omit(params, ['until', 'till'])
|
5722
5722
|
return [request, params]
|
5723
5723
|
|
5724
|
-
def safe_open_interest(self, interest, market: Market = None):
|
5724
|
+
def safe_open_interest(self, interest: dict, market: Market = None):
|
5725
5725
|
symbol = self.safe_string(interest, 'symbol')
|
5726
5726
|
if symbol is None:
|
5727
5727
|
symbol = self.safe_string(market, 'symbol')
|
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/hyperliquid.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.hyperliquid import ImplicitAPI
|
8
|
-
from ccxt.base.types import Balances, Currencies, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Trade, TradingFeeInterface, Transaction, TransferEntry
|
8
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
|
9
9
|
from typing import List
|
10
10
|
from ccxt.base.errors import ExchangeError
|
11
11
|
from ccxt.base.errors import ArgumentsRequired
|
@@ -101,8 +101,8 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
101
101
|
'fetchPositions': True,
|
102
102
|
'fetchPositionsRisk': False,
|
103
103
|
'fetchPremiumIndexOHLCV': False,
|
104
|
-
'fetchTicker':
|
105
|
-
'fetchTickers':
|
104
|
+
'fetchTicker': 'emulated',
|
105
|
+
'fetchTickers': True,
|
106
106
|
'fetchTime': False,
|
107
107
|
'fetchTrades': True,
|
108
108
|
'fetchTradingFee': True,
|
@@ -327,12 +327,12 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
327
327
|
#
|
328
328
|
#
|
329
329
|
meta = self.safe_dict(response, 0, {})
|
330
|
-
|
330
|
+
universe = self.safe_list(meta, 'universe', [])
|
331
331
|
assetCtxs = self.safe_dict(response, 1, {})
|
332
332
|
result = []
|
333
|
-
for i in range(0, len(
|
333
|
+
for i in range(0, len(universe)):
|
334
334
|
data = self.extend(
|
335
|
-
self.safe_dict(
|
335
|
+
self.safe_dict(universe, i, {}),
|
336
336
|
self.safe_dict(assetCtxs, i, {})
|
337
337
|
)
|
338
338
|
data['baseId'] = i
|
@@ -446,11 +446,13 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
446
446
|
#
|
447
447
|
# response differs depending on the environment(mainnet vs sandbox)
|
448
448
|
first = self.safe_dict(response, 0, {})
|
449
|
+
second = self.safe_list(response, 1, [])
|
449
450
|
meta = self.safe_list_2(first, 'universe', 'spot_infos', [])
|
450
451
|
tokens = self.safe_list_2(first, 'tokens', 'token_infos', [])
|
451
452
|
markets = []
|
452
453
|
for i in range(0, len(meta)):
|
453
454
|
market = self.safe_dict(meta, i, {})
|
455
|
+
extraData = self.safe_dict(second, i, {})
|
454
456
|
marketName = self.safe_string(market, 'name')
|
455
457
|
# if marketName.find('/') < 0:
|
456
458
|
# # there are some weird spot markets in testnet, eg @2
|
@@ -527,7 +529,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
527
529
|
},
|
528
530
|
},
|
529
531
|
'created': None,
|
530
|
-
'info': market,
|
532
|
+
'info': self.extend(extraData, market),
|
531
533
|
}))
|
532
534
|
return markets
|
533
535
|
|
@@ -746,6 +748,57 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
746
748
|
timestamp = self.safe_integer(response, 'time')
|
747
749
|
return self.parse_order_book(result, market['symbol'], timestamp, 'bids', 'asks', 'px', 'sz')
|
748
750
|
|
751
|
+
def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
752
|
+
"""
|
753
|
+
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
754
|
+
:see: https://www.bitmex.com/api/explorer/#not /Instrument/Instrument_getActiveAndIndices
|
755
|
+
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
756
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
757
|
+
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
758
|
+
"""
|
759
|
+
self.load_markets()
|
760
|
+
symbols = self.market_symbols(symbols)
|
761
|
+
# at self stage, to get tickers data, we use fetchMarkets endpoints
|
762
|
+
response = self.fetch_markets(params)
|
763
|
+
# same response "fetchMarkets"
|
764
|
+
result: dict = {}
|
765
|
+
for i in range(0, len(response)):
|
766
|
+
market = response[i]
|
767
|
+
info = market['info']
|
768
|
+
ticker = self.parse_ticker(info, market)
|
769
|
+
symbol = self.safe_string(ticker, 'symbol')
|
770
|
+
result[symbol] = ticker
|
771
|
+
return self.filter_by_array_tickers(result, 'symbol', symbols)
|
772
|
+
|
773
|
+
def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
|
774
|
+
#
|
775
|
+
# {
|
776
|
+
# "prevDayPx": "3400.5",
|
777
|
+
# "dayNtlVlm": "511297257.47936022",
|
778
|
+
# "markPx": "3464.7",
|
779
|
+
# "midPx": "3465.05",
|
780
|
+
# "oraclePx": "3460.1", # only in swap
|
781
|
+
# "openInterest": "64638.1108", # only in swap
|
782
|
+
# "premium": "0.00141614", # only in swap
|
783
|
+
# "funding": "0.00008727", # only in swap
|
784
|
+
# "impactPxs": ["3465.0", "3465.1"], # only in swap
|
785
|
+
# "coin": "PURR", # only in spot
|
786
|
+
# "circulatingSupply": "998949190.03400207", # only in spot
|
787
|
+
# },
|
788
|
+
#
|
789
|
+
bidAsk = self.safe_list(ticker, 'impactPxs')
|
790
|
+
return self.safe_ticker({
|
791
|
+
'symbol': market['symbol'],
|
792
|
+
'timestamp': None,
|
793
|
+
'datetime': None,
|
794
|
+
'previousClose': self.safe_number(ticker, 'prevDayPx'),
|
795
|
+
'close': self.safe_number(ticker, 'midPx'),
|
796
|
+
'bid': self.safe_number(bidAsk, 0),
|
797
|
+
'ask': self.safe_number(bidAsk, 1),
|
798
|
+
'quoteVolume': self.safe_number(ticker, 'dayNtlVlm'),
|
799
|
+
'info': ticker,
|
800
|
+
}, market)
|
801
|
+
|
749
802
|
def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
750
803
|
"""
|
751
804
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
ccxt/kraken.py
CHANGED
@@ -98,6 +98,7 @@ class kraken(Exchange, ImplicitAPI):
|
|
98
98
|
'fetchOrderTrades': 'emulated',
|
99
99
|
'fetchPositions': True,
|
100
100
|
'fetchPremiumIndexOHLCV': False,
|
101
|
+
'fetchStatus': True,
|
101
102
|
'fetchTicker': True,
|
102
103
|
'fetchTickers': True,
|
103
104
|
'fetchTime': True,
|
@@ -645,6 +646,30 @@ class kraken(Exchange, ImplicitAPI):
|
|
645
646
|
result.append(self.extend(defaults, markets[i]))
|
646
647
|
return result
|
647
648
|
|
649
|
+
def fetch_status(self, params={}):
|
650
|
+
"""
|
651
|
+
the latest known information on the availability of the exchange API
|
652
|
+
:see: https://docs.kraken.com/api/docs/rest-api/get-system-status/
|
653
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
654
|
+
:returns dict: a `status structure <https://docs.ccxt.com/#/?id=exchange-status-structure>`
|
655
|
+
"""
|
656
|
+
response = self.publicGetSystemStatus(params)
|
657
|
+
#
|
658
|
+
# {
|
659
|
+
# error: [],
|
660
|
+
# result: {status: 'online', timestamp: '2024-07-22T16:34:44Z'}
|
661
|
+
# }
|
662
|
+
#
|
663
|
+
result = self.safe_dict(response, 'result')
|
664
|
+
statusRaw = self.safe_string(result, 'status')
|
665
|
+
return {
|
666
|
+
'status': 'ok' if (statusRaw == 'online') else 'maintenance',
|
667
|
+
'updated': None,
|
668
|
+
'eta': None,
|
669
|
+
'url': None,
|
670
|
+
'info': response,
|
671
|
+
}
|
672
|
+
|
648
673
|
def fetch_currencies(self, params={}) -> Currencies:
|
649
674
|
"""
|
650
675
|
fetches all available currencies on an exchange
|
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',
|