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/bitbns.py CHANGED
@@ -226,11 +226,11 @@ class bitbns(Exchange, ImplicitAPI):
226
226
  quoteId = self.safe_string(market, 'quote')
227
227
  base = self.safe_currency_code(baseId)
228
228
  quote = self.safe_currency_code(quoteId)
229
- marketPrecision = self.safe_value(market, 'precision', {})
230
- marketLimits = self.safe_value(market, 'limits', {})
231
- amountLimits = self.safe_value(marketLimits, 'amount', {})
232
- priceLimits = self.safe_value(marketLimits, 'price', {})
233
- costLimits = self.safe_value(marketLimits, 'cost', {})
229
+ marketPrecision = self.safe_dict(market, 'precision', {})
230
+ marketLimits = self.safe_dict(market, 'limits', {})
231
+ amountLimits = self.safe_dict(marketLimits, 'amount', {})
232
+ priceLimits = self.safe_dict(marketLimits, 'price', {})
233
+ costLimits = self.safe_dict(marketLimits, 'cost', {})
234
234
  usdt = (quoteId == 'USDT')
235
235
  # INR markets don't need a _INR prefix
236
236
  uppercaseId = (baseId + '_' + quoteId) if usdt else baseId
@@ -430,7 +430,7 @@ class bitbns(Exchange, ImplicitAPI):
430
430
  'timestamp': timestamp,
431
431
  'datetime': self.iso8601(timestamp),
432
432
  }
433
- data = self.safe_value(response, 'data', {})
433
+ data = self.safe_dict(response, 'data', {})
434
434
  keys = list(data.keys())
435
435
  for i in range(0, len(keys)):
436
436
  key = keys[i]
@@ -637,7 +637,7 @@ class bitbns(Exchange, ImplicitAPI):
637
637
  raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
638
638
  self.load_markets()
639
639
  market = self.market(symbol)
640
- isTrigger = self.safe_value_2(params, 'trigger', 'stop')
640
+ isTrigger = self.safe_bool_2(params, 'trigger', 'stop')
641
641
  params = self.omit(params, ['trigger', 'stop'])
642
642
  request: dict = {
643
643
  'entry_id': id,
@@ -668,7 +668,7 @@ class bitbns(Exchange, ImplicitAPI):
668
668
  'symbol': market['id'],
669
669
  'entry_id': id,
670
670
  }
671
- trigger = self.safe_value_2(params, 'trigger', 'stop')
671
+ trigger = self.safe_bool_2(params, 'trigger', 'stop')
672
672
  if trigger:
673
673
  raise BadRequest(self.id + ' fetchOrder cannot fetch stop orders')
674
674
  response = self.v1PostOrderStatusSymbol(self.extend(request, params))
@@ -697,7 +697,7 @@ class bitbns(Exchange, ImplicitAPI):
697
697
  # "code":200
698
698
  # }
699
699
  #
700
- data = self.safe_value(response, 'data', [])
700
+ data = self.safe_list(response, 'data', [])
701
701
  first = self.safe_dict(data, 0)
702
702
  return self.parse_order(first, market)
703
703
 
@@ -717,7 +717,7 @@ class bitbns(Exchange, ImplicitAPI):
717
717
  raise ArgumentsRequired(self.id + ' fetchOpenOrders() requires a symbol argument')
718
718
  self.load_markets()
719
719
  market = self.market(symbol)
720
- isTrigger = self.safe_value_2(params, 'trigger', 'stop')
720
+ isTrigger = self.safe_bool_2(params, 'trigger', 'stop')
721
721
  params = self.omit(params, ['trigger', 'stop'])
722
722
  quoteSide = 'usdtListOpen' if (market['quoteId'] == 'USDT') else 'listOpen'
723
723
  request: dict = {
@@ -1000,7 +1000,7 @@ class bitbns(Exchange, ImplicitAPI):
1000
1000
  '6': 'ok', # Completed
1001
1001
  },
1002
1002
  }
1003
- statuses = self.safe_value(statusesByType, type, {})
1003
+ statuses = self.safe_dict(statusesByType, type, {})
1004
1004
  return self.safe_string(statuses, status, status)
1005
1005
 
1006
1006
  def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
@@ -1090,7 +1090,7 @@ class bitbns(Exchange, ImplicitAPI):
1090
1090
  # "error":null
1091
1091
  # }
1092
1092
  #
1093
- data = self.safe_value(response, 'data', {})
1093
+ data = self.safe_dict(response, 'data', {})
1094
1094
  address = self.safe_string(data, 'token')
