ccxt 4.2.90__py2.py3-none-any.whl → 4.2.91__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 CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '4.2.90'
25
+ __version__ = '4.2.91'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.2.90'
7
+ __version__ = '4.2.91'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.2.90'
5
+ __version__ = '4.2.91'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -338,6 +338,7 @@ class coinbase(Exchange, ImplicitAPI):
338
338
  'CGLD': 'CELO',
339
339
  },
340
340
  'options': {
341
+ 'brokerId': 'ccxt',
341
342
  'stablePairs': ['BUSD-USD', 'CBETH-ETH', 'DAI-USD', 'GUSD-USD', 'GYEN-USD', 'PAX-USD', 'PAX-USDT', 'USDC-EUR', 'USDC-GBP', 'USDT-EUR', 'USDT-GBP', 'USDT-USD', 'USDT-USDC', 'WBTC-BTC'],
342
343
  'fetchCurrencies': {
343
344
  'expires': 5000,
@@ -2252,8 +2253,9 @@ class coinbase(Exchange, ImplicitAPI):
2252
2253
  """
2253
2254
  await self.load_markets()
2254
2255
  market = self.market(symbol)
2256
+ id = self.safe_string(self.options, 'brokerId', 'ccxt')
2255
2257
  request = {
2256
- 'client_order_id': self.uuid(),
2258
+ 'client_order_id': id + '-' + self.uuid(),
2257
2259
  'product_id': market['id'],
2258
2260
  'side': side.upper(),
2259
2261
  }
@@ -445,6 +445,7 @@ class gemini(Exchange, ImplicitAPI):
445
445
  # '</tr>'
446
446
  # ]
447
447
  marketId = cells[0].replace('<td>', '')
448
+ marketId = marketId.replace('*', '')
448
449
  # base = self.safe_currency_code(baseId)
449
450
  minAmountString = cells[1].replace('<td>', '')
450
451
  minAmountParts = minAmountString.split(' ')
@@ -609,9 +609,7 @@ class kraken(Exchange, ImplicitAPI):
609
609
  if currencyId is not None:
610
610
  if len(currencyId) > 3:
611
611
  if (currencyId.find('X') == 0) or (currencyId.find('Z') == 0):
612
- if currencyId.find('.') > 0:
613
- return super(kraken, self).safe_currency(currencyId, currency)
614
- else:
612
+ if not (currencyId.find('.') > 0):
615
613
  currencyId = currencyId[1:]
616
614
  return super(kraken, self).safe_currency(currencyId, currency)
617
615
 
@@ -653,8 +651,13 @@ class kraken(Exchange, ImplicitAPI):
653
651
  # {
654
652
  # "error": [],
655
653
  # "result": {
656
- # "ADA": {"aclass": "currency", "altname": "ADA", "decimals": 8, "display_decimals": 6},
657
- # "BCH": {"aclass": "currency", "altname": "BCH", "decimals": 10, "display_decimals": 5},
654
+ # "BCH": {
655
+ # "aclass": "currency",
656
+ # "altname": "BCH",
657
+ # "decimals": 10,
658
+ # "display_decimals": 5
659
+ # "status": "enabled",
660
+ # },
658
661
  # ...
659
662
  # },
660
663
  # }
@@ -669,15 +672,15 @@ class kraken(Exchange, ImplicitAPI):
669
672
  # see: https://support.kraken.com/hc/en-us/articles/201893608-What-are-the-withdrawal-fees-
670
673
  # to add support for multiple withdrawal/deposit methods and
671
674
  # differentiated fees for each particular method
672
- code = self.safe_currency_code(self.safe_string(currency, 'altname'))
675
+ code = self.safe_currency_code(id)
673
676
  precision = self.parse_number(self.parse_precision(self.safe_string(currency, 'decimals')))
674
677
  # assumes all currencies are active except those listed above
675
- active = not self.in_array(code, self.options['inactiveCurrencies'])
678
+ active = self.safe_string(currency, 'status') == 'enabled'
676
679
  result[code] = {
677
680
  'id': id,
678
681
  'code': code,
679
682
  'info': currency,
680
- 'name': code,
683
+ 'name': self.safe_string(currency, 'altname'),
681
684
  'active': active,
682
685
  'deposit': None,
683
686
  'withdraw': None,
ccxt/async_support/okx.py CHANGED
@@ -1236,7 +1236,7 @@ class okx(Exchange, ImplicitAPI):
1236
1236
  # ]
1237
1237
  # }
1238
1238
  #
1239
- data = self.safe_value(response, 'data', [])
1239
+ data = self.safe_list(response, 'data', [])
1240
1240
  dataLength = len(data)
1241
1241
  update = {
1242
1242
  'updated': None,
@@ -1277,8 +1277,8 @@ class okx(Exchange, ImplicitAPI):
1277
1277
  # "msg": ""
1278
1278
  # }
1279
1279
  #
1280
- data = self.safe_value(response, 'data', [])
1281
- first = self.safe_value(data, 0, {})
1280
+ data = self.safe_list(response, 'data', [])
1281
+ first = self.safe_dict(data, 0, {})
1282
1282
  return self.safe_integer(first, 'ts')
1283
1283
 
1284
1284
  async def fetch_accounts(self, params={}) -> List[Account]:
@@ -1308,7 +1308,7 @@ class okx(Exchange, ImplicitAPI):
1308
1308
  # "msg": ""
1309
1309
  # }
1310
1310
  #
1311
- data = self.safe_value(response, 'data', [])
1311
+ data = self.safe_list(response, 'data', [])
1312
1312
  result = []
1313
1313
  for i in range(0, len(data)):
1314
1314
  account = data[i]
@@ -1330,7 +1330,7 @@ class okx(Exchange, ImplicitAPI):
1330
1330
  :param dict [params]: extra parameters specific to the exchange API endpoint
1331
1331
  :returns dict[]: an array of objects representing market data
1332
1332
  """
1333
- types = self.safe_value(self.options, 'fetchMarkets')
1333
+ types = self.safe_list(self.options, 'fetchMarkets', [])
1334
1334
  promises = []
1335
1335
  result = []
1336
1336
  for i in range(0, len(types)):
@@ -1427,7 +1427,7 @@ class okx(Exchange, ImplicitAPI):
1427
1427
  symbol = symbol + '-' + ymd + '-' + strikePrice + '-' + optionType
1428
1428
  optionType = 'put' if (optionType == 'P') else 'call'
1429
1429
  tickSize = self.safe_string(market, 'tickSz')
1430
- fees = self.safe_value_2(self.fees, type, 'trading', {})
1430
+ fees = self.safe_dict_2(self.fees, type, 'trading', {})
1431
1431
  maxLeverage = self.safe_string(market, 'lever', '1')
1432
1432
  maxLeverage = Precise.string_max(maxLeverage, '1')
1433
1433
  maxSpotCost = self.safe_number(market, 'maxMktSz')
@@ -1486,7 +1486,7 @@ class okx(Exchange, ImplicitAPI):
1486
1486
  'instType': self.convert_to_instrument_type(type),
1487
1487
  }
1488
1488
  if type == 'option':
1489
- optionsUnderlying = self.safe_value(self.options, 'defaultUnderlying', ['BTC-USD', 'ETH-USD'])
1489
+ optionsUnderlying = self.safe_list(self.options, 'defaultUnderlying', ['BTC-USD', 'ETH-USD'])
1490
1490
  promises = []
1491
1491
  for i in range(0, len(optionsUnderlying)):
1492
1492
  underlying = optionsUnderlying[i]
@@ -1495,8 +1495,8 @@ class okx(Exchange, ImplicitAPI):
1495
1495
  promisesResult = await asyncio.gather(*promises)
1496
1496
  markets = []
1497
1497
  for i in range(0, len(promisesResult)):
1498
- res = self.safe_value(promisesResult, i, {})
1499
- options = self.safe_value(res, 'data', [])
1498
+ res = self.safe_dict(promisesResult, i, {})
1499
+ options = self.safe_list(res, 'data', [])
1500
1500
  markets = self.array_concat(markets, options)
1501
1501
  return self.parse_markets(markets)
1502
1502
  response = await self.publicGetPublicInstruments(self.extend(request, params))
@@ -1533,7 +1533,7 @@ class okx(Exchange, ImplicitAPI):
1533
1533
  # "msg": ""
1534
1534
  # }
1535
1535
  #
1536
- dataResponse = self.safe_value(response, 'data', [])
1536
+ dataResponse = self.safe_list(response, 'data', [])
1537
1537
  return self.parse_markets(dataResponse)
1538
1538
 
1539
1539
  def safe_network(self, networkId):
@@ -1607,7 +1607,7 @@ class okx(Exchange, ImplicitAPI):
1607
1607
  # "msg": ""
1608
1608
  # }
1609
1609
  #
1610
- data = self.safe_value(response, 'data', [])
1610
+ data = self.safe_list(response, 'data', [])
1611
1611
  result = {}
1612
1612
  dataByCurrencyId = self.group_by(data, 'ccy')
1613
1613
  currencyIds = list(dataByCurrencyId.keys())
@@ -1623,11 +1623,11 @@ class okx(Exchange, ImplicitAPI):
1623
1623
  maxPrecision = None
1624
1624
  for j in range(0, len(chains)):
1625
1625
  chain = chains[j]
1626
- canDeposit = self.safe_value(chain, 'canDep')
1626
+ canDeposit = self.safe_bool(chain, 'canDep')
1627
1627
  depositEnabled = canDeposit if (canDeposit) else depositEnabled
1628
- canWithdraw = self.safe_value(chain, 'canWd')
1628
+ canWithdraw = self.safe_bool(chain, 'canWd')
1629
1629
  withdrawEnabled = canWithdraw if (canWithdraw) else withdrawEnabled
1630
- canInternal = self.safe_value(chain, 'canInternal')
1630
+ canInternal = self.safe_bool(chain, 'canInternal')
1631
1631
  active = True if (canDeposit and canWithdraw and canInternal) else False
1632
1632
  currencyActive = active if (active) else currencyActive
1633
1633
  networkId = self.safe_string(chain, 'chain')
@@ -1656,7 +1656,7 @@ class okx(Exchange, ImplicitAPI):
1656
1656
  },
