ccxt 4.2.83__py2.py3-none-any.whl → 4.2.85__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.
Files changed (152) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/bybit.py +1 -1
  3. ccxt/ace.py +5 -5
  4. ccxt/ascendex.py +8 -8
  5. ccxt/async_support/__init__.py +1 -1
  6. ccxt/async_support/ace.py +5 -5
  7. ccxt/async_support/ascendex.py +8 -8
  8. ccxt/async_support/base/exchange.py +3 -27
  9. ccxt/async_support/bigone.py +12 -12
  10. ccxt/async_support/binance.py +20 -32
  11. ccxt/async_support/bingx.py +12 -9
  12. ccxt/async_support/bit2c.py +1 -1
  13. ccxt/async_support/bitbank.py +8 -8
  14. ccxt/async_support/bitbns.py +5 -5
  15. ccxt/async_support/bitfinex.py +1 -1
  16. ccxt/async_support/bitfinex2.py +1 -1
  17. ccxt/async_support/bitget.py +39 -28
  18. ccxt/async_support/bithumb.py +5 -5
  19. ccxt/async_support/bitmart.py +16 -16
  20. ccxt/async_support/bitopro.py +1 -1
  21. ccxt/async_support/bitrue.py +4 -4
  22. ccxt/async_support/bitso.py +5 -5
  23. ccxt/async_support/bitstamp.py +1 -1
  24. ccxt/async_support/bitteam.py +8 -8
  25. ccxt/async_support/bl3p.py +1 -1
  26. ccxt/async_support/btcturk.py +6 -6
  27. ccxt/async_support/bybit.py +34 -87
  28. ccxt/async_support/coincheck.py +4 -4
  29. ccxt/async_support/coinex.py +12 -13
  30. ccxt/async_support/coinlist.py +7 -7
  31. ccxt/async_support/coinmate.py +4 -4
  32. ccxt/async_support/coinmetro.py +3 -3
  33. ccxt/async_support/coinone.py +5 -5
  34. ccxt/async_support/coinspot.py +2 -2
  35. ccxt/async_support/cryptocom.py +17 -17
  36. ccxt/async_support/currencycom.py +1 -1
  37. ccxt/async_support/delta.py +0 -8
  38. ccxt/async_support/deribit.py +16 -80
  39. ccxt/async_support/digifinex.py +8 -8
  40. ccxt/async_support/exmo.py +8 -8
  41. ccxt/async_support/gate.py +0 -8
  42. ccxt/async_support/hitbtc.py +5 -4
  43. ccxt/async_support/hollaex.py +7 -7
  44. ccxt/async_support/htx.py +12 -34
  45. ccxt/async_support/huobijp.py +3 -3
  46. ccxt/async_support/idex.py +2 -2
  47. ccxt/async_support/independentreserve.py +2 -2
  48. ccxt/async_support/indodax.py +2 -2
  49. ccxt/async_support/kraken.py +8 -8
  50. ccxt/async_support/krakenfutures.py +6 -6
  51. ccxt/async_support/kucoin.py +14 -2
  52. ccxt/async_support/kucoinfutures.py +8 -8
  53. ccxt/async_support/kuna.py +16 -16
  54. ccxt/async_support/latoken.py +2 -2
  55. ccxt/async_support/lbank.py +10 -10
  56. ccxt/async_support/luno.py +4 -4
  57. ccxt/async_support/mercado.py +5 -5
  58. ccxt/async_support/mexc.py +6 -6
  59. ccxt/async_support/ndax.py +1 -1
  60. ccxt/async_support/novadax.py +9 -9
  61. ccxt/async_support/oceanex.py +7 -7
  62. ccxt/async_support/okcoin.py +13 -13
  63. ccxt/async_support/okx.py +23 -31
  64. ccxt/async_support/onetrading.py +4 -4
  65. ccxt/async_support/p2b.py +7 -7
  66. ccxt/async_support/phemex.py +12 -12
  67. ccxt/async_support/poloniexfutures.py +5 -5
  68. ccxt/async_support/probit.py +11 -11
  69. ccxt/async_support/timex.py +7 -7
  70. ccxt/async_support/tokocrypto.py +9 -9
  71. ccxt/async_support/wavesexchange.py +3 -3
  72. ccxt/async_support/whitebit.py +5 -5
  73. ccxt/async_support/woo.py +1 -1
  74. ccxt/async_support/zaif.py +1 -1
  75. ccxt/async_support/zonda.py +7 -7
  76. ccxt/base/exchange.py +66 -23
  77. ccxt/bigone.py +12 -12
  78. ccxt/binance.py +20 -32
  79. ccxt/bingx.py +12 -9
  80. ccxt/bit2c.py +1 -1
  81. ccxt/bitbank.py +8 -8
  82. ccxt/bitbns.py +5 -5
  83. ccxt/bitfinex.py +1 -1
  84. ccxt/bitfinex2.py +1 -1
  85. ccxt/bitget.py +39 -28
  86. ccxt/bithumb.py +5 -5
  87. ccxt/bitmart.py +16 -16
  88. ccxt/bitopro.py +1 -1
  89. ccxt/bitrue.py +4 -4
  90. ccxt/bitso.py +5 -5
  91. ccxt/bitstamp.py +1 -1
  92. ccxt/bitteam.py +8 -8
  93. ccxt/bl3p.py +1 -1
  94. ccxt/btcturk.py +6 -6
  95. ccxt/bybit.py +34 -87
  96. ccxt/coincheck.py +4 -4
  97. ccxt/coinex.py +12 -13
  98. ccxt/coinlist.py +7 -7
  99. ccxt/coinmate.py +4 -4
  100. ccxt/coinmetro.py +3 -3
  101. ccxt/coinone.py +5 -5
  102. ccxt/coinspot.py +2 -2
  103. ccxt/cryptocom.py +17 -17
  104. ccxt/currencycom.py +1 -1
  105. ccxt/delta.py +0 -8
  106. ccxt/deribit.py +16 -80
  107. ccxt/digifinex.py +8 -8
  108. ccxt/exmo.py +8 -8
  109. ccxt/gate.py +0 -8
  110. ccxt/hitbtc.py +5 -4
  111. ccxt/hollaex.py +7 -7
  112. ccxt/htx.py +12 -34
  113. ccxt/huobijp.py +3 -3
  114. ccxt/idex.py +2 -2
  115. ccxt/independentreserve.py +2 -2
  116. ccxt/indodax.py +2 -2
  117. ccxt/kraken.py +8 -8
  118. ccxt/krakenfutures.py +6 -6
  119. ccxt/kucoin.py +14 -2
  120. ccxt/kucoinfutures.py +8 -8
  121. ccxt/kuna.py +16 -16
  122. ccxt/latoken.py +2 -2
  123. ccxt/lbank.py +10 -10
  124. ccxt/luno.py +4 -4
  125. ccxt/mercado.py +5 -5
  126. ccxt/mexc.py +6 -6
  127. ccxt/ndax.py +1 -1
  128. ccxt/novadax.py +9 -9
  129. ccxt/oceanex.py +7 -7
  130. ccxt/okcoin.py +13 -13
  131. ccxt/okx.py +23 -31
  132. ccxt/onetrading.py +4 -4
  133. ccxt/p2b.py +7 -7
  134. ccxt/phemex.py +12 -12
  135. ccxt/poloniexfutures.py +5 -5
  136. ccxt/pro/__init__.py +1 -1
  137. ccxt/pro/binance.py +150 -112
  138. ccxt/pro/kucoin.py +6 -7
  139. ccxt/pro/okx.py +12 -1
  140. ccxt/probit.py +11 -11
  141. ccxt/test/base/test_market.py +3 -0
  142. ccxt/timex.py +7 -7
  143. ccxt/tokocrypto.py +9 -9
  144. ccxt/wavesexchange.py +3 -3
  145. ccxt/whitebit.py +5 -5
  146. ccxt/woo.py +1 -1
  147. ccxt/zaif.py +1 -1
  148. ccxt/zonda.py +7 -7
  149. {ccxt-4.2.83.dist-info → ccxt-4.2.85.dist-info}/METADATA +4 -4
  150. {ccxt-4.2.83.dist-info → ccxt-4.2.85.dist-info}/RECORD +152 -152
  151. {ccxt-4.2.83.dist-info → ccxt-4.2.85.dist-info}/WHEEL +0 -0
  152. {ccxt-4.2.83.dist-info → ccxt-4.2.85.dist-info}/top_level.txt +0 -0
