ccxt 4.4.29__py2.py3-none-any.whl → 4.4.30__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/alpaca.py +1 -0
- ccxt/abstract/binance.py +9 -0
- ccxt/abstract/binancecoinm.py +9 -0
- ccxt/abstract/binanceus.py +9 -0
- ccxt/abstract/binanceusdm.py +9 -0
- ccxt/alpaca.py +52 -7
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/alpaca.py +52 -7
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +9 -0
- ccxt/async_support/bitbns.py +12 -12
- ccxt/async_support/bitfinex.py +9 -9
- ccxt/async_support/bitmart.py +53 -53
- ccxt/async_support/deribit.py +7 -3
- ccxt/async_support/hyperliquid.py +110 -5
- ccxt/async_support/lbank.py +1 -1
- ccxt/base/exchange.py +1 -1
- ccxt/binance.py +9 -0
- ccxt/bitbns.py +12 -12
- ccxt/bitfinex.py +9 -9
- ccxt/bitmart.py +53 -53
- ccxt/deribit.py +7 -3
- ccxt/hyperliquid.py +110 -5
- ccxt/lbank.py +1 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/blofin.py +2 -1
- ccxt/test/tests_helpers.py +2 -2
- {ccxt-4.4.29.dist-info → ccxt-4.4.30.dist-info}/METADATA +4 -4
- {ccxt-4.4.29.dist-info → ccxt-4.4.30.dist-info}/RECORD +33 -33
- {ccxt-4.4.29.dist-info → ccxt-4.4.30.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.29.dist-info → ccxt-4.4.30.dist-info}/WHEEL +0 -0
- {ccxt-4.4.29.dist-info → ccxt-4.4.30.dist-info}/top_level.txt +0 -0
ccxt/async_support/bitmart.py
CHANGED
@@ -723,7 +723,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
723
723
|
# }
|
724
724
|
# }
|
725
725
|
#
|
726
|
-
data = self.
|
726
|
+
data = self.safe_dict(response, 'data', {})
|
727
727
|
return self.safe_integer(data, 'server_time')
|
728
728
|
|
729
729
|
async def fetch_status(self, params={}):
|
@@ -732,7 +732,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
732
732
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
733
733
|
:returns dict: a `status structure <https://docs.ccxt.com/#/?id=exchange-status-structure>`
|
734
734
|
"""
|
735
|
-
options = self.
|
735
|
+
options = self.safe_dict(self.options, 'fetchStatus', {})
|
736
736
|
defaultType = self.safe_string(self.options, 'defaultType')
|
737
737
|
type = self.safe_string(options, 'type', defaultType)
|
738
738
|
type = self.safe_string(params, 'type', type)
|
@@ -763,12 +763,12 @@ class bitmart(Exchange, ImplicitAPI):
|
|
763
763
|
# }
|
764
764
|
# }
|
765
765
|
#
|
766
|
-
data = self.
|
767
|
-
services = self.
|
766
|
+
data = self.safe_dict(response, 'data', {})
|
767
|
+
services = self.safe_list(data, 'service', [])
|
768
768
|
servicesByType = self.index_by(services, 'service_type')
|
769
769
|
if type == 'swap':
|
770
770
|
type = 'contract'
|
771
|
-
service = self.
|
771
|
+
service = self.safe_string(servicesByType, type)
|
772
772
|
status = None
|
773
773
|
eta = None
|
774
774
|
if service is not None:
|
@@ -814,8 +814,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
814
814
|
# }
|
815
815
|
# }
|
816
816
|
#
|
817
|
-
data = self.
|
818
|
-
symbols = self.
|
817
|
+
data = self.safe_dict(response, 'data', {})
|
818
|
+
symbols = self.safe_list(data, 'symbols', [])
|
819
819
|
result = []
|
820
820
|
for i in range(0, len(symbols)):
|
821
821
|
market = symbols[i]
|
@@ -923,8 +923,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
923
923
|
# }
|
924
924
|
# }
|
925
925
|
#
|
926
|
-
data = self.
|
927
|
-
symbols = self.
|
926
|
+
data = self.safe_dict(response, 'data', {})
|
927
|
+
symbols = self.safe_list(data, 'symbols', [])
|
928
928
|
result = []
|
929
929
|
for i in range(0, len(symbols)):
|
930
930
|
market = symbols[i]
|
@@ -1026,16 +1026,16 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1026
1026
|
# }
|
1027
1027
|
# }
|
1028
1028
|
#
|
1029
|
-
data = self.
|
1030
|
-
currencies = self.
|
1029
|
+
data = self.safe_dict(response, 'data', {})
|
1030
|
+
currencies = self.safe_list(data, 'currencies', [])
|
1031
1031
|
result: dict = {}
|
1032
1032
|
for i in range(0, len(currencies)):
|
1033
1033
|
currency = currencies[i]
|
1034
1034
|
id = self.safe_string(currency, 'id')
|
1035
1035
|
code = self.safe_currency_code(id)
|
1036
1036
|
name = self.safe_string(currency, 'name')
|
1037
|
-
withdrawEnabled = self.
|
1038
|
-
depositEnabled = self.
|
1037
|
+
withdrawEnabled = self.safe_bool(currency, 'withdraw_enabled')
|
1038
|
+
depositEnabled = self.safe_bool(currency, 'deposit_enabled')
|
1039
1039
|
active = withdrawEnabled and depositEnabled
|
1040
1040
|
result[code] = {
|
1041
1041
|
'id': id,
|
@@ -1386,7 +1386,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1386
1386
|
else:
|
1387
1387
|
data = self.safe_dict(response, 'data', {})
|
1388
1388
|
tickers = self.safe_list(data, 'symbols', [])
|
1389
|
-
ticker = self.
|
1389
|
+
ticker = self.safe_dict(tickers, 0, {})
|
1390
1390
|
return self.parse_ticker(ticker, market)
|
1391
1391
|
|
1392
1392
|
async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
@@ -1403,7 +1403,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1403
1403
|
type = None
|
1404
1404
|
market = None
|
1405
1405
|
if symbols is not None:
|
1406
|
-
symbol = self.
|
1406
|
+
symbol = self.safe_string(symbols, 0)
|
1407
1407
|
market = self.market(symbol)
|
1408
1408
|
type, params = self.handle_market_type_and_params('fetchTickers', market, params)
|
1409
1409
|
response = None
|
@@ -1563,7 +1563,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1563
1563
|
# "trace": "4cad855074664097ac6ba5258c47305d.72.16952643834721135"
|
1564
1564
|
# }
|
1565
1565
|
#
|
1566
|
-
data = self.
|
1566
|
+
data = self.safe_dict(response, 'data', {})
|
1567
1567
|
timestamp = self.safe_integer_2(data, 'ts', 'timestamp')
|
1568
1568
|
return self.parse_order_book(data, market['symbol'], timestamp)
|
1569
1569
|
|
@@ -1891,7 +1891,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1891
1891
|
marginMode, params = self.handle_margin_mode_and_params('fetchMyTrades', params)
|
1892
1892
|
if marginMode == 'isolated':
|
1893
1893
|
request['orderMode'] = 'iso_margin'
|
1894
|
-
options = self.
|
1894
|
+
options = self.safe_dict(self.options, 'fetchMyTrades', {})
|
1895
1895
|
defaultLimit = self.safe_integer(options, 'limit', 200)
|
1896
1896
|
if limit is None:
|
1897
1897
|
limit = defaultLimit
|
@@ -1985,22 +1985,22 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1985
1985
|
return self.parse_trades(data, None, since, limit)
|
1986
1986
|
|
1987
1987
|
def custom_parse_balance(self, response, marketType) -> Balances:
|
1988
|
-
data = self.
|
1988
|
+
data = self.safe_dict(response, 'data', {})
|
1989
1989
|
wallet = None
|
1990
1990
|
if marketType == 'swap':
|
1991
|
-
wallet = self.
|
1991
|
+
wallet = self.safe_list(response, 'data', [])
|
1992
1992
|
elif marketType == 'margin':
|
1993
|
-
wallet = self.
|
1993
|
+
wallet = self.safe_list(data, 'symbols', [])
|
1994
1994
|
else:
|
1995
|
-
wallet = self.
|
1995
|
+
wallet = self.safe_list(data, 'wallet', [])
|
1996
1996
|
result = {'info': response}
|
1997
1997
|
if marketType == 'margin':
|
1998
1998
|
for i in range(0, len(wallet)):
|
1999
1999
|
entry = wallet[i]
|
2000
2000
|
marketId = self.safe_string(entry, 'symbol')
|
2001
2001
|
symbol = self.safe_symbol(marketId, None, '_')
|
2002
|
-
base = self.
|
2003
|
-
quote = self.
|
2002
|
+
base = self.safe_dict(entry, 'base', {})
|
2003
|
+
quote = self.safe_dict(entry, 'quote', {})
|
2004
2004
|
baseCode = self.safe_currency_code(self.safe_string(base, 'currency'))
|
2005
2005
|
quoteCode = self.safe_currency_code(self.safe_string(quote, 'currency'))
|
2006
2006
|
subResult: dict = {}
|
@@ -2202,7 +2202,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2202
2202
|
# }
|
2203
2203
|
# }
|
2204
2204
|
#
|
2205
|
-
data = self.
|
2205
|
+
data = self.safe_dict(response, 'data', {})
|
2206
2206
|
return self.parse_trading_fee(data)
|
2207
2207
|
|
2208
2208
|
def parse_order(self, order: dict, market: Market = None) -> Order:
|
@@ -2361,7 +2361,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2361
2361
|
'4': 'closed', # Completed
|
2362
2362
|
},
|
2363
2363
|
}
|
2364
|
-
statuses = self.
|
2364
|
+
statuses = self.safe_dict(statusesByType, type, {})
|
2365
2365
|
return self.safe_string(statuses, status, status)
|
2366
2366
|
|
2367
2367
|
async def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
|
@@ -2451,7 +2451,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2451
2451
|
# swap
|
2452
2452
|
# {"code":1000,"message":"Ok","data":{"order_id":231116359426639,"price":"market price"},"trace":"7f9c94e10f9d4513bc08a7bfc2a5559a.62.16996369620521911"}
|
2453
2453
|
#
|
2454
|
-
data = self.
|
2454
|
+
data = self.safe_dict(response, 'data', {})
|
2455
2455
|
order = self.parse_order(data, market)
|
2456
2456
|
order['type'] = type
|
2457
2457
|
order['side'] = side
|
@@ -2739,7 +2739,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2739
2739
|
if market['spot']:
|
2740
2740
|
response = await self.privatePostSpotV3CancelOrder(self.extend(request, params))
|
2741
2741
|
else:
|
2742
|
-
stop = self.
|
2742
|
+
stop = self.safe_bool_2(params, 'stop', 'trigger')
|
2743
2743
|
params = self.omit(params, ['stop', 'trigger'])
|
2744
2744
|
if not stop:
|
2745
2745
|
response = await self.privatePostContractPrivateCancelOrder(self.extend(request, params))
|
@@ -2935,7 +2935,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2935
2935
|
# }
|
2936
2936
|
# }
|
2937
2937
|
#
|
2938
|
-
data = self.
|
2938
|
+
data = self.safe_dict(response, 'data', {})
|
2939
2939
|
orders = self.safe_list(data, 'orders', [])
|
2940
2940
|
return self.parse_orders(orders, market, since, limit)
|
2941
2941
|
|
@@ -2982,7 +2982,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2982
2982
|
request['endTime'] = until
|
2983
2983
|
response = await self.privatePostSpotV4QueryOpenOrders(self.extend(request, params))
|
2984
2984
|
elif type == 'swap':
|
2985
|
-
isStop = self.
|
2985
|
+
isStop = self.safe_bool_2(params, 'stop', 'trigger')
|
2986
2986
|
params = self.omit(params, ['stop', 'trigger'])
|
2987
2987
|
if isStop:
|
2988
2988
|
response = await self.privateGetContractPrivateCurrentPlanOrder(self.extend(request, params))
|
@@ -3223,7 +3223,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3223
3223
|
if code == 'USDT':
|
3224
3224
|
defaultNetworks = self.safe_value(self.options, 'defaultNetworks')
|
3225
3225
|
defaultNetwork = self.safe_string_upper(defaultNetworks, code)
|
3226
|
-
networks = self.
|
3226
|
+
networks = self.safe_dict(self.options, 'networks', {})
|
3227
3227
|
networkInner = self.safe_string_upper(params, 'network', defaultNetwork) # self line allows the user to specify either ERC20 or ETH
|
3228
3228
|
networkInner = self.safe_string(networks, networkInner, networkInner) # handle ERC20>ETH alias
|
3229
3229
|
if networkInner is not None:
|
@@ -3302,7 +3302,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3302
3302
|
if code == 'USDT':
|
3303
3303
|
defaultNetworks = self.safe_value(self.options, 'defaultNetworks')
|
3304
3304
|
defaultNetwork = self.safe_string_upper(defaultNetworks, code)
|
3305
|
-
networks = self.
|
3305
|
+
networks = self.safe_dict(self.options, 'networks', {})
|
3306
3306
|
network = self.safe_string_upper(params, 'network', defaultNetwork) # self line allows the user to specify either ERC20 or ETH
|
3307
3307
|
network = self.safe_string(networks, network, network) # handle ERC20>ETH alias
|
3308
3308
|
if network is not None:
|
@@ -3319,7 +3319,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3319
3319
|
# }
|
3320
3320
|
# }
|
3321
3321
|
#
|
3322
|
-
data = self.
|
3322
|
+
data = self.safe_dict(response, 'data', {})
|
3323
3323
|
transaction = self.parse_transaction(data, currency)
|
3324
3324
|
return self.extend(transaction, {
|
3325
3325
|
'code': code,
|
@@ -3343,7 +3343,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3343
3343
|
if code == 'USDT':
|
3344
3344
|
defaultNetworks = self.safe_value(self.options, 'defaultNetworks')
|
3345
3345
|
defaultNetwork = self.safe_string_upper(defaultNetworks, code)
|
3346
|
-
networks = self.
|
3346
|
+
networks = self.safe_dict(self.options, 'networks', {})
|
3347
3347
|
network = self.safe_string_upper(params, 'network', defaultNetwork) # self line allows the user to specify either ERC20 or ETH
|
3348
3348
|
network = self.safe_string(networks, network, network) # handle ERC20>ETH alias
|
3349
3349
|
if network is not None:
|
@@ -3375,7 +3375,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3375
3375
|
# }
|
3376
3376
|
# }
|
3377
3377
|
#
|
3378
|
-
data = self.
|
3378
|
+
data = self.safe_dict(response, 'data', {})
|
3379
3379
|
records = self.safe_list(data, 'records', [])
|
3380
3380
|
return self.parse_transactions(records, currency, since, limit)
|
3381
3381
|
|
@@ -3414,7 +3414,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3414
3414
|
# }
|
3415
3415
|
# }
|
3416
3416
|
#
|
3417
|
-
data = self.
|
3417
|
+
data = self.safe_dict(response, 'data', {})
|
3418
3418
|
record = self.safe_dict(data, 'record', {})
|
3419
3419
|
return self.parse_transaction(record)
|
3420
3420
|
|
@@ -3464,7 +3464,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3464
3464
|
# }
|
3465
3465
|
# }
|
3466
3466
|
#
|
3467
|
-
data = self.
|
3467
|
+
data = self.safe_dict(response, 'data', {})
|
3468
3468
|
record = self.safe_dict(data, 'record', {})
|
3469
3469
|
return self.parse_transaction(record)
|
3470
3470
|
|
@@ -3591,7 +3591,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3591
3591
|
# }
|
3592
3592
|
# }
|
3593
3593
|
#
|
3594
|
-
data = self.
|
3594
|
+
data = self.safe_dict(response, 'data', {})
|
3595
3595
|
transaction = self.parse_margin_loan(data, currency)
|
3596
3596
|
return self.extend(transaction, {
|
3597
3597
|
'amount': amount,
|
@@ -3627,7 +3627,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3627
3627
|
# }
|
3628
3628
|
# }
|
3629
3629
|
#
|
3630
|
-
data = self.
|
3630
|
+
data = self.safe_dict(response, 'data', {})
|
3631
3631
|
transaction = self.parse_margin_loan(data, currency)
|
3632
3632
|
return self.extend(transaction, {
|
3633
3633
|
'amount': amount,
|
@@ -3704,9 +3704,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3704
3704
|
# }
|
3705
3705
|
# }
|
3706
3706
|
#
|
3707
|
-
data = self.
|
3708
|
-
symbols = self.
|
3709
|
-
borrowRate = self.
|
3707
|
+
data = self.safe_dict(response, 'data', {})
|
3708
|
+
symbols = self.safe_list(data, 'symbols', [])
|
3709
|
+
borrowRate = self.safe_dict(symbols, 0, [])
|
3710
3710
|
return self.parse_isolated_borrow_rate(borrowRate, market)
|
3711
3711
|
|
3712
3712
|
def parse_isolated_borrow_rate(self, info: dict, market: Market = None) -> IsolatedBorrowRate:
|
@@ -3735,8 +3735,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3735
3735
|
#
|
3736
3736
|
marketId = self.safe_string(info, 'symbol')
|
3737
3737
|
symbol = self.safe_symbol(marketId, market)
|
3738
|
-
baseData = self.
|
3739
|
-
quoteData = self.
|
3738
|
+
baseData = self.safe_dict(info, 'base', {})
|
3739
|
+
quoteData = self.safe_dict(info, 'quote', {})
|
3740
3740
|
baseId = self.safe_string(baseData, 'currency')
|
3741
3741
|
quoteId = self.safe_string(quoteData, 'currency')
|
3742
3742
|
return {
|
@@ -3792,8 +3792,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3792
3792
|
# }
|
3793
3793
|
# }
|
3794
3794
|
#
|
3795
|
-
data = self.
|
3796
|
-
symbols = self.
|
3795
|
+
data = self.safe_dict(response, 'data', {})
|
3796
|
+
symbols = self.safe_list(data, 'symbols', [])
|
3797
3797
|
return self.parse_isolated_borrow_rates(symbols)
|
3798
3798
|
|
3799
3799
|
async def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
|
@@ -3861,7 +3861,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3861
3861
|
# }
|
3862
3862
|
# }
|
3863
3863
|
#
|
3864
|
-
data = self.
|
3864
|
+
data = self.safe_dict(response, 'data', {})
|
3865
3865
|
return self.extend(self.parse_transfer(data, currency), {
|
3866
3866
|
'status': self.parse_transfer_status(self.safe_string_2(response, 'code', 'message')),
|
3867
3867
|
})
|
@@ -3979,7 +3979,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3979
3979
|
# }
|
3980
3980
|
# }
|
3981
3981
|
#
|
3982
|
-
data = self.
|
3982
|
+
data = self.safe_dict(response, 'data', {})
|
3983
3983
|
records = self.safe_list(data, 'records', [])
|
3984
3984
|
return self.parse_transfers(records, currency, since, limit)
|
3985
3985
|
|
@@ -4027,8 +4027,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4027
4027
|
# }
|
4028
4028
|
# }
|
4029
4029
|
#
|
4030
|
-
data = self.
|
4031
|
-
rows = self.
|
4030
|
+
data = self.safe_dict(response, 'data', {})
|
4031
|
+
rows = self.safe_list(data, 'records', [])
|
4032
4032
|
interest = self.parse_borrow_interests(rows, market)
|
4033
4033
|
return self.filter_by_currency_since_limit(interest, code, since, limit)
|
4034
4034
|
|
@@ -4168,7 +4168,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4168
4168
|
# "trace": "4cad855074654097ac7ba5257c47305d.54.16951844206655589"
|
4169
4169
|
# }
|
4170
4170
|
#
|
4171
|
-
data = self.
|
4171
|
+
data = self.safe_dict(response, 'data', {})
|
4172
4172
|
return self.parse_funding_rate(data, market)
|
4173
4173
|
|
4174
4174
|
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
@@ -4247,7 +4247,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4247
4247
|
# "trace":"4cad855074664097ac5ba5257c47305d.67.16963925142065945"
|
4248
4248
|
# }
|
4249
4249
|
#
|
4250
|
-
data = self.
|
4250
|
+
data = self.safe_list(response, 'data', [])
|
4251
4251
|
first = self.safe_dict(data, 0, {})
|
4252
4252
|
return self.parse_position(first, market)
|
4253
4253
|
|
@@ -4301,7 +4301,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4301
4301
|
# "trace":"4cad855074664097ac5ba5257c47305d.67.16963925142065945"
|
4302
4302
|
# }
|
4303
4303
|
#
|
4304
|
-
positions = self.
|
4304
|
+
positions = self.safe_list(response, 'data', [])
|
4305
4305
|
result = []
|
4306
4306
|
for i in range(0, len(positions)):
|
4307
4307
|
result.append(self.parse_position(positions[i]))
|
@@ -4421,7 +4421,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4421
4421
|
# "trace": "4cad855074664097ac6ba4257c47305d.71.16965658195443021"
|
4422
4422
|
# }
|
4423
4423
|
#
|
4424
|
-
data = self.
|
4424
|
+
data = self.safe_list(response, 'data', [])
|
4425
4425
|
result = []
|
4426
4426
|
for i in range(0, len(data)):
|
4427
4427
|
entry = data[i]
|
ccxt/async_support/deribit.py
CHANGED
@@ -843,6 +843,8 @@ class deribit(Exchange, ImplicitAPI):
|
|
843
843
|
type = 'option'
|
844
844
|
elif isSpot:
|
845
845
|
type = 'spot'
|
846
|
+
inverse = None
|
847
|
+
linear = None
|
846
848
|
if isSpot:
|
847
849
|
symbol = base + '/' + quote
|
848
850
|
elif not isComboMarket:
|
@@ -854,6 +856,8 @@ class deribit(Exchange, ImplicitAPI):
|
|
854
856
|
optionType = self.safe_string(market, 'option_type')
|
855
857
|
letter = 'C' if (optionType == 'call') else 'P'
|
856
858
|
symbol = symbol + '-' + self.number_to_string(strike) + '-' + letter
|
859
|
+
inverse = (quote != settle)
|
860
|
+
linear = (settle == quote)
|
857
861
|
parsedMarketValue = self.safe_value(parsedMarkets, symbol)
|
858
862
|
if parsedMarketValue:
|
859
863
|
continue
|
@@ -877,8 +881,8 @@ class deribit(Exchange, ImplicitAPI):
|
|
877
881
|
'option': option,
|
878
882
|
'active': self.safe_value(market, 'is_active'),
|
879
883
|
'contract': not isSpot,
|
880
|
-
'linear':
|
881
|
-
'inverse':
|
884
|
+
'linear': linear,
|
885
|
+
'inverse': inverse,
|
882
886
|
'taker': self.safe_number(market, 'taker_commission'),
|
883
887
|
'maker': self.safe_number(market, 'maker_commission'),
|
884
888
|
'contractSize': self.safe_number(market, 'contract_size'),
|
@@ -1697,7 +1701,7 @@ class deribit(Exchange, ImplicitAPI):
|
|
1697
1701
|
filledString = self.safe_string(order, 'filled_amount')
|
1698
1702
|
amount = self.safe_string(order, 'amount')
|
1699
1703
|
cost = Precise.string_mul(filledString, averageString)
|
1700
|
-
if market
|
1704
|
+
if self.safe_bool(market, 'inverse'):
|
1701
1705
|
if averageString != '0':
|
1702
1706
|
cost = Precise.string_div(amount, averageString)
|
1703
1707
|
lastTradeTimestamp = None
|
@@ -6,7 +6,8 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.hyperliquid import ImplicitAPI
|
8
8
|
import asyncio
|
9
|
-
|
9
|
+
import math
|
10
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, LedgerEntry, MarginModification, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, Transaction, TransferEntry
|
10
11
|
from typing import List
|
11
12
|
from ccxt.base.errors import ExchangeError
|
12
13
|
from ccxt.base.errors import ArgumentsRequired
|
@@ -75,7 +76,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
75
76
|
'fetchFundingHistory': False,
|
76
77
|
'fetchFundingRate': False,
|
77
78
|
'fetchFundingRateHistory': True,
|
78
|
-
'fetchFundingRates':
|
79
|
+
'fetchFundingRates': True,
|
79
80
|
'fetchIndexOHLCV': False,
|
80
81
|
'fetchIsolatedBorrowRate': False,
|
81
82
|
'fetchIsolatedBorrowRates': False,
|
@@ -131,12 +132,12 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
131
132
|
'1h': '1h',
|
132
133
|
'2h': '2h',
|
133
134
|
'4h': '4h',
|
134
|
-
'
|
135
|
+
'8h': '8h',
|
135
136
|
'12h': '12h',
|
136
137
|
'1d': '1d',
|
137
138
|
'3d': '3d',
|
138
139
|
'1w': '1w',
|
139
|
-
'1M': '
|
140
|
+
'1M': '1M',
|
140
141
|
},
|
141
142
|
'hostname': 'hyperliquid.xyz',
|
142
143
|
'urls': {
|
@@ -736,6 +737,110 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
736
737
|
result[symbol] = ticker
|
737
738
|
return self.filter_by_array_tickers(result, 'symbol', symbols)
|
738
739
|
|
740
|
+
async def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
741
|
+
"""
|
742
|
+
retrieves data on all swap markets for hyperliquid
|
743
|
+
:see: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc
|
744
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
745
|
+
:returns dict[]: an array of objects representing market data
|
746
|
+
"""
|
747
|
+
request: dict = {
|
748
|
+
'type': 'metaAndAssetCtxs',
|
749
|
+
}
|
750
|
+
response = await self.publicPostInfo(self.extend(request, params))
|
751
|
+
#
|
752
|
+
# [
|
753
|
+
# {
|
754
|
+
# "universe": [
|
755
|
+
# {
|
756
|
+
# "maxLeverage": 50,
|
757
|
+
# "name": "SOL",
|
758
|
+
# "onlyIsolated": False,
|
759
|
+
# "szDecimals": 2
|
760
|
+
# }
|
761
|
+
# ]
|
762
|
+
# },
|
763
|
+
# [
|
764
|
+
# {
|
765
|
+
# "dayNtlVlm": "9450588.2273",
|
766
|
+
# "funding": "0.0000198",
|
767
|
+
# "impactPxs": [
|
768
|
+
# "108.04",
|
769
|
+
# "108.06"
|
770
|
+
# ],
|
771
|
+
# "markPx": "108.04",
|
772
|
+
# "midPx": "108.05",
|
773
|
+
# "openInterest": "10764.48",
|
774
|
+
# "oraclePx": "107.99",
|
775
|
+
# "premium": "0.00055561",
|
776
|
+
# "prevDayPx": "111.81"
|
777
|
+
# }
|
778
|
+
# ]
|
779
|
+
# ]
|
780
|
+
#
|
781
|
+
#
|
782
|
+
meta = self.safe_dict(response, 0, {})
|
783
|
+
universe = self.safe_list(meta, 'universe', [])
|
784
|
+
assetCtxs = self.safe_list(response, 1, [])
|
785
|
+
result = []
|
786
|
+
for i in range(0, len(universe)):
|
787
|
+
data = self.extend(
|
788
|
+
self.safe_dict(universe, i, {}),
|
789
|
+
self.safe_dict(assetCtxs, i, {})
|
790
|
+
)
|
791
|
+
result.append(data)
|
792
|
+
funding_rates = self.parse_funding_rates(result)
|
793
|
+
return self.filter_by_array(funding_rates, 'symbol', symbols)
|
794
|
+
|
795
|
+
def parse_funding_rate(self, info, market: Market = None) -> FundingRate:
|
796
|
+
#
|
797
|
+
# {
|
798
|
+
# "maxLeverage": "50",
|
799
|
+
# "name": "ETH",
|
800
|
+
# "onlyIsolated": False,
|
801
|
+
# "szDecimals": "4",
|
802
|
+
# "dayNtlVlm": "1709813.11535",
|
803
|
+
# "funding": "0.00004807",
|
804
|
+
# "impactPxs": [
|
805
|
+
# "2369.3",
|
806
|
+
# "2369.6"
|
807
|
+
# ],
|
808
|
+
# "markPx": "2369.6",
|
809
|
+
# "midPx": "2369.45",
|
810
|
+
# "openInterest": "1815.4712",
|
811
|
+
# "oraclePx": "2367.3",
|
812
|
+
# "premium": "0.00090821",
|
813
|
+
# "prevDayPx": "2381.5"
|
814
|
+
# }
|
815
|
+
#
|
816
|
+
base = self.safe_string(info, 'name')
|
817
|
+
marketId = self.coin_to_market_id(base)
|
818
|
+
symbol = self.safe_symbol(marketId, market)
|
819
|
+
funding = self.safe_number(info, 'funding')
|
820
|
+
markPx = self.safe_number(info, 'markPx')
|
821
|
+
oraclePx = self.safe_number(info, 'oraclePx')
|
822
|
+
fundingTimestamp = (int(math.floor(self.milliseconds()) / 60 / 60 / 1000) + 1) * 60 * 60 * 1000
|
823
|
+
return {
|
824
|
+
'info': info,
|
825
|
+
'symbol': symbol,
|
826
|
+
'markPrice': markPx,
|
827
|
+
'indexPrice': oraclePx,
|
828
|
+
'interestRate': None,
|
829
|
+
'estimatedSettlePrice': None,
|
830
|
+
'timestamp': None,
|
831
|
+
'datetime': None,
|
832
|
+
'fundingRate': funding,
|
833
|
+
'fundingTimestamp': fundingTimestamp,
|
834
|
+
'fundingDatetime': self.iso8601(fundingTimestamp),
|
835
|
+
'nextFundingRate': None,
|
836
|
+
'nextFundingTimestamp': None,
|
837
|
+
'nextFundingDatetime': None,
|
838
|
+
'previousFundingRate': None,
|
839
|
+
'previousFundingTimestamp': None,
|
840
|
+
'previousFundingDatetime': None,
|
841
|
+
'interval': '1h',
|
842
|
+
}
|
843
|
+
|
739
844
|
def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
|
740
845
|
#
|
741
846
|
# {
|
@@ -795,7 +900,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
795
900
|
'type': 'candleSnapshot',
|
796
901
|
'req': {
|
797
902
|
'coin': market['base'] if market['swap'] else market['id'],
|
798
|
-
'interval': timeframe,
|
903
|
+
'interval': self.safe_string(self.timeframes, timeframe, timeframe),
|
799
904
|
'startTime': since,
|
800
905
|
'endTime': until,
|
801
906
|
},
|
ccxt/async_support/lbank.py
CHANGED
@@ -1159,7 +1159,7 @@ class lbank(Exchange, ImplicitAPI):
|
|
1159
1159
|
intervalString = None
|
1160
1160
|
if positionFeeTime is not None:
|
1161
1161
|
interval = self.parse_to_int(positionFeeTime / 60 / 60)
|
1162
|
-
intervalString = interval + 'h'
|
1162
|
+
intervalString = str(interval) + 'h'
|
1163
1163
|
return {
|
1164
1164
|
'info': ticker,
|
1165
1165
|
'symbol': symbol,
|
ccxt/base/exchange.py
CHANGED
ccxt/binance.py
CHANGED
@@ -416,6 +416,12 @@ class binance(Exchange, ImplicitAPI):
|
|
416
416
|
'eth-staking/wbeth/history/wrapHistory': 15, # Weight(IP): 150 => cost = 0.1 * 150 = 15
|
417
417
|
'eth-staking/wbeth/history/unwrapHistory': 15, # Weight(IP): 150 => cost = 0.1 * 150 = 15
|
418
418
|
'eth-staking/eth/history/wbethRewardsHistory': 15, # Weight(IP): 150 => cost = 0.1 * 150 = 15
|
419
|
+
'sol-staking/sol/history/stakingHistory': 15,
|
420
|
+
'sol-staking/sol/history/redemptionHistory': 15,
|
421
|
+
'sol-staking/sol/history/bnsolRewardsHistory': 15,
|
422
|
+
'sol-staking/sol/history/rateHistory': 15,
|
423
|
+
'sol-staking/account': 15,
|
424
|
+
'sol-staking/sol/quota': 15,
|
419
425
|
# mining endpoints
|
420
426
|
'mining/pub/algoList': 0.1,
|
421
427
|
'mining/pub/coinList': 0.1,
|
@@ -627,6 +633,8 @@ class binance(Exchange, ImplicitAPI):
|
|
627
633
|
'eth-staking/eth/stake': 15, # Weight(IP): 150 => cost = 0.1 * 150 = 15
|
628
634
|
'eth-staking/eth/redeem': 15, # Weight(IP): 150 => cost = 0.1 * 150 = 15
|
629
635
|
'eth-staking/wbeth/wrap': 15, # Weight(IP): 150 => cost = 0.1 * 150 = 15
|
636
|
+
'sol-staking/sol/stake': 15,
|
637
|
+
'sol-staking/sol/redeem': 15,
|
630
638
|
# mining endpoints
|
631
639
|
'mining/hash-transfer/config': 0.5, # Weight(IP): 5 => cost = 0.1 * 5 = 0.5
|
632
640
|
'mining/hash-transfer/config/cancel': 0.5, # Weight(IP): 5 => cost = 0.1 * 5 = 0.5
|
@@ -661,6 +669,7 @@ class binance(Exchange, ImplicitAPI):
|
|
661
669
|
'simple-earn/locked/redeem': 0.1,
|
662
670
|
'simple-earn/flexible/setAutoSubscribe': 15,
|
663
671
|
'simple-earn/locked/setAutoSubscribe': 15,
|
672
|
+
'simple-earn/locked/setRedeemOption': 5,
|
664
673
|
# convert
|
665
674
|
'dci/product/subscribe': 0.1,
|
666
675
|
'dci/product/auto_compound/edit': 0.1,
|