1657
1657
  'info': chain,
1658
1658
  }
1659
- firstChain = self.safe_value(chains, 0)
1659
+ firstChain = self.safe_dict(chains, 0, {})
1660
1660
  result[code] = {
1661
1661
  'info': None,
1662
1662
  'code': code,
@@ -1725,8 +1725,8 @@ class okx(Exchange, ImplicitAPI):
1725
1725
  # ]
1726
1726
  # }
1727
1727
  #
1728
- data = self.safe_value(response, 'data', [])
1729
- first = self.safe_value(data, 0, {})
1728
+ data = self.safe_list(response, 'data', [])
1729
+ first = self.safe_dict(data, 0, {})
1730
1730
  timestamp = self.safe_integer(first, 'ts')
1731
1731
  return self.parse_order_book(first, symbol, timestamp)
1732
1732
 
@@ -1825,7 +1825,7 @@ class okx(Exchange, ImplicitAPI):
1825
1825
  # ]
1826
1826
  # }
1827
1827
  #
1828
- data = self.safe_value(response, 'data', [])
1828
+ data = self.safe_list(response, 'data', [])
1829
1829
  first = self.safe_dict(data, 0, {})
1830
1830
  return self.parse_ticker(first, market)
1831
1831
 
@@ -1846,7 +1846,7 @@ class okx(Exchange, ImplicitAPI):
1846
1846
  'instType': self.convert_to_instrument_type(marketType),
1847
1847
  }
