ccxt 4.2.92__py2.py3-none-any.whl → 4.2.94__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.

Potentially problematic release.


This version of ccxt might be problematic. Click here for more details.

ccxt/async_support/woo.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.woo import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Bool, Currencies, Currency, Int, Leverage, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, TradingFees, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Balances, Bool, Conversion, Currencies, Currency, Int, Leverage, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import ArgumentsRequired
@@ -66,6 +66,8 @@ class woo(Exchange, ImplicitAPI):
66
66
  'fetchCanceledOrders': False,
67
67
  'fetchClosedOrder': False,
68
68
  'fetchClosedOrders': True,
69
+ 'fetchConvertCurrencies': True,
70
+ 'fetchConvertQuote': True,
69
71
  'fetchCurrencies': True,
70
72
  'fetchDepositAddress': True,
71
73
  'fetchDeposits': True,
@@ -2781,6 +2783,138 @@ class woo(Exchange, ImplicitAPI):
2781
2783
  'takeProfitPrice': None,
2782
2784
  })
2783
2785
 
2786
+ async def fetch_convert_quote(self, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion:
2787
+ """
2788
+ fetch a quote for converting from one currency to another
2789
+ :see: https://docs.woo.org/#get-quote-rfq
2790
+ :param str fromCode: the currency that you want to sell and convert from
2791
+ :param str toCode: the currency that you want to buy and convert into
2792
+ :param float [amount]: how much you want to trade in units of the from currency
2793
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2794
+ :returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
2795
+ """
2796
+ await self.load_markets()
2797
+ request = {
2798
+ 'sellToken': fromCode.upper(),
2799
+ 'buyToken': toCode.upper(),
2800
+ 'sellQuantity': self.number_to_string(amount),
2801
+ }
2802
+ response = await self.v3PrivateGetConvertRfq(self.extend(request, params))
2803
+ #
2804
+ # {
2805
+ # "success": True,
2806
+ # "data": {
2807
+ # "quoteId": 123123123,
2808
+ # "counterPartyId": "",
2809
+ # "sellToken": "ETH",
2810
+ # "sellQuantity": "0.0445",
2811
+ # "buyToken": "USDT",
2812
+ # "buyQuantity": "33.45",
2813
+ # "buyPrice": "6.77",
2814
+ # "expireTimestamp": 1659084466000,
2815
+ # "message": 1659084466000
2816
+ # }
2817
+ # }
2818
+ #
2819
+ data = self.safe_dict(response, 'data', {})
2820
+ fromCurrencyId = self.safe_string(data, 'sellToken', fromCode)
2821
+ fromCurrency = self.currency(fromCurrencyId)
2822
+ toCurrencyId = self.safe_string(data, 'buyToken', toCode)
2823
+ toCurrency = self.currency(toCurrencyId)
2824
+ return self.parse_conversion(data, fromCurrency, toCurrency)
2825
+
2826
+ def parse_conversion(self, conversion, fromCurrency: Currency = None, toCurrency: Currency = None) -> Conversion:
2827
+ #
2828
+ # fetchConvertQuote
2829
+ #
2830
+ # {
2831
+ # "quoteId": 123123123,
2832
+ # "counterPartyId": "",
2833
+ # "sellToken": "ETH",
2834
+ # "sellQuantity": "0.0445",
2835
+ # "buyToken": "USDT",
2836
+ # "buyQuantity": "33.45",
2837
+ # "buyPrice": "6.77",
2838
+ # "expireTimestamp": 1659084466000,
2839
+ # "message": 1659084466000
2840
+ # }
2841
+ #
2842
+ timestamp = self.safe_integer(conversion, 'expireTimestamp')
2843
+ fromCoin = self.safe_string(conversion, 'sellToken')
2844
+ fromCode = self.safe_currency_code(fromCoin, fromCurrency)
2845
+ to = self.safe_string(conversion, 'buyToken')
2846
+ toCode = self.safe_currency_code(to, toCurrency)
2847
+ return {
2848
+ 'info': conversion,
2849
+ 'timestamp': timestamp,
2850
+ 'datetime': self.iso8601(timestamp),
2851
+ 'id': self.safe_string(conversion, 'quoteId'),
2852
+ 'fromCurrency': fromCode,
2853
+ 'fromAmount': self.safe_number(conversion, 'sellQuantity'),
2854
+ 'toCurrency': toCode,
2855
+ 'toAmount': self.safe_number(conversion, 'buyQuantity'),
2856
+ 'price': self.safe_number(conversion, 'buyPrice'),
2857
+ 'fee': None,
2858
+ }
2859
+
2860
+ async def fetch_convert_currencies(self, params={}) -> Currencies:
2861
+ """
2862
+ fetches all available currencies that can be converted
2863
+ :see: https://docs.woo.org/#get-quote-asset-info
2864
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2865
+ :returns dict: an associative dictionary of currencies
2866
+ """
2867
+ await self.load_markets()
2868
+ response = await self.v3PrivateGetConvertAssetInfo(params)
2869
+ #
2870
+ # {
2871
+ # "success": True,
2872
+ # "rows": [
2873
+ # {
2874
+ # "token": "BTC",
2875
+ # "tick": 0.0001,
2876
+ # "createdTime": "1575014248.99", # Unix epoch time in seconds
2877
+ # "updatedTime": "1575014248.99" # Unix epoch time in seconds
2878
+ # },
2879
+ # ]
2880
+ # }
2881
+ #
2882
+ result = {}
2883
+ data = self.safe_list(response, 'rows', [])
2884
+ for i in range(0, len(data)):
2885
+ entry = data[i]
2886
+ id = self.safe_string(entry, 'token')
2887
+ code = self.safe_currency_code(id)
2888
+ result[code] = {
2889
+ 'info': entry,
2890
+ 'id': id,
2891
+ 'code': code,
2892
+ 'networks': None,
2893
+ 'type': None,
2894
+ 'name': None,
2895
+ 'active': None,
2896
+ 'deposit': None,
2897
+ 'withdraw': None,
2898
+ 'fee': None,
2899
+ 'precision': self.safe_number(entry, 'tick'),
2900
+ 'limits': {
2901
+ 'amount': {
2902
+ 'min': None,
2903
+ 'max': None,
2904
+ },
2905
+ 'withdraw': {
2906
+ 'min': None,
2907
+ 'max': None,
2908
+ },
2909
+ 'deposit': {
2910
+ 'min': None,
2911
+ 'max': None,
2912
+ },
2913
+ },
2914
+ 'created': self.safe_timestamp(entry, 'createdTime'),
2915
+ }
2916
+ return result
2917
+
2784
2918
  def default_network_code_for_currency(self, code):
2785
2919
  currencyItem = self.currency(code)
2786
2920
  networks = currencyItem['networks']
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.2.92'
7
+ __version__ = '4.2.94'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -3225,6 +3225,14 @@ class Exchange(object):
3225
3225
  result.append(self.market_id(symbols[i]))
3226
3226
  return result
3227
3227
 
3228
+ def markets_for_symbols(self, symbols: Strings = None):
3229
+ if symbols is None:
3230
+ return symbols
3231
+ result = []
3232
+ for i in range(0, len(symbols)):
3233
+ result.append(self.market(symbols[i]))
3234
+ return result
3235
+
3228
3236
  def market_symbols(self, symbols: Strings = None, type: Str = None, allowEmpty=True, sameTypeOnly=False, sameSubTypeOnly=False):
3229
3237
  if symbols is None:
3230
3238
  if not allowEmpty:
@@ -3441,18 +3449,33 @@ class Exchange(object):
3441
3449
  sorted = self.sort_by(results, 0)
3442
3450
  return self.filter_by_since_limit(sorted, since, limit, 0)
3443
3451
 
3444
- def parse_leverage_tiers(self, response: List[object], symbols: List[str] = None, marketIdKey=None):
3452
+ def parse_leverage_tiers(self, response: Any, symbols: List[str] = None, marketIdKey=None):
3445
3453
  # marketIdKey should only be None when response is a dictionary
3446
3454
  symbols = self.market_symbols(symbols)
3447
3455
  tiers = {}
3448
- for i in range(0, len(response)):
3449
- item = response[i]
3450
- id = self.safe_string(item, marketIdKey)
3451
- market = self.safe_market(id, None, None, 'swap')
3452
- symbol = market['symbol']
3453
- contract = self.safe_bool(market, 'contract', False)
3454
- if contract and ((symbols is None) or self.in_array(symbol, symbols)):
3455
- tiers[symbol] = self.parse_market_leverage_tiers(item, market)
3456
+ symbolsLength = 0
3457
+ if symbols is not None:
3458
+ symbolsLength = len(symbols)
3459
+ noSymbols = (symbols is None) or (symbolsLength == 0)
3460
+ if isinstance(response, list):
3461
+ for i in range(0, len(response)):
3462
+ item = response[i]
3463
+ id = self.safe_string(item, marketIdKey)
3464
+ market = self.safe_market(id, None, None, 'swap')
3465
+ symbol = market['symbol']
3466
+ contract = self.safe_bool(market, 'contract', False)
3467
+ if contract and (noSymbols or self.in_array(symbol, symbols)):
3468
+ tiers[symbol] = self.parse_market_leverage_tiers(item, market)
3469
+ else:
3470
+ keys = list(response.keys())
3471
+ for i in range(0, len(keys)):
3472
+ marketId = keys[i]
3473
+ item = response[marketId]
3474
+ market = self.safe_market(marketId, None, None, 'swap')
3475
+ symbol = market['symbol']
3476
+ contract = self.safe_bool(market, 'contract', False)
3477
+ if contract and (noSymbols or self.in_array(symbol, symbols)):
3478
+ tiers[symbol] = self.parse_market_leverage_tiers(item, market)
3456
3479
  return tiers
3457
3480
 
3458
3481
  def load_trading_limits(self, symbols: List[str] = None, reload=False, params={}):
@@ -4354,6 +4377,9 @@ class Exchange(object):
4354
4377
  def fetch_option(self, symbol: str, params={}):
4355
4378
  raise NotSupported(self.id + ' fetchOption() is not supported yet')
4356
4379
 
4380
+ def fetch_convert_quote(self, fromCode: str, toCode: str, amount: Num = None, params={}):
4381
+ raise NotSupported(self.id + ' fetchConvertQuote() is not supported yet')
4382
+
4357
4383
  def fetch_deposits_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
4358
4384
  """
4359
4385
  fetch history of deposits and withdrawals
@@ -4827,6 +4853,9 @@ class Exchange(object):
4827
4853
  fees = self.fetch_trading_fees(params)
4828
4854
  return self.safe_dict(fees, symbol)
4829
4855
 
4856
+ def fetch_convert_currencies(self, params={}):
4857
+ raise NotSupported(self.id + ' fetchConvertCurrencies() is not supported yet')
4858
+
4830
4859
  def parse_open_interest(self, interest, market: Market = None):
4831
4860
  raise NotSupported(self.id + ' parseOpenInterest() is not supported yet')
4832
4861
 
@@ -5410,6 +5439,9 @@ class Exchange(object):
5410
5439
  def parse_leverage(self, leverage, market: Market = None):
5411
5440
  raise NotSupported(self.id + ' parseLeverage() is not supported yet')
5412
5441
 
5442
+ def parse_conversion(self, conversion, fromCurrency: Currency = None, toCurrency: Currency = None):
5443
+ raise NotSupported(self.id + ' parseConversion() is not supported yet')
5444
+
5413
5445
  def convert_expire_date(self, date: str):
5414
5446
  # parse YYMMDD to datetime string
5415
5447
  year = date[0:2]
ccxt/base/types.py CHANGED
@@ -311,6 +311,19 @@ class Greeks(TypedDict):
311
311
  info: Dict[str, Any]
312
312
 
313
313
 
314
+ class Conversion(TypedDict):
315
+ info: Dict[str, Any]
316
+ timestamp: Int
317
+ datetime: Str
318
+ id: Str
319
+ fromCurrency: Str
320
+ fromAmount: Num
321
+ toCurrency: Str
322
+ toAmount: Num
323
+ price: Num
324
+ fee: Num
325
+
326
+
314
327
  class Option(TypedDict):
315
328
  info: Dict[str, Any]
316
329
  currency: Str
ccxt/binance.py CHANGED
@@ -93,6 +93,8 @@ class binance(Exchange, ImplicitAPI):
93
93
  'fetchCanceledOrders': 'emulated',
94
94
  'fetchClosedOrder': False,
95
95
  'fetchClosedOrders': 'emulated',
96
+ 'fetchConvertCurrencies': True,
97
+ 'fetchConvertQuote': False,
96
98
  'fetchCrossBorrowRate': True,
97
99
  'fetchCrossBorrowRates': False,
98
100
  'fetchCurrencies': True,
@@ -992,6 +994,7 @@ class binance(Exchange, ImplicitAPI):
992
994
  },
993
995
  'post': {
994
996
  'order/oco': 0.2,
997
+ 'orderList/oco': 0.2,
995
998
  'sor/order': 0.2,
996
999
  'sor/order/test': 0.2,
997
1000
  'order': 0.2,
@@ -4108,10 +4111,13 @@ class binance(Exchange, ImplicitAPI):
4108
4111
  'interval': self.safe_string(self.timeframes, timeframe, timeframe),
4109
4112
  'limit': limit,
4110
4113
  }
4114
+ marketId = market['id']
4111
4115
  if price == 'index':
4112
- request['pair'] = market['id'] # Index price takes self argument instead of symbol
4116
+ parts = marketId.split('_')
4117
+ pair = self.safe_string(parts, 0)
4118
+ request['pair'] = pair # Index price takes self argument instead of symbol
4113
4119
  else:
4114
- request['symbol'] = market['id']
4120
+ request['symbol'] = marketId
4115
4121
  # duration = self.parse_timeframe(timeframe)
4116
4122
  if since is not None:
4117
4123
  request['startTime'] = since
@@ -11577,3 +11583,55 @@ class binance(Exchange, ImplicitAPI):
11577
11583
  #
11578
11584
  modifications = self.parse_margin_modifications(response)
11579
11585
  return self.filter_by_symbol_since_limit(modifications, symbol, since, limit)
11586
+
11587
+ def fetch_convert_currencies(self, params={}) -> Currencies:
11588
+ """
11589
+ fetches all available currencies that can be converted
11590
+ :see: https://binance-docs.github.io/apidocs/spot/en/#query-order-quantity-precision-per-asset-user_data
11591
+ :param dict [params]: extra parameters specific to the exchange API endpoint
11592
+ :returns dict: an associative dictionary of currencies
11593
+ """
11594
+ self.load_markets()
11595
+ response = self.sapiGetConvertAssetInfo(params)
11596
+ #
11597
+ # [
11598
+ # {
11599
+ # "asset": "BTC",
11600
+ # "fraction": 8
11601
+ # },
11602
+ # ]
11603
+ #
11604
+ result = {}
11605
+ for i in range(0, len(response)):
11606
+ entry = response[i]
11607
+ id = self.safe_string(entry, 'asset')
11608
+ code = self.safe_currency_code(id)
11609
+ result[code] = {
11610
+ 'info': entry,
11611
+ 'id': id,
11612
+ 'code': code,
11613
+ 'networks': None,
11614
+ 'type': None,
11615
+ 'name': None,
11616
+ 'active': None,
11617
+ 'deposit': None,
11618
+ 'withdraw': None,
11619
+ 'fee': None,
11620
+ 'precision': self.safe_integer(entry, 'fraction'),
11621
+ 'limits': {
11622
+ 'amount': {
11623
+ 'min': None,
11624
+ 'max': None,
11625
+ },
11626
+ 'withdraw': {
11627
+ 'min': None,
11628
+ 'max': None,
11629
+ },
11630
+ 'deposit': {
11631
+ 'min': None,
11632
+ 'max': None,
11633
+ },
11634
+ },
11635
+ 'created': None,
11636
+ }
11637
+ return result
ccxt/bitget.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitget import ImplicitAPI
8
8
  import hashlib
9
9
  import json
10
- from ccxt.base.types import Balances, Currencies, Currency, FundingHistory, Int, Liquidation, Leverage, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
10
+ from ccxt.base.types import Balances, Conversion, Currencies, Currency, FundingHistory, Int, Liquidation, Leverage, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import PermissionDenied
@@ -84,6 +84,8 @@ class bitget(Exchange, ImplicitAPI):
84
84
  'fetchCanceledAndClosedOrders': True,
85
85
  'fetchCanceledOrders': True,
86
86
  'fetchClosedOrders': True,
87
+ 'fetchConvertCurrencies': True,
88
+ 'fetchConvertQuote': True,
87
89
  'fetchCrossBorrowRate': True,
88
90
  'fetchCrossBorrowRates': False,
89
91
  'fetchCurrencies': True,
@@ -7852,6 +7854,138 @@ class bitget(Exchange, ImplicitAPI):
7852
7854
  'marginMode': marginType,
7853
7855
  }
7854
7856
 
7857
+ def fetch_convert_quote(self, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion:
7858
+ """
7859
+ fetch a quote for converting from one currency to another
7860
+ :see: https://www.bitget.com/api-doc/common/convert/Get-Quoted-Price
7861
+ :param str fromCode: the currency that you want to sell and convert from
7862
+ :param str toCode: the currency that you want to buy and convert into
7863
+ :param float [amount]: how much you want to trade in units of the from currency
7864
+ :param dict [params]: extra parameters specific to the exchange API endpoint
7865
+ :returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
7866
+ """
7867
+ self.load_markets()
7868
+ request = {
7869
+ 'fromCoin': fromCode.upper(),
7870
+ 'toCoin': toCode.upper(),
7871
+ 'fromCoinSize': self.number_to_string(amount),
7872
+ }
7873
+ response = self.privateConvertGetV2ConvertQuotedPrice(self.extend(request, params))
7874
+ #
7875
+ # {
7876
+ # "code": "00000",
7877
+ # "msg": "success",
7878
+ # "requestTime": 1712121940158,
7879
+ # "data": {
7880
+ # "fromCoin": "USDT",
7881
+ # "fromCoinSize": "5",
7882
+ # "cnvtPrice": "0.9993007892377704",
7883
+ # "toCoin": "USDC",
7884
+ # "toCoinSize": "4.99650394",
7885
+ # "traceId": "1159288930228187140",
7886
+ # "fee": "0"
7887
+ # }
7888
+ # }
7889
+ #
7890
+ data = self.safe_dict(response, 'data', {})
7891
+ fromCurrencyId = self.safe_string(data, 'fromCoin', fromCode)
7892
+ fromCurrency = self.currency(fromCurrencyId)
7893
+ toCurrencyId = self.safe_string(data, 'toCoin', toCode)
7894
+ toCurrency = self.currency(toCurrencyId)
7895
+ return self.parse_conversion(data, fromCurrency, toCurrency)
7896
+
7897
+ def parse_conversion(self, conversion, fromCurrency: Currency = None, toCurrency: Currency = None) -> Conversion:
7898
+ #
7899
+ # fetchConvertQuote
7900
+ #
7901
+ # {
7902
+ # "fromCoin": "USDT",
7903
+ # "fromCoinSize": "5",
7904
+ # "cnvtPrice": "0.9993007892377704",
7905
+ # "toCoin": "USDC",
7906
+ # "toCoinSize": "4.99650394",
7907
+ # "traceId": "1159288930228187140",
7908
+ # "fee": "0"
7909
+ # }
7910
+ #
7911
+ timestamp = self.safe_integer(conversion, 'ts')
7912
+ fromCoin = self.safe_string(conversion, 'fromCoin')
7913
+ fromCode = self.safe_currency_code(fromCoin, fromCurrency)
7914
+ to = self.safe_string(conversion, 'toCoin')
7915
+ toCode = self.safe_currency_code(to, toCurrency)
7916
+ return {
7917
+ 'info': conversion,
7918
+ 'timestamp': timestamp,
7919
+ 'datetime': self.iso8601(timestamp),
7920
+ 'id': self.safe_string(conversion, 'traceId'),
7921
+ 'fromCurrency': fromCode,
7922
+ 'fromAmount': self.safe_number(conversion, 'fromCoinSize'),
7923
+ 'toCurrency': toCode,
7924
+ 'toAmount': self.safe_number(conversion, 'toCoinSize'),
7925
+ 'price': self.safe_number(conversion, 'cnvtPrice'),
7926
+ 'fee': self.safe_number(conversion, 'fee'),
7927
+ }
7928
+
7929
+ def fetch_convert_currencies(self, params={}) -> Currencies:
7930
+ """
7931
+ fetches all available currencies that can be converted
7932
+ :see: https://www.bitget.com/api-doc/common/convert/Get-Convert-Currencies
7933
+ :param dict [params]: extra parameters specific to the exchange API endpoint
7934
+ :returns dict: an associative dictionary of currencies
7935
+ """
7936
+ self.load_markets()
7937
+ response = self.privateConvertGetV2ConvertCurrencies(params)
7938
+ #
7939
+ # {
7940
+ # "code": "00000",
7941
+ # "msg": "success",
7942
+ # "requestTime": 1712121755897,
7943
+ # "data": [
7944
+ # {
7945
+ # "coin": "BTC",
7946
+ # "available": "0.00009850",
7947
+ # "maxAmount": "0.756266",
7948
+ # "minAmount": "0.00001"
7949
+ # },
7950
+ # ]
7951
+ # }
7952
+ #
7953
+ result = {}
7954
+ data = self.safe_list(response, 'data', [])
7955
+ for i in range(0, len(data)):
7956
+ entry = data[i]
7957
+ id = self.safe_string(entry, 'coin')
7958
+ code = self.safe_currency_code(id)
7959
+ result[code] = {
7960
+ 'info': entry,
7961
+ 'id': id,
7962
+ 'code': code,
7963
+ 'networks': None,
7964
+ 'type': None,
7965
+ 'name': None,
7966
+ 'active': None,
7967
+ 'deposit': None,
7968
+ 'withdraw': self.safe_number(entry, 'available'),
7969
+ 'fee': None,
7970
+ 'precision': None,
7971
+ 'limits': {
7972
+ 'amount': {
7973
+ 'min': self.safe_number(entry, 'minAmount'),
7974
+ 'max': self.safe_number(entry, 'maxAmount'),
7975
+ },
7976
+ 'withdraw': {
7977
+ 'min': None,
7978
+ 'max': None,
7979
+ },
7980
+ 'deposit': {
7981
+ 'min': None,
7982
+ 'max': None,
7983
+ },
7984
+ },
7985
+ 'created': None,
7986
+ }
7987
+ return result
7988
+
7855
7989
  def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
7856
7990
  if not response:
7857
7991
  return None # fallback to default error handler
ccxt/coinex.py CHANGED
@@ -3856,33 +3856,6 @@ class coinex(Exchange, ImplicitAPI):
3856
3856
  data = self.safe_value(response, 'data', {})
3857
3857
  return self.parse_leverage_tiers(data, symbols, None)
3858
3858
 
3859
- def parse_leverage_tiers(self, response, symbols: Strings = None, marketIdKey=None):
3860
- #
3861
- # {
3862
- # "BTCUSD": [
3863
- # ["500001", "100", "0.005"],
3864
- # ["1000001", "50", "0.01"],
3865
- # ["2000001", "30", "0.015"],
3866
- # ["5000001", "20", "0.02"],
3867
- # ["10000001", "15", "0.025"],
3868
- # ["20000001", "10", "0.03"]
3869
- # ],
3870
- # ...
3871
- # }
3872
- #
3873
- tiers = {}
3874
- marketIds = list(response.keys())
3875
- for i in range(0, len(marketIds)):
3876
- marketId = marketIds[i]
3877
- market = self.safe_market(marketId, None, None, 'spot')
3878
- symbol = self.safe_string(market, 'symbol')
3879
- symbolsLength = 0
3880
- if symbols is not None:
3881
- symbolsLength = len(symbols)
3882
- if symbol is not None and (symbolsLength == 0 or self.in_array(symbols, symbol)):
3883
- tiers[symbol] = self.parse_market_leverage_tiers(response[marketId], market)
3884
- return tiers
3885
-
3886
3859
  def parse_market_leverage_tiers(self, item, market: Market = None):
3887
3860
  tiers = []
3888
3861
  minNotional = 0
ccxt/digifinex.py CHANGED
@@ -3518,51 +3518,7 @@ class digifinex(Exchange, ImplicitAPI):
3518
3518
  #
3519
3519
  data = self.safe_value(response, 'data', [])
3520
3520
  symbols = self.market_symbols(symbols)
3521
- return self.parse_leverage_tiers(data, symbols, 'symbol')
3522
-
3523
- def parse_leverage_tiers(self, response, symbols: Strings = None, marketIdKey=None):
3524
- #
3525
- # [
3526
- # {
3527
- # "instrument_id": "BTCUSDTPERP",
3528
- # "type": "REAL",
3529
- # "contract_type": "PERPETUAL",
3530
- # "base_currency": "BTC",
3531
- # "quote_currency": "USDT",
3532
- # "clear_currency": "USDT",
3533
- # "contract_value": "0.001",
3534
- # "contract_value_currency": "BTC",
3535
- # "is_inverse": False,
3536
- # "is_trading": True,
3537
- # "status": "ONLINE",
3538
- # "price_precision": 1,
3539
- # "tick_size": "0.1",
3540
- # "min_order_amount": 1,
3541
- # "open_max_limits": [
3542
- # {
3543
- # "leverage": "50",
3544
- # "max_limit": "1000000"
3545
- # }
3546
- # ]
3547
- # },
3548
- # ]
3549
- #
3550
- tiers = {}
3551
- result = {}
3552
- for i in range(0, len(response)):
3553
- entry = response[i]
3554
- marketId = self.safe_string(entry, 'instrument_id')
3555
- market = self.safe_market(marketId)
3556
- symbol = self.safe_symbol(marketId, market)
3557
- symbolsLength = 0
3558
- tiers[symbol] = self.parse_market_leverage_tiers(response[i], market)
3559
- if symbols is not None:
3560
- symbolsLength = len(symbols)
3561
- if self.in_array(symbol, symbols):
3562
- result[symbol] = self.parse_market_leverage_tiers(response[i], market)
3563
- if symbol is not None and (symbolsLength == 0 or self.in_array(symbols, symbol)):
3564
- result[symbol] = self.parse_market_leverage_tiers(response[i], market)
3565
- return result
3521
+ return self.parse_leverage_tiers(data, symbols, 'instrument_id')
3566
3522
 
3567
3523
  def fetch_market_leverage_tiers(self, symbol: str, params={}):
3568
3524
  """