ccxt/hollaex.py CHANGED
@@ -622,7 +622,7 @@ class hollaex(Exchange, ImplicitAPI):
622
622
  # ]
623
623
  # }
624
624
  #
625
- trades = self.safe_value(response, market['id'], [])
625
+ trades = self.safe_list(response, market['id'], [])
626
626
  return self.parse_trades(trades, market, since, limit)
627
627
 
628
628
  def parse_trade(self, trade, market: Market = None) -> Trade:
@@ -1017,7 +1017,7 @@ class hollaex(Exchange, ImplicitAPI):
1017
1017
  # ]
1018
1018
  # }
1019
1019
  #
1020
- data = self.safe_value(response, 'data', [])
1020
+ data = self.safe_list(response, 'data', [])
1021
1021
  return self.parse_orders(data, market, since, limit)
1022
1022
 
1023
1023
  def parse_order_status(self, status):
@@ -1266,7 +1266,7 @@ class hollaex(Exchange, ImplicitAPI):
1266
1266
  # ]
1267
1267
  # }
1268
1268
  #
1269
- data = self.safe_value(response, 'data', [])
1269
+ data = self.safe_list(response, 'data', [])
1270
1270
  return self.parse_trades(data, market, since, limit)
1271
1271
 
1272
1272
  def parse_deposit_address(self, depositAddress, currency: Currency = None):
@@ -1411,7 +1411,7 @@ class hollaex(Exchange, ImplicitAPI):
1411
1411
  # ]
1412
1412
  # }
1413
1413
  #
1414
- data = self.safe_value(response, 'data', [])
1414
+ data = self.safe_list(response, 'data', [])
1415
1415
  return self.parse_transactions(data, currency, since, limit)
1416
1416
 