1848
1848
  if marketType == 'option':
1849
- defaultUnderlying = self.safe_value(self.options, 'defaultUnderlying', 'BTC-USD')
1849
+ defaultUnderlying = self.safe_string(self.options, 'defaultUnderlying', 'BTC-USD')
1850
1850
  currencyId = self.safe_string_2(params, 'uly', 'marketId', defaultUnderlying)
1851
1851
  if currencyId is None:
1852
1852
  raise ArgumentsRequired(self.id + ' fetchTickers() requires an underlying uly or marketId parameter for options markets')
@@ -2095,7 +2095,7 @@ class okx(Exchange, ImplicitAPI):
2095
2095
  return await self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 200)
2096
2096
  price = self.safe_string(params, 'price')
2097
2097
  params = self.omit(params, 'price')
2098
- options = self.safe_value(self.options, 'fetchOHLCV', {})
2098
+ options = self.safe_dict(self.options, 'fetchOHLCV', {})
2099
2099
  timezone = self.safe_string(options, 'timezone', 'UTC')
2100
2100
  if limit is None:
2101
2101
  limit = 100 # default 100, max 100
@@ -2208,7 +2208,7 @@ class okx(Exchange, ImplicitAPI):
2208
2208
  # }
2209
2209
  #
2210
2210
  rates = []