1095
1095
  tag = self.safe_string(data, 'tag')
1096
1096
  self.check_address(address)
ccxt/bitfinex.py CHANGED
@@ -434,7 +434,7 @@ class bitfinex(Exchange, ImplicitAPI):
434
434
  # }
435
435
  # }
436
436
  #
437
- fees = self.safe_value(response, 'withdraw')
437
+ fees = self.safe_dict(response, 'withdraw', {})
438
438
  ids = list(fees.keys())
439
439
  for i in range(0, len(ids)):
440
440
  id = ids[i]
@@ -535,7 +535,7 @@ class bitfinex(Exchange, ImplicitAPI):
535
535
  # }
536
536
  #
537
537
  result: dict = {}
538
- fiat = self.safe_value(self.options, 'fiat', {})
538
+ fiat = self.safe_dict(self.options, 'fiat', {})
539
539
  makerFee = self.safe_number(response, 'maker_fee')
540
540
  takerFee = self.safe_number(response, 'taker_fee')
541
541
  makerFee2Fiat = self.safe_number(response, 'maker_fee_2fiat')
@@ -624,7 +624,7 @@ class bitfinex(Exchange, ImplicitAPI):
624
624
  'settleId': None,
625
625
  'type': type,
626
626
  'spot': (type == 'spot'),
627
- 'margin': self.safe_value(market, 'margin'),
627
+ 'margin': self.safe_bool(market, 'margin'),
628
628
  'swap': (type == 'swap'),
629
629
  'future': False,
630
630
  'option': False,
@@ -691,7 +691,7 @@ class bitfinex(Exchange, ImplicitAPI):
691
691
  :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