1417
1417
  def fetch_withdrawal(self, id: str, code: Str = None, params={}):
@@ -1456,7 +1456,7 @@ class hollaex(Exchange, ImplicitAPI):
1456
1456
  # }
1457
1457
  #
1458
1458
  data = self.safe_value(response, 'data', [])
1459
- transaction = self.safe_value(data, 0, {})
1459
+ transaction = self.safe_dict(data, 0, {})
1460
1460
  return self.parse_transaction(transaction, currency)
1461
1461
 
1462
1462
  def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
@@ -1511,7 +1511,7 @@ class hollaex(Exchange, ImplicitAPI):
1511
1511
  # ]
1512
1512
  # }
1513
1513
  #
1514
- data = self.safe_value(response, 'data', [])
1514
+ data = self.safe_list(response, 'data', [])
1515
1515
  return self.parse_transactions(data, currency, since, limit)
1516
1516
 
1517
1517
  def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
@@ -1757,7 +1757,7 @@ class hollaex(Exchange, ImplicitAPI):
1757
1757
  # "network":"https://api.hollaex.network"
1758
1758
  # }
1759
1759
  #
1760
- coins = self.safe_value(response, 'coins')
1760
+ coins = self.safe_list(response, 'coins')
1761
1761
  return self.parse_deposit_withdraw_fees(coins, codes, 'symbol')
1762
1762
 
1763
1763
  def normalize_number_if_needed(self, number):
ccxt/htx.py CHANGED
@@ -2140,7 +2140,7 @@ class htx(Exchange, ImplicitAPI):
2140
2140
  # "ts":1639547261293
2141
2141
  # }
2142
2142
  #
2143
- # inverse swaps, linear swaps, inverse futures
2143
+ # linear swap, linear future, inverse swap, inverse future
2144
2144
  #
2145
2145
  # {
2146
2146
  # "status":"ok",
@@ -2157,37 +2157,15 @@ class htx(Exchange, ImplicitAPI):
2157
2157
  # "high":"0.10725",
2158
2158
  # "amount":"2340267.415144052378486261756692535687481566",
2159
2159
  # "count":882,
2160
- # "vol":"24706"
2160
+ # "vol":"24706",
2161
+ # "trade_turnover":"840726.5048", # only in linear futures
2162
+ # "business_type":"futures", # only in linear futures
2163
+ # "contract_code":"BTC-USDT-CW", # only in linear futures, instead of 'symbol'
2161
2164
  # }
2162
2165
  # ],
2163
2166
  # "ts":1637504679376
2164
2167
  # }
2165
2168
  #
2166
- # linear futures
2167
- #
2168
- # {
2169
- # "status":"ok",
2170
- # "ticks":[
2171
- # {
2172
- # "id":1640745627,
2173
- # "ts":1640745627957,
2174
- # "ask":[48079.1,20],
2175
- # "bid":[47713.8,125],
2176
- # "business_type":"futures",
2177
- # "contract_code":"BTC-USDT-CW",
2178
- # "open":"49011.8",
2179
- # "close":"47934",
2180
- # "low":"47292.3",
2181
- # "high":"49011.8",
2182
- # "amount":"17.398",
2183
- # "count":1515,
2184
- # "vol":"17398",
2185
- # "trade_turnover":"840726.5048"
2186
- # }
2187
- # ],
2188
- # "ts":1640745627988
2189
- # }
2190
- #
2191
2169
  tickers = self.safe_value_2(response, 'data', 'ticks', [])
2192
2170
  timestamp = self.safe_integer(response, 'ts')
2193
2171
  result = {}
@@ -2314,7 +2292,7 @@ class htx(Exchange, ImplicitAPI):
2314
2292
  else:
2315
2293
  raise NotSupported(self.id + ' fetchLastPrices() does not support ' + type + ' markets yet')
2316
2294
  tick = self.safe_value(response, 'tick', {})
2317
- data = self.safe_value(tick, 'data', [])
2295
+ data = self.safe_list(tick, 'data', [])
2318
2296
  return self.parse_last_prices(data, symbols)
2319
2297
 
2320
2298
  def parse_last_price(self, entry, market: Market = None):
@@ -3734,7 +3712,7 @@ class htx(Exchange, ImplicitAPI):
3734
3712
  # ]
3735
3713
  # }
3736
3714
  #
3737
- data = self.safe_value(response, 'data', [])
3715
+ data = self.safe_list(response, 'data', [])
3738
3716
  return self.parse_orders(data, market, since, limit)
3739
3717
 
3740
3718
  def fetch_spot_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -6734,7 +6712,7 @@ class htx(Exchange, ImplicitAPI):
6734
6712
  else:
6735
6713
  request['symbol'] = market['id']
6736
6714
  response = self.contractPrivatePostApiV3ContractFinancialRecordExact(self.extend(request, query))
6737
- data = self.safe_value(response, 'data', [])
6715
+ data = self.safe_list(response, 'data', [])
6738
6716
  return self.parse_incomes(data, market, since, limit)
6739
6717
 
6740
6718
  def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
@@ -7463,7 +7441,7 @@ class htx(Exchange, ImplicitAPI):
7463
7441
  # ]