2211
- data = self.safe_value(response, 'data', [])
2211
+ data = self.safe_list(response, 'data', [])
2212
2212
  for i in range(0, len(data)):
2213
2213
  rate = data[i]
2214
2214
  timestamp = self.safe_integer(rate, 'fundingTime')
@@ -2230,10 +2230,10 @@ class okx(Exchange, ImplicitAPI):
2230
2230
 
2231
2231
  def parse_trading_balance(self, response):
2232
2232
  result = {'info': response}
2233
- data = self.safe_value(response, 'data', [])
2234
- first = self.safe_value(data, 0, {})
2233
+ data = self.safe_list(response, 'data', [])
2234
+ first = self.safe_dict(data, 0, {})
2235
2235
  timestamp = self.safe_integer(first, 'uTime')
2236
- details = self.safe_value(first, 'details', [])
2236
+ details = self.safe_list(first, 'details', [])
2237
2237
  for i in range(0, len(details)):
2238
2238
  balance = details[i]
2239
2239
  currencyId = self.safe_string(balance, 'ccy')
@@ -2255,7 +2255,7 @@ class okx(Exchange, ImplicitAPI):
2255
2255
 
2256
2256
  def parse_funding_balance(self, response):
2257
2257
  result = {'info': response}
2258
- data = self.safe_value(response, 'data', [])
2258
+ data = self.safe_list(response, 'data', [])
2259
2259
  for i in range(0, len(data)):
2260
2260
  balance = data[i]
2261
2261
  currencyId = self.safe_string(balance, 'ccy')
@@ -2333,8 +2333,8 @@ class okx(Exchange, ImplicitAPI):
2333
2333
  # "msg": ""
2334
2334
  # }
2335
2335
  #
2336
- data = self.safe_value(response, 'data', [])
2337
- first = self.safe_value(data, 0, {})
2336
+ data = self.safe_list(response, 'data', [])
2337
+ first = self.safe_dict(data, 0, {})
2338
2338
  return self.parse_trading_fee(first, market)
2339
2339
 
2340
2340
  async def fetch_balance(self, params={}) -> Balances:
@@ -2748,8 +2748,8 @@ class okx(Exchange, ImplicitAPI):
2748
2748
  response = await self.privatePostTradeOrderAlgo(request)
2749
2749
  else:
2750
2750
  response = await self.privatePostTradeBatchOrders(request)
2751
- data = self.safe_value(response, 'data', [])
2752
- first = self.safe_value(data, 0)
2751
+ data = self.safe_list(response, 'data', [])
2752
+ first = self.safe_dict(data, 0, {})
2753
2753
  order = self.parse_order(first, market)
2754
2754
  order['type'] = type
2755
2755
  order['side'] = side
@@ -4128,7 +4128,7 @@ class okx(Exchange, ImplicitAPI):
4128
4128
  # ]
4129
4129
  # }
4130
4130
  #
4131
- data = self.safe_value(response, 'data', [])
4131
+ data = self.safe_list(response, 'data', [])
4132
4132
  return self.parse_ledger(data, currency, since, limit)
4133
4133
 
4134
4134
  def parse_ledger_entry_type(self, type):
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.2.90'
7
+ __version__ = '4.2.91'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2303,7 +2303,7 @@ class Exchange(object):
2303
2303
  def parse_to_int(self, number):
2304
2304
  # Solve Common intmisuse ex: int((since / str(1000)))
2305
2305
  # using a number which is not valid in ts
2306
- stringifiedNumber = str(number)
2306
+ stringifiedNumber = self.number_to_string(number)
2307
2307
  convertedNumber = float(stringifiedNumber)
2308
2308
  return int(convertedNumber)
2309
2309
 
@@ -4426,12 +4426,6 @@ class Exchange(object):
4426
4426
  def common_currency_code(self, code: str):
4427
4427
  if not self.substituteCommonCurrencyCodes:
4428
4428
  return code