692
692
  """
693
693
  self.load_markets()
694
- accountsByType = self.safe_value(self.options, 'accountsByType', {})
694
+ accountsByType = self.safe_dict(self.options, 'accountsByType', {})
695
695
  requestedType = self.safe_string(params, 'type', 'exchange')
696
696
  accountType = self.safe_string(accountsByType, requestedType, requestedType)
697
697
  if accountType is None:
@@ -749,7 +749,7 @@ class bitfinex(Exchange, ImplicitAPI):
749
749
  # transferring between derivatives wallet and regular wallet is not documented in their API
750
750
  # however we support it in CCXT(from just looking at web inspector)
751
751
  self.load_markets()
752
- accountsByType = self.safe_value(self.options, 'accountsByType', {})
752
+ accountsByType = self.safe_dict(self.options, 'accountsByType', {})
753
753
  fromId = self.safe_string(accountsByType, fromAccount, fromAccount)
754
754
  toId = self.safe_string(accountsByType, toAccount, toAccount)
755
755
  currency = self.currency(code)
@@ -1190,8 +1190,8 @@ class bitfinex(Exchange, ImplicitAPI):
1190
1190
  # }
1191
1191
  #
1192
1192
  side = self.safe_string(order, 'side')
1193
- open = self.safe_value(order, 'is_live')
1194
- canceled = self.safe_value(order, 'is_cancelled')
1193
+ open = self.safe_bool(order, 'is_live')
1194
+ canceled = self.safe_bool(order, 'is_cancelled')
1195
1195
  status = None
1196
1196
  if open:
1197
1197
  status = 'open'
@@ -1563,7 +1563,7 @@ class bitfinex(Exchange, ImplicitAPI):
1563
1563
  # }
1564
1564
  # ]
1565
1565
  #
1566
- response = self.safe_value(responses, 0, {})
1566
+ response = self.safe_dict(responses, 0, {})
1567
1567
  id = self.safe_integer(response, 'withdrawal_id')
1568
1568
  message = self.safe_string(response, 'message')
1569
1569
  errorMessage = self.find_broadly_matched_key(self.exceptions['broad'], message)
@@ -1646,7 +1646,7 @@ class bitfinex(Exchange, ImplicitAPI):
1646
1646
  else:
1647
1647
  # json response with error, i.e:
1648
1648
  # [{"status":"error","message":"Momentary balance check. Please wait few seconds and try the transfer again."}]
1649
- responseObject = self.safe_value(response, 0, {})
1649
+ responseObject = self.safe_dict(response, 0, {})
1650
1650
  status = self.safe_string(responseObject, 'status', '')
1651
1651
  if status == 'error':
1652
1652
  throwError = True
ccxt/bitmart.py CHANGED
@@ -723,7 +723,7 @@ class bitmart(Exchange, ImplicitAPI):
723
723
  # }
724
724
  # }
725
725
  #
726
- data = self.safe_value(response, 'data', {})
726
+ data = self.safe_dict(response, 'data', {})
727
727
  return self.safe_integer(data, 'server_time')
728
728
 
729
729
  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.safe_value(self.options, 'fetchStatus', {})
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.safe_value(response, 'data', {})
767
- services = self.safe_value(data, 'service', [])
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.safe_value(servicesByType, type)
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.safe_value(response, 'data', {})
818
- symbols = self.safe_value(data, 'symbols', [])
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.safe_value(response, 'data', {})
927
- symbols = self.safe_value(data, 'symbols', [])
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.safe_value(response, 'data', {})
1030
- currencies = self.safe_value(data, 'currencies', [])
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.safe_value(currency, 'withdraw_enabled')
1038
- depositEnabled = self.safe_value(currency, 'deposit_enabled')
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.safe_value(tickers, 0, {})
1389
+ ticker = self.safe_dict(tickers, 0, {})
1390
1390
  return self.parse_ticker(ticker, market)
1391
1391
 
1392
1392
  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.safe_value(symbols, 0)
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.safe_value(response, 'data', {})
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.safe_value(self.options, 'fetchMyTrades', {})
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.safe_value(response, 'data', {})
1988
+ data = self.safe_dict(response, 'data', {})
1989
1989
  wallet = None
1990
1990
  if marketType == 'swap':
1991
- wallet = self.safe_value(response, 'data', [])
1991
+ wallet = self.safe_list(response, 'data', [])
1992
1992
  elif marketType == 'margin':
1993
- wallet = self.safe_value(data, 'symbols', [])
1993
+ wallet = self.safe_list(data, 'symbols', [])
1994
1994
  else:
1995
- wallet = self.safe_value(data, 'wallet', [])
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.safe_value(entry, 'base', {})
2003
- quote = self.safe_value(entry, 'quote', {})
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.safe_value(response, 'data')
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.safe_value(statusesByType, type, {})
2364
+ statuses = self.safe_dict(statusesByType, type, {})
2365
2365
  return self.safe_string(statuses, status, status)
2366
2366
 
2367
2367
  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.safe_value(response, 'data', {})
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 = self.privatePostSpotV3CancelOrder(self.extend(request, params))
2741
2741
  else:
2742
- stop = self.safe_value_2(params, 'stop', 'trigger')
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 = self.privatePostContractPrivateCancelOrder(self.extend(request, params))
@@ -2935,7 +2935,7 @@ class bitmart(Exchange, ImplicitAPI):
2935
2935
  # }
2936
2936
  # }
2937
2937
  #
2938
- data = self.safe_value(response, 'data', {})
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 = self.privatePostSpotV4QueryOpenOrders(self.extend(request, params))
2984
2984
  elif type == 'swap':
2985
- isStop = self.safe_value_2(params, 'stop', 'trigger')
2985
+ isStop = self.safe_bool_2(params, 'stop', 'trigger')
2986
2986
  params = self.omit(params, ['stop', 'trigger'])
2987
2987
  if isStop:
2988
2988
  response = 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.safe_value(self.options, 'networks', {})
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.safe_value(self.options, 'networks', {})
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.safe_value(response, 'data')
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.safe_value(self.options, 'networks', {})
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.safe_value(response, 'data', {})
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.safe_value(response, 'data', {})
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.safe_value(response, 'data', {})
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.safe_value(response, 'data', {})
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.safe_value(response, 'data', {})
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.safe_value(response, 'data', {})
3708
- symbols = self.safe_value(data, 'symbols', [])
3709
- borrowRate = self.safe_value(symbols, 0)
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.safe_value(info, 'base', {})
3739
- quoteData = self.safe_value(info, 'quote', {})
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.safe_value(response, 'data', {})
3796
- symbols = self.safe_value(data, 'symbols', [])
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
  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.safe_value(response, 'data', {})
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.safe_value(response, 'data', {})
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.safe_value(response, 'data', {})
4031
- rows = self.safe_value(data, 'records', [])
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.safe_value(response, 'data', {})
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.safe_value(response, 'data', [])
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.safe_value(response, 'data', [])
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.safe_value(response, 'data', [])
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/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': (settle == quote),
881
- 'inverse': (settle != quote),
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['inverse']:
1704
+ if self.safe_bool(market, 'inverse'):
1701
1705
  if averageString != '0':
1702
1706
  cost = Precise.string_div(amount, averageString)
1703
1707
  lastTradeTimestamp = None