7464
7442
  # }
7465
7443
  #
7466
- data = self.safe_value(response, 'data')
7444
+ data = self.safe_list(response, 'data')
7467
7445
  return self.parse_leverage_tiers(data, symbols, 'contract_code')
7468
7446
 
7469
7447
  def fetch_market_leverage_tiers(self, symbol: str, params={}):
@@ -7652,7 +7630,7 @@ class htx(Exchange, ImplicitAPI):
7652
7630
  # }
7653
7631
  #
7654
7632
  data = self.safe_value(response, 'data')
7655
- tick = self.safe_value(data, 'tick')
7633
+ tick = self.safe_list(data, 'tick')
7656
7634
  return self.parse_open_interests(tick, market, since, limit)
7657
7635
 
7658
7636
  def fetch_open_interest(self, symbol: str, params={}):
@@ -8131,7 +8109,7 @@ class htx(Exchange, ImplicitAPI):
8131
8109
  # ]
8132
8110
  # }
8133
8111
  #
8134
- data = self.safe_value(response, 'data')
8112
+ data = self.safe_list(response, 'data')
8135
8113
  return self.parse_deposit_withdraw_fees(data, codes, 'currency')
8136
8114
 
8137
8115
  def parse_deposit_withdraw_fee(self, fee, currency: Currency = None):
@@ -8344,7 +8322,7 @@ class htx(Exchange, ImplicitAPI):
8344
8322
  # "ts": 1604312615051
8345
8323
  # }
8346
8324
  #
8347
- data = self.safe_value(response, 'data', [])
8325
+ data = self.safe_list(response, 'data', [])
8348
8326
  return self.parse_liquidations(data, market, since, limit)
8349
8327
 
8350
8328
  def parse_liquidation(self, liquidation, market: Market = None):
ccxt/huobijp.py CHANGED
@@ -941,7 +941,7 @@ class huobijp(Exchange, ImplicitAPI):
941
941
  # ]
942
942
  # }
943
943
  #
944
- data = self.safe_value(response, 'data', [])
944
+ data = self.safe_list(response, 'data', [])
945
945
  return self.parse_ohlcvs(data, market, timeframe, since, limit)
946
946
 
947
947
  def fetch_accounts(self, params={}) -> List[Account]:
@@ -1125,7 +1125,7 @@ class huobijp(Exchange, ImplicitAPI):
1125
1125
  'id': id,
1126
1126
  }
1127
1127
  response = self.privateGetOrderOrdersId(self.extend(request, params))
1128
- order = self.safe_value(response, 'data')
1128
+ order = self.safe_dict(response, 'data')
1129
1129
  return self.parse_order(order)
1130
1130
 
1131
1131
  def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
@@ -1210,7 +1210,7 @@ class huobijp(Exchange, ImplicitAPI):
1210
1210
  # ]
1211
1211
  # }
1212
1212
  #
1213
- data = self.safe_value(response, 'data', [])
1213
+ data = self.safe_list(response, 'data', [])
1214
1214
  return self.parse_orders(data, market, since, limit)
1215
1215
 
1216
1216
  def parse_order_status(self, status):
ccxt/idex.py CHANGED
@@ -363,7 +363,7 @@ class idex(Exchange, ImplicitAPI):
363
363
  # }
364
364
  # ]
365
365
  response = self.publicGetTickers(self.extend(request, params))
366
- ticker = self.safe_value(response, 0)
366
+ ticker = self.safe_dict(response, 0)
367
367
  return self.parse_ticker(ticker, market)
368
368
 
369
369
  def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
@@ -1407,7 +1407,7 @@ class idex(Exchange, ImplicitAPI):
1407
1407
  }
1408
1408
  # [{orderId: "688336f0-ec50-11ea-9842-b332f8a34d0e"}]
1409
1409
  response = self.privateDeleteOrders(self.extend(request, params))
1410
- canceledOrder = self.safe_value(response, 0)
1410
+ canceledOrder = self.safe_dict(response, 0)
1411
1411
  return self.parse_order(canceledOrder, market)
1412
1412
 
1413
1413
  def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
@@ -480,7 +480,7 @@ class independentreserve(Exchange, ImplicitAPI):
480
480
  request['pageIndex'] = 1
481
481
  request['pageSize'] = limit
482
482
  response = self.privatePostGetOpenOrders(self.extend(request, params))
483
- data = self.safe_value(response, 'Data', [])
483
+ data = self.safe_list(response, 'Data', [])
484
484
  return self.parse_orders(data, market, since, limit)
485
485
 
486
486
  def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
@@ -504,7 +504,7 @@ class independentreserve(Exchange, ImplicitAPI):
504
504
  request['pageIndex'] = 1
505
505
  request['pageSize'] = limit
506
506
  response = self.privatePostGetClosedOrders(self.extend(request, params))
507
- data = self.safe_value(response, 'Data', [])
507
+ data = self.safe_list(response, 'Data', [])
508
508
  return self.parse_orders(data, market, since, limit)
509
509
 
510
510
  def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = 50, params={}):
ccxt/indodax.py CHANGED
@@ -473,7 +473,7 @@ class indodax(Exchange, ImplicitAPI):
473
473
  # }