4429
- # if the provided code already exists value in commonCurrencies dict, then we should not again transform it
4430
- # more details at: https://github.com/ccxt/ccxt/issues/21112#issuecomment-2031293691
4431
- commonCurrencies = list(self.commonCurrencies.values())
4432
- exists = self.in_array(code, commonCurrencies)
4433
- if exists:
4434
- return code
4435
4429
  return self.safe_string(self.commonCurrencies, code, code)
4436
4430
 
4437
4431
  def currency(self, code: str):
@@ -4985,7 +4979,6 @@ class Exchange(object):
4985
4979
  :returns dict: objects with withdraw and deposit fees, indexed by currency codes
4986
4980
  """
4987
4981
  depositWithdrawFees = {}
4988
- codes = self.marketCodes(codes)
4989
4982
  isArray = isinstance(response, list)
4990
4983
  responseKeys = response
4991
4984
  if not isArray:
ccxt/coinbase.py CHANGED
@@ -337,6 +337,7 @@ class coinbase(Exchange, ImplicitAPI):
337
337
  'CGLD': 'CELO',
338
338
  },
339
339
  'options': {
340
+ 'brokerId': 'ccxt',
340
341
  'stablePairs': ['BUSD-USD', 'CBETH-ETH', 'DAI-USD', 'GUSD-USD', 'GYEN-USD', 'PAX-USD', 'PAX-USDT', 'USDC-EUR', 'USDC-GBP', 'USDT-EUR', 'USDT-GBP', 'USDT-USD', 'USDT-USDC', 'WBTC-BTC'],
341
342
  'fetchCurrencies': {
342
343
  'expires': 5000,
@@ -2251,8 +2252,9 @@ class coinbase(Exchange, ImplicitAPI):
2251
2252
  """
2252
2253
  self.load_markets()
2253
2254
  market = self.market(symbol)
2255
+ id = self.safe_string(self.options, 'brokerId', 'ccxt')
2254
2256
  request = {
2255
- 'client_order_id': self.uuid(),
2257
+ 'client_order_id': id + '-' + self.uuid(),
2256
2258
  'product_id': market['id'],
2257
2259
  'side': side.upper(),
2258
2260
  }
ccxt/gemini.py CHANGED
@@ -444,6 +444,7 @@ class gemini(Exchange, ImplicitAPI):
444
444
  # '</tr>'
445
445
  # ]
446
446
  marketId = cells[0].replace('<td>', '')
447
+ marketId = marketId.replace('*', '')
447
448
  # base = self.safe_currency_code(baseId)
448
449
  minAmountString = cells[1].replace('<td>', '')
449
450
  minAmountParts = minAmountString.split(' ')
ccxt/kraken.py CHANGED
@@ -609,9 +609,7 @@ class kraken(Exchange, ImplicitAPI):
609
609
  if currencyId is not None:
610
610
  if len(currencyId) > 3:
611
611
  if (currencyId.find('X') == 0) or (currencyId.find('Z') == 0):
612
- if currencyId.find('.') > 0:
613
- return super(kraken, self).safe_currency(currencyId, currency)
614
- else:
612
+ if not (currencyId.find('.') > 0):
615
613
  currencyId = currencyId[1:]
616
614
  return super(kraken, self).safe_currency(currencyId, currency)
617
615
 
@@ -653,8 +651,13 @@ class kraken(Exchange, ImplicitAPI):
653
651
  # {
654
652
  # "error": [],
655
653
  # "result": {
656
- # "ADA": {"aclass": "currency", "altname": "ADA", "decimals": 8, "display_decimals": 6},
657
- # "BCH": {"aclass": "currency", "altname": "BCH", "decimals": 10, "display_decimals": 5},
654
+ # "BCH": {
655
+ # "aclass": "currency",
656
+ # "altname": "BCH",
657
+ # "decimals": 10,
658
+ # "display_decimals": 5
659
+ # "status": "enabled",
660
+ # },
658
661
  # ...
659
662
  # },
660
663
  # }
@@ -669,15 +672,15 @@ class kraken(Exchange, ImplicitAPI):
669
672
  # see: https://support.kraken.com/hc/en-us/articles/201893608-What-are-the-withdrawal-fees-
670
673
  # to add support for multiple withdrawal/deposit methods and
671
674
  # differentiated fees for each particular method