474
474
  # }
475
475
  #
476
- ticker = self.safe_value(response, 'ticker', {})
476
+ ticker = self.safe_dict(response, 'ticker', {})
477
477
  return self.parse_ticker(ticker, market)
478
478
 
479
479
  def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
@@ -502,7 +502,7 @@ class indodax(Exchange, ImplicitAPI):
502
502
  # }
503
503
  #
504
504
  response = self.publicGetApiTickerAll(params)
505
- tickers = self.safe_value(response, 'tickers')
505
+ tickers = self.safe_list(response, 'tickers')
506
506
  return self.parse_tickers(tickers, symbols)
507
507
 
508
508
  def parse_trade(self, trade, market: Market = None) -> Trade:
ccxt/kraken.py CHANGED
@@ -979,7 +979,7 @@ class kraken(Exchange, ImplicitAPI):
979
979
  # }
980
980
  # }
981
981
  result = self.safe_value(response, 'result', {})
982
- ohlcvs = self.safe_value(result, market['id'], [])
982
+ ohlcvs = self.safe_list(result, market['id'], [])
983
983
  return self.parse_ohlcvs(ohlcvs, market, timeframe, since, limit)
984
984
 
985
985
  def parse_ledger_entry_type(self, type):
@@ -1341,7 +1341,7 @@ class kraken(Exchange, ImplicitAPI):
1341
1341
  # }
1342
1342
  # }
1343
1343
  #
1344
- result = self.safe_value(response, 'result')
1344
+ result = self.safe_dict(response, 'result')
1345
1345
  return self.parse_order(result)
1346
1346
 
1347
1347
  def find_market_by_altname_or_id(self, id):
@@ -1724,7 +1724,7 @@ class kraken(Exchange, ImplicitAPI):
1724
1724
  # }
1725
1725
  # }
1726
1726
  #
1727
- data = self.safe_value(response, 'result', {})
1727
+ data = self.safe_dict(response, 'result', {})
1728
1728
  return self.parse_order(data, market)
1729
1729
 
1730
1730
  def fetch_order(self, id: str, symbol: Str = None, params={}):
@@ -2022,8 +2022,8 @@ class kraken(Exchange, ImplicitAPI):
2022
2022
  market = None
2023
2023
  if symbol is not None:
2024
2024
  market = self.market(symbol)
2025
- result = self.safe_value(response, 'result', {})
2026
- orders = self.safe_value(result, 'open', [])
2025
+ result = self.safe_dict(response, 'result', {})
2026
+ orders = self.safe_dict(result, 'open', {})
2027
2027
  return self.parse_orders(orders, market, since, limit)
2028
2028
 
2029
2029
  def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
@@ -2090,8 +2090,8 @@ class kraken(Exchange, ImplicitAPI):
2090
2090
  market = None
2091
2091
  if symbol is not None:
2092
2092
  market = self.market(symbol)
2093
- result = self.safe_value(response, 'result', {})
2094
- orders = self.safe_value(result, 'closed', [])
2093
+ result = self.safe_dict(response, 'result', {})
2094
+ orders = self.safe_dict(result, 'closed', {})
2095
2095
  return self.parse_orders(orders, market, since, limit)
2096
2096
 
2097
2097
  def parse_transaction_status(self, status):
@@ -2518,7 +2518,7 @@ class kraken(Exchange, ImplicitAPI):
2518
2518
  # }
2519
2519
  # }
2520
2520
  #
2521
- result = self.safe_value(response, 'result', {})
2521
+ result = self.safe_dict(response, 'result', {})
2522
2522
  return self.parse_transaction(result, currency)
2523
2523
  raise ExchangeError(self.id + " withdraw() requires a 'key' parameter(withdrawal key name, up on your account)")
2524
2524
 
ccxt/krakenfutures.py CHANGED
@@ -535,7 +535,7 @@ class krakenfutures(Exchange, ImplicitAPI):
535
535
  # "serverTime": "2022-02-18T14:16:29.440Z"
536
536
  # }
537
537
  #
538
- tickers = self.safe_value(response, 'tickers')
538
+ tickers = self.safe_list(response, 'tickers')
539
539
  return self.parse_tickers(tickers, symbols)
540
540
 
541
541
  def parse_ticker(self, ticker, market: Market = None) -> Ticker:
@@ -662,7 +662,7 @@ class krakenfutures(Exchange, ImplicitAPI):
662
662
  # "more_candles": True
663
663
  # }
664
664
  #
665
- candles = self.safe_value(response, 'candles')
665
+ candles = self.safe_list(response, 'candles')
666
666
  return self.parse_ohlcvs(candles, market, timeframe, since, limit)
667
667
 
668
668
  def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
@@ -1087,7 +1087,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1087
1087
  # ]
1088
1088
  # }
1089
1089
  #
1090
- data = self.safe_value(response, 'batchStatus', [])
1090
+ data = self.safe_list(response, 'batchStatus', [])
1091
1091
  return self.parse_orders(data)
1092
1092
 
1093
1093
  def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
@@ -1191,7 +1191,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1191
1191
  # }
1192
1192
  # ]
1193
1193
  # }
1194
- batchStatus = self.safe_value(response, 'batchStatus', [])
1194
+ batchStatus = self.safe_list(response, 'batchStatus', [])
1195
1195
  return self.parse_orders(batchStatus)
1196
1196
 
1197
1197
  def cancel_all_orders(self, symbol: Str = None, params={}):
@@ -1223,7 +1223,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1223
1223
  if symbol is not None:
1224
1224
  market = self.market(symbol)
1225
1225
  response = self.privateGetOpenorders(params)
1226
- orders = self.safe_value(response, 'openOrders', [])
1226
+ orders = self.safe_list(response, 'openOrders', [])
1227
1227
  return self.parse_orders(orders, market, since, limit)
1228
1228
 
1229
1229
  def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
@@ -2217,7 +2217,7 @@ class krakenfutures(Exchange, ImplicitAPI):
2217
2217
  # "serverTime": "2018-07-19T11:32:39.433Z"
2218
2218
  # }
2219
2219
  #
2220
- data = self.safe_value(response, 'instruments')
2220
+ data = self.safe_list(response, 'instruments')
2221
2221
  return self.parse_leverage_tiers(data, symbols, 'symbol')
2222
2222
 
2223
2223
  def parse_market_leverage_tiers(self, info, market: Market = None):
ccxt/kucoin.py CHANGED
@@ -25,6 +25,7 @@ from ccxt.base.errors import RateLimitExceeded
25
25
  from ccxt.base.errors import ExchangeNotAvailable
26
26
  from ccxt.base.errors import InvalidNonce
27
27
  from ccxt.base.errors import AuthenticationError
28
+ from ccxt.base.decimal_to_precision import TRUNCATE
28
29
  from ccxt.base.decimal_to_precision import TICK_SIZE
29
30
  from ccxt.base.precise import Precise
30
31
 
@@ -441,6 +442,7 @@ class kucoin(Exchange, ImplicitAPI):
441
442
  'Order size below the minimum requirement.': InvalidOrder, # {"code":"400100","msg":"Order size below the minimum requirement."}
442
443
  'The withdrawal amount is below the minimum requirement.': ExchangeError, # {"code":"400100","msg":"The withdrawal amount is below the minimum requirement."}
443
444
  'Unsuccessful! Exceeded the max. funds out-transfer limit': InsufficientFunds, # {"code":"200000","msg":"Unsuccessful! Exceeded the max. funds out-transfer limit"}
445
+ 'The amount increment is invalid.': BadRequest,
444
446
  '400': BadRequest,
445
447
  '401': AuthenticationError,
446
448
  '403': NotSupported,
@@ -2091,6 +2093,13 @@ class kucoin(Exchange, ImplicitAPI):
2091
2093
  data = self.safe_list(data, 'data', [])
2092
2094
  return self.parse_orders(data)
2093
2095
 
2096
+ def market_order_amount_to_precision(self, symbol: str, amount):
2097
+ market = self.market(symbol)
2098
+ result = self.decimal_to_precision(amount, TRUNCATE, market['info']['quoteIncrement'], self.precisionMode, self.paddingMode)
2099
+ if result == '0':
2100
+ raise InvalidOrder(self.id + ' amount of ' + market['symbol'] + ' must be greater than minimum amount precision of ' + self.number_to_string(market['precision']['amount']))
2101
+ return result
2102
+
2094
2103
  def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
2095
2104
  market = self.market(symbol)
2096
2105
  # required param, cannot be used twice
@@ -2111,7 +2120,7 @@ class kucoin(Exchange, ImplicitAPI):
2111
2120
  if quoteAmount is not None:
2112
2121
  params = self.omit(params, ['cost', 'funds'])
2113
2122
  # kucoin uses base precision even for quote values
2114
- costString = self.amount_to_precision(symbol, quoteAmount)
2123
+ costString = self.market_order_amount_to_precision(symbol, quoteAmount)
2115
2124
  request['funds'] = costString
2116
2125
  else:
2117
2126
  amountString = self.amount_to_precision(symbol, amount)
@@ -2374,8 +2383,11 @@ class kucoin(Exchange, ImplicitAPI):
2374
2383
  # ]
2375
2384
  # }
2376
2385
  # }
2386
+ listData = self.safe_list(response, 'data')
2387
+ if listData is not None:
2388
+ return self.parse_orders(listData, market, since, limit)
2377
2389
  responseData = self.safe_dict(response, 'data', {})
2378
- orders = self.safe_value(responseData, 'items', responseData)
2390
+ orders = self.safe_list(responseData, 'items', [])
2379
2391
  return self.parse_orders(orders, market, since, limit)
2380
2392
 
2381
2393
  def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
ccxt/kucoinfutures.py CHANGED
@@ -591,7 +591,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
591
591
  # ]
592
592
  # }
593
593
  #
594
- data = self.safe_value(response, 'data', [])
594
+ data = self.safe_list(response, 'data', [])
595
595
  return self.parse_ohlcvs(data, market, timeframe, since, limit)
596
596
 
597
597
  def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
@@ -1042,7 +1042,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
1042
1042
  # }