672
- code = self.safe_currency_code(self.safe_string(currency, 'altname'))
675
+ code = self.safe_currency_code(id)
673
676
  precision = self.parse_number(self.parse_precision(self.safe_string(currency, 'decimals')))
674
677
  # assumes all currencies are active except those listed above
675
- active = not self.in_array(code, self.options['inactiveCurrencies'])
678
+ active = self.safe_string(currency, 'status') == 'enabled'
676
679
  result[code] = {
677
680
  'id': id,
678
681
  'code': code,
679
682
  'info': currency,
680
- 'name': code,
683
+ 'name': self.safe_string(currency, 'altname'),
681
684
  'active': active,
682
685
  'deposit': None,
683
686
  'withdraw': None,
ccxt/okx.py CHANGED
@@ -1235,7 +1235,7 @@ class okx(Exchange, ImplicitAPI):
1235
1235
  # ]
1236
1236
  # }
1237
1237
  #
1238
- data = self.safe_value(response, 'data', [])
1238
+ data = self.safe_list(response, 'data', [])
1239
1239
  dataLength = len(data)
1240
1240
  update = {
1241
1241
  'updated': None,
@@ -1276,8 +1276,8 @@ class okx(Exchange, ImplicitAPI):
1276
1276
  # "msg": ""
1277
1277
  # }
1278
1278
  #
1279
- data = self.safe_value(response, 'data', [])
1280
- first = self.safe_value(data, 0, {})
1279
+ data = self.safe_list(response, 'data', [])
1280
+ first = self.safe_dict(data, 0, {})
1281
1281
  return self.safe_integer(first, 'ts')
1282
1282
 
1283
1283
  def fetch_accounts(self, params={}) -> List[Account]:
@@ -1307,7 +1307,7 @@ class okx(Exchange, ImplicitAPI):
1307
1307
  # "msg": ""
1308
1308
  # }
1309
1309
  #
1310
- data = self.safe_value(response, 'data', [])
1310
+ data = self.safe_list(response, 'data', [])
1311
1311
  result = []
1312
1312
  for i in range(0, len(data)):
1313
1313
  account = data[i]
@@ -1329,7 +1329,7 @@ class okx(Exchange, ImplicitAPI):
1329
1329
  :param dict [params]: extra parameters specific to the exchange API endpoint
1330
1330
  :returns dict[]: an array of objects representing market data
1331
1331
  """
1332
- types = self.safe_value(self.options, 'fetchMarkets')
1332
+ types = self.safe_list(self.options, 'fetchMarkets', [])
1333
1333
  promises = []
1334
1334
  result = []
1335
1335
  for i in range(0, len(types)):
@@ -1426,7 +1426,7 @@ class okx(Exchange, ImplicitAPI):
1426
1426
  symbol = symbol + '-' + ymd + '-' + strikePrice + '-' + optionType
1427
1427
  optionType = 'put' if (optionType == 'P') else 'call'
1428
1428
  tickSize = self.safe_string(market, 'tickSz')
1429
- fees = self.safe_value_2(self.fees, type, 'trading', {})
1429
+ fees = self.safe_dict_2(self.fees, type, 'trading', {})
1430
1430
  maxLeverage = self.safe_string(market, 'lever', '1')
1431
1431
  maxLeverage = Precise.string_max(maxLeverage, '1')
1432
1432
  maxSpotCost = self.safe_number(market, 'maxMktSz')
@@ -1485,7 +1485,7 @@ class okx(Exchange, ImplicitAPI):
1485
1485
  'instType': self.convert_to_instrument_type(type),
1486
1486
  }
1487
1487
  if type == 'option':
1488
- optionsUnderlying = self.safe_value(self.options, 'defaultUnderlying', ['BTC-USD', 'ETH-USD'])
1488
+ optionsUnderlying = self.safe_list(self.options, 'defaultUnderlying', ['BTC-USD', 'ETH-USD'])
1489
1489
  promises = []
1490
1490
  for i in range(0, len(optionsUnderlying)):
1491
1491
  underlying = optionsUnderlying[i]
@@ -1494,8 +1494,8 @@ class okx(Exchange, ImplicitAPI):
1494
1494
  promisesResult = promises
1495
1495
  markets = []
1496
1496
  for i in range(0, len(promisesResult)):
1497
- res = self.safe_value(promisesResult, i, {})
1498
- options = self.safe_value(res, 'data', [])
1497
+ res = self.safe_dict(promisesResult, i, {})
1498
+ options = self.safe_list(res, 'data', [])
1499
1499
  markets = self.array_concat(markets, options)
1500
1500
  return self.parse_markets(markets)
1501
1501
  response = self.publicGetPublicInstruments(self.extend(request, params))
@@ -1532,7 +1532,7 @@ class okx(Exchange, ImplicitAPI):
1532
1532
  # "msg": ""
1533
1533
  # }
1534
1534
  #
1535
- dataResponse = self.safe_value(response, 'data', [])
1535
+ dataResponse = self.safe_list(response, 'data', [])
1536
1536
  return self.parse_markets(dataResponse)
1537
1537
 
1538
1538
  def safe_network(self, networkId):
@@ -1606,7 +1606,7 @@ class okx(Exchange, ImplicitAPI):
1606
1606
  # "msg": ""
1607
1607
  # }
1608
1608
  #
1609
- data = self.safe_value(response, 'data', [])
1609
+ data = self.safe_list(response, 'data', [])
1610
1610
  result = {}
1611
1611
  dataByCurrencyId = self.group_by(data, 'ccy')
1612
1612
  currencyIds = list(dataByCurrencyId.keys())
@@ -1622,11 +1622,11 @@ class okx(Exchange, ImplicitAPI):
1622
1622
  maxPrecision = None
1623
1623
  for j in range(0, len(chains)):
1624
1624
  chain = chains[j]
1625
- canDeposit = self.safe_value(chain, 'canDep')
1625
+ canDeposit = self.safe_bool(chain, 'canDep')
1626
1626
  depositEnabled = canDeposit if (canDeposit) else depositEnabled
1627
- canWithdraw = self.safe_value(chain, 'canWd')
1627
+ canWithdraw = self.safe_bool(chain, 'canWd')
1628
1628
  withdrawEnabled = canWithdraw if (canWithdraw) else withdrawEnabled
1629
- canInternal = self.safe_value(chain, 'canInternal')
1629
+ canInternal = self.safe_bool(chain, 'canInternal')
1630
1630
  active = True if (canDeposit and canWithdraw and canInternal) else False
1631
1631
  currencyActive = active if (active) else currencyActive
1632
1632
  networkId = self.safe_string(chain, 'chain')
@@ -1655,7 +1655,7 @@ class okx(Exchange, ImplicitAPI):
1655
1655
  },
1656
1656
  'info': chain,
1657
1657
  }
1658
- firstChain = self.safe_value(chains, 0)
1658
+ firstChain = self.safe_dict(chains, 0, {})
1659
1659
  result[code] = {
1660
1660
  'info': None,
1661
1661
  'code': code,
@@ -1724,8 +1724,8 @@ class okx(Exchange, ImplicitAPI):
1724
1724
  # ]
1725
1725
  # }
1726
1726
  #
1727
- data = self.safe_value(response, 'data', [])
1728
- first = self.safe_value(data, 0, {})
1727
+ data = self.safe_list(response, 'data', [])
1728
+ first = self.safe_dict(data, 0, {})
1729
1729
  timestamp = self.safe_integer(first, 'ts')
1730
1730
  return self.parse_order_book(first, symbol, timestamp)
1731
1731
 
@@ -1824,7 +1824,7 @@ class okx(Exchange, ImplicitAPI):
1824
1824
  # ]
1825
1825
  # }
1826
1826
  #
1827
- data = self.safe_value(response, 'data', [])
1827
+ data = self.safe_list(response, 'data', [])
1828
1828
  first = self.safe_dict(data, 0, {})
1829
1829
  return self.parse_ticker(first, market)
1830
1830
 
@@ -1845,7 +1845,7 @@ class okx(Exchange, ImplicitAPI):
1845
1845
  'instType': self.convert_to_instrument_type(marketType),
1846
1846
  }
1847
1847
  if marketType == 'option':
1848
- defaultUnderlying = self.safe_value(self.options, 'defaultUnderlying', 'BTC-USD')
1848
+ defaultUnderlying = self.safe_string(self.options, 'defaultUnderlying', 'BTC-USD')
1849
1849
  currencyId = self.safe_string_2(params, 'uly', 'marketId', defaultUnderlying)
1850
1850
  if currencyId is None:
1851
1851
  raise ArgumentsRequired(self.id + ' fetchTickers() requires an underlying uly or marketId parameter for options markets')
@@ -2094,7 +2094,7 @@ class okx(Exchange, ImplicitAPI):
2094
2094
  return self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 200)
2095
2095
  price = self.safe_string(params, 'price')
2096
2096
  params = self.omit(params, 'price')
2097
- options = self.safe_value(self.options, 'fetchOHLCV', {})
2097
+ options = self.safe_dict(self.options, 'fetchOHLCV', {})
2098
2098
  timezone = self.safe_string(options, 'timezone', 'UTC')
2099
2099
  if limit is None:
2100
2100
  limit = 100 # default 100, max 100
@@ -2207,7 +2207,7 @@ class okx(Exchange, ImplicitAPI):
2207
2207
  # }
2208
2208
  #
2209
2209
  rates = []
2210
- data = self.safe_value(response, 'data', [])
2210
+ data = self.safe_list(response, 'data', [])
2211
2211
  for i in range(0, len(data)):
2212
2212
  rate = data[i]
2213
2213
  timestamp = self.safe_integer(rate, 'fundingTime')
@@ -2229,10 +2229,10 @@ class okx(Exchange, ImplicitAPI):
2229
2229
 
2230
2230
  def parse_trading_balance(self, response):
2231
2231
  result = {'info': response}
2232
- data = self.safe_value(response, 'data', [])
2233
- first = self.safe_value(data, 0, {})
2232
+ data = self.safe_list(response, 'data', [])
2233
+ first = self.safe_dict(data, 0, {})
2234
2234
  timestamp = self.safe_integer(first, 'uTime')
2235
- details = self.safe_value(first, 'details', [])
2235
+ details = self.safe_list(first, 'details', [])
2236
2236
  for i in range(0, len(details)):
2237
2237
  balance = details[i]
2238
2238
  currencyId = self.safe_string(balance, 'ccy')
@@ -2254,7 +2254,7 @@ class okx(Exchange, ImplicitAPI):
2254
2254
 
2255
2255
  def parse_funding_balance(self, response):
2256
2256
  result = {'info': response}
2257
- data = self.safe_value(response, 'data', [])
2257
+ data = self.safe_list(response, 'data', [])
2258
2258
  for i in range(0, len(data)):
2259
2259
  balance = data[i]
2260
2260
  currencyId = self.safe_string(balance, 'ccy')
@@ -2332,8 +2332,8 @@ class okx(Exchange, ImplicitAPI):
2332
2332
  # "msg": ""
2333
2333
  # }
2334
2334
  #
2335
- data = self.safe_value(response, 'data', [])
2336
- first = self.safe_value(data, 0, {})
2335
+ data = self.safe_list(response, 'data', [])
2336
+ first = self.safe_dict(data, 0, {})
2337
2337
  return self.parse_trading_fee(first, market)
2338
2338
 
2339
2339
  def fetch_balance(self, params={}) -> Balances:
@@ -2747,8 +2747,8 @@ class okx(Exchange, ImplicitAPI):
2747
2747
  response = self.privatePostTradeOrderAlgo(request)
2748
2748
  else:
2749
2749
  response = self.privatePostTradeBatchOrders(request)
2750
- data = self.safe_value(response, 'data', [])
2751
- first = self.safe_value(data, 0)
2750
+ data = self.safe_list(response, 'data', [])
2751
+ first = self.safe_dict(data, 0, {})
2752
2752
  order = self.parse_order(first, market)
2753
2753
  order['type'] = type
2754
2754
  order['side'] = side
@@ -4127,7 +4127,7 @@ class okx(Exchange, ImplicitAPI):
4127
4127
  # ]
4128
4128
  # }
4129
4129
  #
4130
- data = self.safe_value(response, 'data', [])
4130
+ data = self.safe_list(response, 'data', [])
4131
4131
  return self.parse_ledger(data, currency, since, limit)
4132
4132
 
4133
4133
  def parse_ledger_entry_type(self, type):
ccxt/pro/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.2.90'
7
+ __version__ = '4.2.91'
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10