1043
1043
  # }
1044
1044
  #
1045
- data = self.safe_value(response, 'data', {})
1045
+ data = self.safe_dict(response, 'data', {})
1046
1046
  return self.parse_position(data, market)
1047
1047
 
1048
1048
  def fetch_positions(self, symbols: Strings = None, params={}):
@@ -1101,7 +1101,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
1101
1101
  # ]
1102
1102
  # }
1103
1103
  #
1104
- data = self.safe_value(response, 'data')
1104
+ data = self.safe_list(response, 'data')
1105
1105
  return self.parse_positions(data, symbols)
1106
1106
 
1107
1107
  def parse_position(self, position, market: Market = None):
@@ -1243,7 +1243,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
1243
1243
  # },
1244
1244
  # }
1245
1245
  #
1246
- data = self.safe_value(response, 'data', {})
1246
+ data = self.safe_dict(response, 'data', {})
1247
1247
  return self.parse_order(data, market)
1248
1248
 
1249
1249
  def create_orders(self, orders: List[OrderRequest], params={}):
@@ -1289,7 +1289,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
1289
1289
  # ]
1290
1290
  # }
1291
1291
  #
1292
- data = self.safe_value(response, 'data', [])
1292
+ data = self.safe_list(response, 'data', [])
1293
1293
  return self.parse_orders(data)
1294
1294
 
1295
1295
  def create_contract_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
@@ -1658,7 +1658,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
1658
1658
  # }
1659
1659
  #
1660
1660
  responseData = self.safe_value(response, 'data', {})
1661
- orders = self.safe_value(responseData, 'items', [])
1661
+ orders = self.safe_list(responseData, 'items', [])
1662
1662
  return self.parse_orders(orders, market, since, limit)
1663
1663
 
1664
1664
  def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
@@ -1747,7 +1747,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
1747
1747
  # }
1748
1748
  #
1749
1749
  market = self.market(symbol) if (symbol is not None) else None
1750
- responseData = self.safe_value(response, 'data')
1750
+ responseData = self.safe_dict(response, 'data')
1751
1751
  return self.parse_order(responseData, market)
1752
1752
 
1753
1753
  def parse_order(self, order, market: Market = None) -> Order:
@@ -2146,7 +2146,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
2146
2146
  # ]
2147
2147
  # }
2148
2148
  #
2149
- trades = self.safe_value(response, 'data', [])
2149
+ trades = self.safe_list(response, 'data', [])
2150
2150
  return self.parse_trades(trades, market, since, limit)
2151
2151
 
2152
2152
  def parse_trade(self, trade, market: Market = None) -> Trade:
ccxt/kuna.py CHANGED
@@ -650,7 +650,7 @@ class kuna(Exchange, ImplicitAPI):
650
650
  # }
651
651
  # }
652
652
  #
653
- data = self.safe_value(response, 'data', {})
653
+ data = self.safe_dict(response, 'data', {})
654
654
  return self.parse_order_book(data, market['symbol'], None, 'bids', 'asks', 0, 1)
655
655
 
656
656
  def parse_ticker(self, ticker, market: Market = None) -> Ticker:
@@ -728,7 +728,7 @@ class kuna(Exchange, ImplicitAPI):
728
728
  # ]
729
729
  # }
730
730
  #
731
- data = self.safe_value(response, 'data', [])
731
+ data = self.safe_list(response, 'data', [])
732
732
  return self.parse_tickers(data, symbols, params)
733
733
 
734
734
  def fetch_ticker(self, symbol: str, params={}) -> Ticker:
@@ -766,7 +766,7 @@ class kuna(Exchange, ImplicitAPI):
766
766
  # }
767
767
  #
768
768
  data = self.safe_value(response, 'data', [])
769
- ticker = self.safe_value(data, 0)
769
+ ticker = self.safe_dict(data, 0)
770
770
  return self.parse_ticker(ticker, market)
771
771
 
772
772
  def fetch_l3_order_book(self, symbol: str, limit: Int = None, params={}):
@@ -968,7 +968,7 @@ class kuna(Exchange, ImplicitAPI):
968
968
  # }
969
969
  # }
970
970
  #
971
- data = self.safe_value(response, 'data', {})
971
+ data = self.safe_dict(response, 'data', {})
972
972
  return self.parse_order(data, market)
973
973
 
974
974
  def cancel_order(self, id: str, symbol: Str = None, params={}):
@@ -1023,7 +1023,7 @@ class kuna(Exchange, ImplicitAPI):
1023
1023
  # ]
1024
1024
  # }
1025
1025
  #
1026
- data = self.safe_value(response, 'data', [])
1026
+ data = self.safe_list(response, 'data', [])
1027
1027
  return self.parse_orders(data)
1028
1028
 
1029
1029
  def parse_order_status(self, status):
@@ -1165,7 +1165,7 @@ class kuna(Exchange, ImplicitAPI):
1165
1165
  # }
1166
1166
  # }
1167
1167
  #
1168
- data = self.safe_value(response, 'data', {})
1168
+ data = self.safe_dict(response, 'data', {})
1169
1169
  return self.parse_order(data)
1170
1170
 
1171
1171
  def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
@@ -1219,7 +1219,7 @@ class kuna(Exchange, ImplicitAPI):
1219
1219
  # ]
1220
1220
  # }
1221
1221
  #
1222
- data = self.safe_value(response, 'data', [])
1222
+ data = self.safe_list(response, 'data', [])
1223
1223
  return self.parse_orders(data, market, since, limit)
1224
1224
 
1225
1225
  def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
@@ -1294,7 +1294,7 @@ class kuna(Exchange, ImplicitAPI):
1294
1294
  # ]
1295
1295
  # }
1296
1296
  #
1297
- data = self.safe_value(response, 'data', [])
1297
+ data = self.safe_list(response, 'data', [])
1298
1298
  return self.parse_orders(data, market, since, limit)
1299
1299
 
1300
1300
  def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -1337,7 +1337,7 @@ class kuna(Exchange, ImplicitAPI):
1337
1337
  # ]
1338
1338
  # }
1339
1339
  #
1340
- data = self.safe_value(response, 'data')
1340
+ data = self.safe_list(response, 'data')
1341
1341
  return self.parse_trades(data, market, since, limit)
1342
1342
 
1343
1343
  def withdraw(self, code: str, amount: float, address, tag=None, params={}):
@@ -1384,7 +1384,7 @@ class kuna(Exchange, ImplicitAPI):
1384
1384
  # }
1385
1385
  # }
1386
1386
  #
1387
- data = self.safe_value(response, 'data', {})
1387
+ data = self.safe_dict(response, 'data', {})
1388
1388
  return self.parse_transaction(data, currency)
1389
1389
 
1390
1390
  def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
@@ -1445,7 +1445,7 @@ class kuna(Exchange, ImplicitAPI):
1445
1445
  # ]
1446
1446
  # }
1447
1447
  #
1448
- data = self.safe_value(response, 'data', [])
1448
+ data = self.safe_list(response, 'data', [])
1449
1449
  return self.parse_transactions(data, currency)
1450
1450
 
1451
1451
  def fetch_withdrawal(self, id: str, code: Str = None, params={}):
@@ -1483,7 +1483,7 @@ class kuna(Exchange, ImplicitAPI):
1483
1483
  # }
1484
1484
  # }
1485
1485
  #
1486
- data = self.safe_value(response, 'data', {})
1486
+ data = self.safe_dict(response, 'data', {})
1487
1487
  return self.parse_transaction(data)
1488
1488
 
1489
1489
  def create_deposit_address(self, code: str, params={}):
@@ -1509,7 +1509,7 @@ class kuna(Exchange, ImplicitAPI):
1509
1509
  # }
1510
1510
  # }
1511
1511
  #
1512
- data = self.safe_value(response, 'data', {})
1512
+ data = self.safe_dict(response, 'data', {})
1513
1513
  return self.parse_deposit_address(data, currency)
1514
1514
 
1515
1515
  def fetch_deposit_address(self, code: str, params={}):
@@ -1535,7 +1535,7 @@ class kuna(Exchange, ImplicitAPI):
1535
1535
  # }
1536
1536
  # }
1537
1537
  #
1538
- data = self.safe_value(response, 'data', {})
1538
+ data = self.safe_dict(response, 'data', {})
1539
1539
  return self.parse_deposit_address(data, currency)
1540
1540
 
1541
1541
  def parse_deposit_address(self, depositAddress, currency: Currency = None):
@@ -1626,7 +1626,7 @@ class kuna(Exchange, ImplicitAPI):
1626
1626
  # ]
1627
1627
  # }
1628
1628
  #
1629
- data = self.safe_value(response, 'data', [])
1629
+ data = self.safe_list(response, 'data', [])
1630
1630
  return self.parse_transactions(data, currency)
1631
1631
 
1632
1632
  def fetch_deposit(self, id: str, code: Str = None, params={}):
@@ -1667,7 +1667,7 @@ class kuna(Exchange, ImplicitAPI):
1667
1667
  # }
1668
1668
  # }
1669
1669
  #
1670
- data = self.safe_value(response, 'data', {})
1670
+ data = self.safe_dict(response, 'data', {})
1671
1671
  return self.parse_transaction(data, currency)
1672
1672
 
1673
1673
  def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
ccxt/latoken.py CHANGED
@@ -1382,7 +1382,7 @@ class latoken(Exchange, ImplicitAPI):
1382
1382
  currency = None
1383
1383
  if code is not None:
1384
1384
  currency = self.currency(code)
1385
- content = self.safe_value(response, 'content', [])
1385
+ content = self.safe_list(response, 'content', [])
1386
1386
  return self.parse_transactions(content, currency, since, limit)
1387
1387
 
1388
1388
  def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
@@ -1506,7 +1506,7 @@ class latoken(Exchange, ImplicitAPI):
1506
1506
  # "hasContent": True
1507
1507
  # }
1508
1508
  #
1509
- transfers = self.safe_value(response, 'content', [])
1509
+ transfers = self.safe_list(response, 'content', [])
1510
1510
  return self.parse_transfers(transfers, currency, since, limit)
1511
1511
 
1512
1512
  def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry: