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

Files changed (191) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/bitstamp.py +1 -1
  3. ccxt/abstract/bybit.py +1 -1
  4. ccxt/ace.py +1 -1
  5. ccxt/alpaca.py +1 -1
  6. ccxt/ascendex.py +1 -1
  7. ccxt/async_support/__init__.py +1 -1
  8. ccxt/async_support/ace.py +1 -1
  9. ccxt/async_support/alpaca.py +1 -1
  10. ccxt/async_support/ascendex.py +1 -1
  11. ccxt/async_support/base/exchange.py +1 -1
  12. ccxt/async_support/bigone.py +1 -1
  13. ccxt/async_support/binance.py +1 -1
  14. ccxt/async_support/bingx.py +1 -1
  15. ccxt/async_support/bitbank.py +1 -1
  16. ccxt/async_support/bitbns.py +1 -1
  17. ccxt/async_support/bitfinex.py +1 -1
  18. ccxt/async_support/bitfinex2.py +1 -1
  19. ccxt/async_support/bitflyer.py +1 -1
  20. ccxt/async_support/bitget.py +12 -5
  21. ccxt/async_support/bithumb.py +2 -1
  22. ccxt/async_support/bitmart.py +1 -1
  23. ccxt/async_support/bitmex.py +1 -1
  24. ccxt/async_support/bitopro.py +1 -1
  25. ccxt/async_support/bitrue.py +1 -1
  26. ccxt/async_support/bitso.py +1 -1
  27. ccxt/async_support/bitstamp.py +43 -16
  28. ccxt/async_support/bitteam.py +1 -1
  29. ccxt/async_support/bitvavo.py +1 -1
  30. ccxt/async_support/blockchaincom.py +1 -1
  31. ccxt/async_support/blofin.py +1 -1
  32. ccxt/async_support/btcalpha.py +1 -1
  33. ccxt/async_support/btcmarkets.py +1 -1
  34. ccxt/async_support/btcturk.py +1 -1
  35. ccxt/async_support/bybit.py +5 -5
  36. ccxt/async_support/cex.py +1 -1
  37. ccxt/async_support/coinbase.py +1 -1
  38. ccxt/async_support/coinbaseinternational.py +1 -1
  39. ccxt/async_support/coinbasepro.py +1 -1
  40. ccxt/async_support/coinex.py +2 -3
  41. ccxt/async_support/coinlist.py +1 -1
  42. ccxt/async_support/coinmate.py +1 -1
  43. ccxt/async_support/coinmetro.py +1 -1
  44. ccxt/async_support/coinone.py +1 -1
  45. ccxt/async_support/coinsph.py +1 -1
  46. ccxt/async_support/cryptocom.py +1 -1
  47. ccxt/async_support/currencycom.py +1 -1
  48. ccxt/async_support/delta.py +1 -1
  49. ccxt/async_support/deribit.py +17 -2
  50. ccxt/async_support/digifinex.py +1 -1
  51. ccxt/async_support/exmo.py +1 -1
  52. ccxt/async_support/gate.py +1 -1
  53. ccxt/async_support/gemini.py +2 -1
  54. ccxt/async_support/hitbtc.py +1 -1
  55. ccxt/async_support/hollaex.py +1 -1
  56. ccxt/async_support/htx.py +6 -28
  57. ccxt/async_support/huobijp.py +1 -1
  58. ccxt/async_support/hyperliquid.py +6 -5
  59. ccxt/async_support/idex.py +1 -1
  60. ccxt/async_support/independentreserve.py +1 -1
  61. ccxt/async_support/indodax.py +1 -1
  62. ccxt/async_support/kraken.py +1 -1
  63. ccxt/async_support/krakenfutures.py +1 -1
  64. ccxt/async_support/kucoin.py +11 -2
  65. ccxt/async_support/kucoinfutures.py +147 -10
  66. ccxt/async_support/kuna.py +1 -1
  67. ccxt/async_support/latoken.py +1 -1
  68. ccxt/async_support/lbank.py +1 -1
  69. ccxt/async_support/luno.py +1 -1
  70. ccxt/async_support/lykke.py +1 -1
  71. ccxt/async_support/mercado.py +1 -1
  72. ccxt/async_support/mexc.py +1 -1
  73. ccxt/async_support/ndax.py +1 -1
  74. ccxt/async_support/novadax.py +1 -1
  75. ccxt/async_support/oceanex.py +1 -1
  76. ccxt/async_support/okcoin.py +1 -1
  77. ccxt/async_support/okx.py +1 -1
  78. ccxt/async_support/onetrading.py +1 -1
  79. ccxt/async_support/p2b.py +1 -1
  80. ccxt/async_support/phemex.py +1 -1
  81. ccxt/async_support/poloniex.py +1 -1
  82. ccxt/async_support/poloniexfutures.py +1 -1
  83. ccxt/async_support/probit.py +1 -1
  84. ccxt/async_support/timex.py +1 -1
  85. ccxt/async_support/tokocrypto.py +1 -1
  86. ccxt/async_support/tradeogre.py +2 -1
  87. ccxt/async_support/upbit.py +1 -1
  88. ccxt/async_support/wavesexchange.py +1 -1
  89. ccxt/async_support/wazirx.py +1 -1
  90. ccxt/async_support/whitebit.py +1 -1
  91. ccxt/async_support/woo.py +1 -1
  92. ccxt/async_support/yobit.py +1 -1
  93. ccxt/async_support/zaif.py +1 -1
  94. ccxt/async_support/zonda.py +1 -1
  95. ccxt/base/exchange.py +1 -1
  96. ccxt/bigone.py +1 -1
  97. ccxt/binance.py +1 -1
  98. ccxt/bingx.py +1 -1
  99. ccxt/bitbank.py +1 -1
  100. ccxt/bitbns.py +1 -1
  101. ccxt/bitfinex.py +1 -1
  102. ccxt/bitfinex2.py +1 -1
  103. ccxt/bitflyer.py +1 -1
  104. ccxt/bitget.py +12 -5
  105. ccxt/bithumb.py +2 -1
  106. ccxt/bitmart.py +1 -1
  107. ccxt/bitmex.py +1 -1
  108. ccxt/bitopro.py +1 -1
  109. ccxt/bitrue.py +1 -1
  110. ccxt/bitso.py +1 -1
  111. ccxt/bitstamp.py +43 -16
  112. ccxt/bitteam.py +1 -1
  113. ccxt/bitvavo.py +1 -1
  114. ccxt/blockchaincom.py +1 -1
  115. ccxt/blofin.py +1 -1
  116. ccxt/btcalpha.py +1 -1
  117. ccxt/btcmarkets.py +1 -1
  118. ccxt/btcturk.py +1 -1
  119. ccxt/bybit.py +5 -5
  120. ccxt/cex.py +1 -1
  121. ccxt/coinbase.py +1 -1
  122. ccxt/coinbaseinternational.py +1 -1
  123. ccxt/coinbasepro.py +1 -1
  124. ccxt/coinex.py +2 -3
  125. ccxt/coinlist.py +1 -1
  126. ccxt/coinmate.py +1 -1
  127. ccxt/coinmetro.py +1 -1
  128. ccxt/coinone.py +1 -1
  129. ccxt/coinsph.py +1 -1
  130. ccxt/cryptocom.py +1 -1
  131. ccxt/currencycom.py +1 -1
  132. ccxt/delta.py +1 -1
  133. ccxt/deribit.py +17 -2
  134. ccxt/digifinex.py +1 -1
  135. ccxt/exmo.py +1 -1
  136. ccxt/gate.py +1 -1
  137. ccxt/gemini.py +2 -1
  138. ccxt/hitbtc.py +1 -1
  139. ccxt/hollaex.py +1 -1
  140. ccxt/htx.py +6 -28
  141. ccxt/huobijp.py +1 -1
  142. ccxt/hyperliquid.py +6 -5
  143. ccxt/idex.py +1 -1
  144. ccxt/independentreserve.py +1 -1
  145. ccxt/indodax.py +1 -1
  146. ccxt/kraken.py +1 -1
  147. ccxt/krakenfutures.py +1 -1
  148. ccxt/kucoin.py +11 -2
  149. ccxt/kucoinfutures.py +147 -10
  150. ccxt/kuna.py +1 -1
  151. ccxt/latoken.py +1 -1
  152. ccxt/lbank.py +1 -1
  153. ccxt/luno.py +1 -1
  154. ccxt/lykke.py +1 -1
  155. ccxt/mercado.py +1 -1
  156. ccxt/mexc.py +1 -1
  157. ccxt/ndax.py +1 -1
  158. ccxt/novadax.py +1 -1
  159. ccxt/oceanex.py +1 -1
  160. ccxt/okcoin.py +1 -1
  161. ccxt/okx.py +1 -1
  162. ccxt/onetrading.py +1 -1
  163. ccxt/p2b.py +1 -1
  164. ccxt/phemex.py +1 -1
  165. ccxt/poloniex.py +1 -1
  166. ccxt/poloniexfutures.py +1 -1
  167. ccxt/pro/__init__.py +3 -1
  168. ccxt/pro/bithumb.py +368 -0
  169. ccxt/pro/bitmart.py +1 -1
  170. ccxt/pro/bybit.py +1 -1
  171. ccxt/pro/cex.py +15 -5
  172. ccxt/pro/okx.py +2 -1
  173. ccxt/pro/p2b.py +14 -4
  174. ccxt/pro/woo.py +1 -1
  175. ccxt/probit.py +1 -1
  176. ccxt/test/base/test_market.py +3 -0
  177. ccxt/timex.py +1 -1
  178. ccxt/tokocrypto.py +1 -1
  179. ccxt/tradeogre.py +2 -1
  180. ccxt/upbit.py +1 -1
  181. ccxt/wavesexchange.py +1 -1
  182. ccxt/wazirx.py +1 -1
  183. ccxt/whitebit.py +1 -1
  184. ccxt/woo.py +1 -1
  185. ccxt/yobit.py +1 -1
  186. ccxt/zaif.py +1 -1
  187. ccxt/zonda.py +1 -1
  188. {ccxt-4.2.82.dist-info → ccxt-4.2.84.dist-info}/METADATA +5 -5
  189. {ccxt-4.2.82.dist-info → ccxt-4.2.84.dist-info}/RECORD +191 -190
  190. {ccxt-4.2.82.dist-info → ccxt-4.2.84.dist-info}/WHEEL +0 -0
  191. {ccxt-4.2.82.dist-info → ccxt-4.2.84.dist-info}/top_level.txt +0 -0
@@ -268,7 +268,7 @@ class coinone(Exchange, ImplicitAPI):
268
268
  }
269
269
  return result
270
270
 
271
- async def fetch_markets(self, params={}):
271
+ async def fetch_markets(self, params={}) -> List[Market]:
272
272
  """
273
273
  retrieves data on all markets for coinone
274
274
  :see: https://docs.coinone.co.kr/v1.0/reference/tickers
@@ -478,7 +478,7 @@ class coinsph(Exchange, ImplicitAPI):
478
478
  #
479
479
  return self.safe_integer(response, 'serverTime')
480
480
 
481
- async def fetch_markets(self, params={}):
481
+ async def fetch_markets(self, params={}) -> List[Market]:
482
482
  """
483
483
  retrieves data on all markets for coinsph
484
484
  :see: https://coins-docs.github.io/rest-api/#exchange-information
@@ -390,7 +390,7 @@ class cryptocom(Exchange, ImplicitAPI):
390
390
  },
391
391
  })
392
392
 
393
- async def fetch_markets(self, params={}):
393
+ async def fetch_markets(self, params={}) -> List[Market]:
394
394
  """
395
395
  :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-instruments
396
396
  retrieves data on all markets for cryptocom
@@ -395,7 +395,7 @@ class currencycom(Exchange, ImplicitAPI):
395
395
  }
396
396
  return result
397
397
 
398
- async def fetch_markets(self, params={}):
398
+ async def fetch_markets(self, params={}) -> List[Market]:
399
399
  """
400
400
  retrieves data on all markets for currencycom
401
401
  :see: https://apitradedoc.currency.com/swagger-ui.html#/rest-api/exchangeInfoUsingGET
@@ -513,7 +513,7 @@ class delta(Exchange, ImplicitAPI):
513
513
  result[numericIdString] = item
514
514
  return result
515
515
 
516
- async def fetch_markets(self, params={}):
516
+ async def fetch_markets(self, params={}) -> List[Market]:
517
517
  """
518
518
  retrieves data on all markets for delta
519
519
  :see: https://docs.delta.exchange/#get-list-of-products
@@ -752,7 +752,7 @@ class deribit(Exchange, ImplicitAPI):
752
752
  'code': self.safe_currency_code(None, currency),
753
753
  }
754
754
 
755
- async def fetch_markets(self, params={}):
755
+ async def fetch_markets(self, params={}) -> List[Market]:
756
756
  """
757
757
  retrieves data on all markets for deribit
758
758
  :see: https://docs.deribit.com/#public-get_currencies
@@ -1297,9 +1297,15 @@ class deribit(Exchange, ImplicitAPI):
1297
1297
  :param int [since]: timestamp in ms of the earliest candle to fetch
1298
1298
  :param int [limit]: the maximum amount of candles to fetch
1299
1299
  :param dict [params]: extra parameters specific to the exchange API endpoint
1300
+ :param boolean [params.paginate]: whether to paginate the results, set to False by default
1301
+ :param int [params.until]: the latest time in ms to fetch ohlcv for
1300
1302
  :returns int[][]: A list of candles ordered, open, high, low, close, volume
1301
1303
  """
1302
1304
  await self.load_markets()
1305
+ paginate = False
1306
+ paginate, params = self.handle_option_and_params(params, 'fetchOHLCV', 'paginate')
1307
+ if paginate:
1308
+ return await self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 5000)
1303
1309
  market = self.market(symbol)
1304
1310
  request = {
1305
1311
  'instrument_name': market['id'],
@@ -1319,6 +1325,10 @@ class deribit(Exchange, ImplicitAPI):
1319
1325
  request['end_timestamp'] = now
1320
1326
  else:
1321
1327
  request['end_timestamp'] = self.sum(since, limit * duration * 1000)
1328
+ until = self.safe_integer(params, 'until')
1329
+ if until is not None:
1330
+ params = self.omit(params, 'until')
1331
+ request['end_timestamp'] = until
1322
1332
  response = await self.publicGetGetTradingviewChartData(self.extend(request, params))
1323
1333
  #
1324
1334
  # {
@@ -1438,6 +1448,7 @@ class deribit(Exchange, ImplicitAPI):
1438
1448
  :param int [since]: timestamp in ms of the earliest trade to fetch
1439
1449
  :param int [limit]: the maximum amount of trades to fetch
1440
1450
  :param dict [params]: extra parameters specific to the exchange API endpoint
1451
+ :param int [params.until]: the latest time in ms to fetch trades for
1441
1452
  :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
1442
1453
  """
1443
1454
  await self.load_markets()
@@ -1450,8 +1461,12 @@ class deribit(Exchange, ImplicitAPI):
1450
1461
  request['start_timestamp'] = since
1451
1462
  if limit is not None:
1452
1463
  request['count'] = min(limit, 1000) # default 10
1464
+ until = self.safe_integer_2(params, 'until', 'end_timestamp')
1465
+ if until is not None:
1466
+ params = self.omit(params, ['until'])
1467
+ request['end_timestamp'] = until
1453
1468
  response = None
1454
- if since is None:
1469
+ if (since is None) and not ('end_timestamp' in request):
1455
1470
  response = await self.publicGetGetLastTradesByInstrument(self.extend(request, params))
1456
1471
  else:
1457
1472
  response = await self.publicGetGetLastTradesByInstrumentAndTime(self.extend(request, params))
@@ -523,7 +523,7 @@ class digifinex(Exchange, ImplicitAPI):
523
523
  result[code]['precision'] = precision if (result[code]['precision'] is None) else max(result[code]['precision'], precision)
524
524
  return result
525
525
 
526
- async def fetch_markets(self, params={}):
526
+ async def fetch_markets(self, params={}) -> List[Market]:
527
527
  """
528
528
  retrieves data on all markets for digifinex
529
529
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -683,7 +683,7 @@ class exmo(Exchange, ImplicitAPI):
683
683
  }
684
684
  return result
685
685
 
686
- async def fetch_markets(self, params={}):
686
+ async def fetch_markets(self, params={}) -> List[Market]:
687
687
  """
688
688
  retrieves data on all markets for exmo
689
689
  :see: https://documenter.getpostman.com/view/10287440/SzYXWKPi#7de7e75c-5833-45a8-b937-c2276d235aaa
@@ -967,7 +967,7 @@ class gate(Exchange, ImplicitAPI):
967
967
  return self.create_expired_option_market(marketId)
968
968
  return super(gate, self).safe_market(marketId, market, delimiter, marketType)
969
969
 
970
- async def fetch_markets(self, params={}):
970
+ async def fetch_markets(self, params={}) -> List[Market]:
971
971
  """
972
972
  retrieves data on all markets for gate
973
973
  :see: https://www.gate.io/docs/developers/apiv4/en/#list-all-currency-pairs-supported # spot
@@ -264,6 +264,7 @@ class gemini(Exchange, ImplicitAPI):
264
264
  'broad': {
265
265
  'The Gemini Exchange is currently undergoing maintenance.': OnMaintenance, # The Gemini Exchange is currently undergoing maintenance. Please check https://status.gemini.com/ for more information.
266
266
  'We are investigating technical issues with the Gemini Exchange.': ExchangeNotAvailable, # We are investigating technical issues with the Gemini Exchange. Please check https://status.gemini.com/ for more information.
267
+ 'Internal Server Error': ExchangeNotAvailable,
267
268
  },
268
269
  },
269
270
  'options': {
@@ -400,7 +401,7 @@ class gemini(Exchange, ImplicitAPI):
400
401
  }
401
402
  return result
402
403
 
403
- async def fetch_markets(self, params={}):
404
+ async def fetch_markets(self, params={}) -> List[Market]:
404
405
  """
405
406
  retrieves data on all markets for gemini
406
407
  :see: https://docs.gemini.com/rest-api/#symbols
@@ -665,7 +665,7 @@ class hitbtc(Exchange, ImplicitAPI):
665
665
  def nonce(self):
666
666
  return self.milliseconds()
667
667
 
668
- async def fetch_markets(self, params={}):
668
+ async def fetch_markets(self, params={}) -> List[Market]:
669
669
  """
670
670
  retrieves data on all markets for hitbtc
671
671
  :see: https://api.hitbtc.com/#symbols
@@ -215,7 +215,7 @@ class hollaex(Exchange, ImplicitAPI):
215
215
  },
216
216
  })
217
217
 
218
- async def fetch_markets(self, params={}):
218
+ async def fetch_markets(self, params={}) -> List[Market]:
219
219
  """
220
220
  retrieves data on all markets for hollaex
221
221
  :see: https://apidocs.hollaex.com/#constants
ccxt/async_support/htx.py CHANGED
@@ -1601,7 +1601,7 @@ class htx(Exchange, ImplicitAPI):
1601
1601
  def cost_to_precision(self, symbol, cost):
1602
1602
  return self.decimal_to_precision(cost, TRUNCATE, self.markets[symbol]['precision']['cost'], self.precisionMode)
1603
1603
 
1604
- async def fetch_markets(self, params={}):
1604
+ async def fetch_markets(self, params={}) -> List[Market]:
1605
1605
  """
1606
1606
  retrieves data on all markets for huobi
1607
1607
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2141,7 +2141,7 @@ class htx(Exchange, ImplicitAPI):
2141
2141
  # "ts":1639547261293
2142
2142
  # }
2143
2143
  #
2144
- # inverse swaps, linear swaps, inverse futures
2144
+ # linear swap, linear future, inverse swap, inverse future
2145
2145
  #
2146
2146
  # {
2147
2147
  # "status":"ok",
@@ -2158,37 +2158,15 @@ class htx(Exchange, ImplicitAPI):
2158
2158
  # "high":"0.10725",
2159
2159
  # "amount":"2340267.415144052378486261756692535687481566",
2160
2160
  # "count":882,
2161
- # "vol":"24706"
2161
+ # "vol":"24706",
2162
+ # "trade_turnover":"840726.5048", # only in linear futures
2163
+ # "business_type":"futures", # only in linear futures
2164
+ # "contract_code":"BTC-USDT-CW", # only in linear futures, instead of 'symbol'
2162
2165
  # }
2163
2166
  # ],
2164
2167
  # "ts":1637504679376
2165
2168
  # }
2166
2169
  #
2167
- # linear futures
2168
- #
2169
- # {
2170
- # "status":"ok",
2171
- # "ticks":[
2172
- # {
2173
- # "id":1640745627,
2174
- # "ts":1640745627957,
2175
- # "ask":[48079.1,20],
2176
- # "bid":[47713.8,125],
2177
- # "business_type":"futures",
2178
- # "contract_code":"BTC-USDT-CW",
2179
- # "open":"49011.8",
2180
- # "close":"47934",
2181
- # "low":"47292.3",
2182
- # "high":"49011.8",
2183
- # "amount":"17.398",
2184
- # "count":1515,
2185
- # "vol":"17398",
2186
- # "trade_turnover":"840726.5048"
2187
- # }
2188
- # ],
2189
- # "ts":1640745627988
2190
- # }
2191
- #
2192
2170
  tickers = self.safe_value_2(response, 'data', 'ticks', [])
2193
2171
  timestamp = self.safe_integer(response, 'ts')
2194
2172
  result = {}
@@ -419,7 +419,7 @@ class huobijp(Exchange, ImplicitAPI):
419
419
  def cost_to_precision(self, symbol, cost):
420
420
  return self.decimal_to_precision(cost, TRUNCATE, self.markets[symbol]['precision']['cost'], self.precisionMode)
421
421
 
422
- async def fetch_markets(self, params={}):
422
+ async def fetch_markets(self, params={}) -> List[Market]:
423
423
  """
424
424
  retrieves data on all markets for huobijp
425
425
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -250,7 +250,7 @@ class hyperliquid(Exchange, ImplicitAPI):
250
250
  }
251
251
  return result
252
252
 
253
- async def fetch_markets(self, params={}):
253
+ async def fetch_markets(self, params={}) -> List[Market]:
254
254
  """
255
255
  retrieves data on all markets for hyperliquid
256
256
  :see: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-asset-contexts-includes-mark-price-current-funding-open-interest-etc
@@ -1691,7 +1691,7 @@ class hyperliquid(Exchange, ImplicitAPI):
1691
1691
  if leverage is None:
1692
1692
  raise ArgumentsRequired(self.id + ' setMarginMode() requires a leverage parameter')
1693
1693
  asset = self.parse_to_int(market['baseId'])
1694
- isCross = (marginMode == 'isolated')
1694
+ isCross = (marginMode == 'cross')
1695
1695
  nonce = self.milliseconds()
1696
1696
  params = self.omit(params, ['leverage'])
1697
1697
  updateAction = {
@@ -1705,16 +1705,17 @@ class hyperliquid(Exchange, ImplicitAPI):
1705
1705
  params = self.omit(params, 'vaultAddress')
1706
1706
  if vaultAddress.startswith('0x'):
1707
1707
  vaultAddress = vaultAddress.replace('0x', '')
1708
- signature = self.sign_l1_action(updateAction, nonce, vaultAddress)
1708
+ extendedAction = self.extend(updateAction, params)
1709
+ signature = self.sign_l1_action(extendedAction, nonce, vaultAddress)
1709
1710
  request = {
1710
- 'action': updateAction,
1711
+ 'action': extendedAction,
1711
1712
  'nonce': nonce,
1712
1713
  'signature': signature,
1713
1714
  # 'vaultAddress': vaultAddress,
1714
1715
  }
1715
1716
  if vaultAddress is not None:
1716
1717
  request['vaultAddress'] = vaultAddress
1717
- response = await self.privatePostExchange(self.extend(request, params))
1718
+ response = await self.privatePostExchange(request)
1718
1719
  #
1719
1720
  # {
1720
1721
  # 'response': {
@@ -204,7 +204,7 @@ class idex(Exchange, ImplicitAPI):
204
204
  price = self.decimal_to_precision(price, ROUND, market['precision']['price'], self.precisionMode)
205
205
  return self.decimal_to_precision(price, TRUNCATE, quoteAssetPrecision, DECIMAL_PLACES, PAD_WITH_ZERO)
206
206
 
207
- async def fetch_markets(self, params={}):
207
+ async def fetch_markets(self, params={}) -> List[Market]:
208
208
  """
209
209
  retrieves data on all markets for idex
210
210
  :see: https://api-docs-v3.idex.io/#get-markets
@@ -143,7 +143,7 @@ class independentreserve(Exchange, ImplicitAPI):
143
143
  'precisionMode': TICK_SIZE,
144
144
  })
145
145
 
146
- async def fetch_markets(self, params={}):
146
+ async def fetch_markets(self, params={}) -> List[Market]:
147
147
  """
148
148
  retrieves data on all markets for independentreserve
149
149
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -229,7 +229,7 @@ class indodax(Exchange, ImplicitAPI):
229
229
  #
230
230
  return self.safe_integer(response, 'server_time')
231
231
 
232
- async def fetch_markets(self, params={}):
232
+ async def fetch_markets(self, params={}) -> List[Market]:
233
233
  """
234
234
  retrieves data on all markets for indodax
235
235
  :see: https://github.com/btcid/indodax-official-api-docs/blob/master/Public-RestAPI.md#pairs
@@ -465,7 +465,7 @@ class kraken(Exchange, ImplicitAPI):
465
465
  def fee_to_precision(self, symbol, fee):
466
466
  return self.decimal_to_precision(fee, TRUNCATE, self.markets[symbol]['precision']['amount'], self.precisionMode)
467
467
 
468
- async def fetch_markets(self, params={}):
468
+ async def fetch_markets(self, params={}) -> List[Market]:
469
469
  """
470
470
  retrieves data on all markets for kraken
471
471
  :see: https://docs.kraken.com/rest/#tag/Spot-Market-Data/operation/getTradableAssetPairs
@@ -280,7 +280,7 @@ class krakenfutures(Exchange, ImplicitAPI):
280
280
  },
281
281
  })
282
282
 
283
- async def fetch_markets(self, params={}):
283
+ async def fetch_markets(self, params={}) -> List[Market]:
284
284
  """
285
285
  Fetches the available trading markets from the exchange, Multi-collateral markets are returned markets, but can be settled in multiple currencies
286
286
  :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-instrument-details-get-instruments
@@ -26,6 +26,7 @@ from ccxt.base.errors import RateLimitExceeded
26
26
  from ccxt.base.errors import ExchangeNotAvailable
27
27
  from ccxt.base.errors import InvalidNonce
28
28
  from ccxt.base.errors import AuthenticationError
29
+ from ccxt.base.decimal_to_precision import TRUNCATE
29
30
  from ccxt.base.decimal_to_precision import TICK_SIZE
30
31
  from ccxt.base.precise import Precise
31
32
 
@@ -442,6 +443,7 @@ class kucoin(Exchange, ImplicitAPI):
442
443
  'Order size below the minimum requirement.': InvalidOrder, # {"code":"400100","msg":"Order size below the minimum requirement."}
443
444
  'The withdrawal amount is below the minimum requirement.': ExchangeError, # {"code":"400100","msg":"The withdrawal amount is below the minimum requirement."}
444
445
  'Unsuccessful! Exceeded the max. funds out-transfer limit': InsufficientFunds, # {"code":"200000","msg":"Unsuccessful! Exceeded the max. funds out-transfer limit"}
446
+ 'The amount increment is invalid.': BadRequest,
445
447
  '400': BadRequest,
446
448
  '401': AuthenticationError,
447
449
  '403': NotSupported,
@@ -992,7 +994,7 @@ class kucoin(Exchange, ImplicitAPI):
992
994
  'info': response,
993
995
  }
994
996
 
995
- async def fetch_markets(self, params={}):
997
+ async def fetch_markets(self, params={}) -> List[Market]:
996
998
  """
997
999
  retrieves data on all markets for kucoin
998
1000
  :see: https://docs.kucoin.com/#get-symbols-list-deprecated
@@ -2092,6 +2094,13 @@ class kucoin(Exchange, ImplicitAPI):
2092
2094
  data = self.safe_list(data, 'data', [])
2093
2095
  return self.parse_orders(data)
2094
2096
 
2097
+ def market_order_amount_to_precision(self, symbol: str, amount):
2098
+ market = self.market(symbol)
2099
+ result = self.decimal_to_precision(amount, TRUNCATE, market['info']['quoteIncrement'], self.precisionMode, self.paddingMode)
2100
+ if result == '0':
2101
+ raise InvalidOrder(self.id + ' amount of ' + market['symbol'] + ' must be greater than minimum amount precision of ' + self.number_to_string(market['precision']['amount']))
2102
+ return result
2103
+
2095
2104
  def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
2096
2105
  market = self.market(symbol)
2097
2106
  # required param, cannot be used twice
@@ -2112,7 +2121,7 @@ class kucoin(Exchange, ImplicitAPI):
2112
2121
  if quoteAmount is not None:
2113
2122
  params = self.omit(params, ['cost', 'funds'])
2114
2123
  # kucoin uses base precision even for quote values
2115
- costString = self.amount_to_precision(symbol, quoteAmount)
2124
+ costString = self.market_order_amount_to_precision(symbol, quoteAmount)
2116
2125
  request['funds'] = costString
2117
2126
  else:
2118
2127
  amountString = self.amount_to_precision(symbol, amount)
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.async_support.kucoin import kucoin
7
7
  from ccxt.abstract.kucoinfutures import ImplicitAPI
8
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Trade, Transaction, TransferEntry
8
+ from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
9
  from typing import List
10
10
  from ccxt.base.errors import PermissionDenied
11
11
  from ccxt.base.errors import AccountSuspended
@@ -95,7 +95,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
95
95
  'fetchPremiumIndexOHLCV': False,
96
96
  'fetchStatus': True,
97
97
  'fetchTicker': True,
98
- 'fetchTickers': False,
98
+ 'fetchTickers': True,
99
99
  'fetchTime': True,
100
100
  'fetchTrades': True,
101
101
  'fetchTransactionFee': False,
@@ -368,7 +368,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
368
368
  'info': response,
369
369
  }
370
370
 
371
- async def fetch_markets(self, params={}):
371
+ async def fetch_markets(self, params={}) -> List[Market]:
372
372
  """
373
373
  retrieves data on all markets for kucoinfutures
374
374
  :see: https://www.kucoin.com/docs/rest/futures-trading/market-data/get-symbols-list
@@ -735,6 +735,83 @@ class kucoinfutures(kucoin, ImplicitAPI):
735
735
  #
736
736
  return self.parse_ticker(response['data'], market)
737
737
 
738
+ async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
739
+ """
740
+ fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
741
+ :see: https://www.kucoin.com/docs/rest/futures-trading/market-data/get-symbols-list
742
+ :param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
743
+ :param dict [params]: extra parameters specific to the exchange API endpoint
744
+ :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
745
+ """
746
+ await self.load_markets()
747
+ symbols = self.market_symbols(symbols)
748
+ response = await self.futuresPublicGetContractsActive(params)
749
+ #
750
+ # {
751
+ # "code": "200000",
752
+ # "data": {
753
+ # "symbol": "ETHUSDTM",
754
+ # "rootSymbol": "USDT",
755
+ # "type": "FFWCSX",
756
+ # "firstOpenDate": 1591086000000,
757
+ # "expireDate": null,
758
+ # "settleDate": null,
759
+ # "baseCurrency": "ETH",
760
+ # "quoteCurrency": "USDT",
761
+ # "settleCurrency": "USDT",
762
+ # "maxOrderQty": 1000000,
763
+ # "maxPrice": 1000000.0000000000,
764
+ # "lotSize": 1,
765
+ # "tickSize": 0.05,
766
+ # "indexPriceTickSize": 0.01,
767
+ # "multiplier": 0.01,
768
+ # "initialMargin": 0.01,
769
+ # "maintainMargin": 0.005,
770
+ # "maxRiskLimit": 1000000,
771
+ # "minRiskLimit": 1000000,
772
+ # "riskStep": 500000,
773
+ # "makerFeeRate": 0.00020,
774
+ # "takerFeeRate": 0.00060,
775
+ # "takerFixFee": 0.0000000000,
776
+ # "makerFixFee": 0.0000000000,
777
+ # "settlementFee": null,
778
+ # "isDeleverage": True,
779
+ # "isQuanto": True,
780
+ # "isInverse": False,
781
+ # "markMethod": "FairPrice",
782
+ # "fairMethod": "FundingRate",
783
+ # "fundingBaseSymbol": ".ETHINT8H",
784
+ # "fundingQuoteSymbol": ".USDTINT8H",
785
+ # "fundingRateSymbol": ".ETHUSDTMFPI8H",
786
+ # "indexSymbol": ".KETHUSDT",
787
+ # "settlementSymbol": "",
788
+ # "status": "Open",
789
+ # "fundingFeeRate": 0.000535,
790
+ # "predictedFundingFeeRate": 0.002197,
791
+ # "openInterest": "8724443",
792
+ # "turnoverOf24h": 341156641.03354263,
793
+ # "volumeOf24h": 74833.54000000,
794
+ # "markPrice": 4534.07,
795
+ # "indexPrice":4531.92,
796
+ # "lastTradePrice": 4545.4500000000,
797
+ # "nextFundingRateTime": 25481884,
798
+ # "maxLeverage": 100,
799
+ # "sourceExchanges": ["huobi", "Okex", "Binance", "Kucoin", "Poloniex", "Hitbtc"],
800
+ # "premiumsSymbol1M": ".ETHUSDTMPI",
801
+ # "premiumsSymbol8H": ".ETHUSDTMPI8H",
802
+ # "fundingBaseSymbol1M": ".ETHINT",
803
+ # "fundingQuoteSymbol1M": ".USDTINT",
804
+ # "lowPrice": 4456.90,
805
+ # "highPrice": 4674.25,
806
+ # "priceChgPct": 0.0046,
807
+ # "priceChg": 21.15
808
+ # }
809
+ # }
810
+ #
811
+ data = self.safe_list(response, 'data', [])
812
+ tickers = self.parse_tickers(data, symbols)
813
+ return self.filter_by_array_tickers(tickers, 'symbol', symbols)
814
+
738
815
  def parse_ticker(self, ticker, market: Market = None) -> Ticker:
739
816
  #
740
817
  # {
@@ -754,16 +831,76 @@ class kucoinfutures(kucoin, ImplicitAPI):
754
831
  # }
755
832
  # }
756
833
  #
757
- last = self.safe_string(ticker, 'price')
834
+ # from fetchTickers
835
+ #
836
+ # {
837
+ # symbol: "XBTUSDTM",
838
+ # rootSymbol: "USDT",
839
+ # type: "FFWCSX",
840
+ # firstOpenDate: 1585555200000,
841
+ # expireDate: null,
842
+ # settleDate: null,
843
+ # baseCurrency: "XBT",
844
+ # quoteCurrency: "USDT",
845
+ # settleCurrency: "USDT",
846
+ # maxOrderQty: 1000000,
847
+ # maxPrice: 1000000,
848
+ # lotSize: 1,
849
+ # tickSize: 0.1,
850
+ # indexPriceTickSize: 0.01,
851
+ # multiplier: 0.001,
852
+ # initialMargin: 0.008,
853
+ # maintainMargin: 0.004,
854
+ # maxRiskLimit: 100000,
855
+ # minRiskLimit: 100000,
856
+ # riskStep: 50000,
857
+ # makerFeeRate: 0.0002,
858
+ # takerFeeRate: 0.0006,
859
+ # takerFixFee: 0,
860
+ # makerFixFee: 0,
861
+ # settlementFee: null,
862
+ # isDeleverage: True,
863
+ # isQuanto: True,
864
+ # isInverse: False,
865
+ # markMethod: "FairPrice",
866
+ # fairMethod: "FundingRate",
867
+ # fundingBaseSymbol: ".XBTINT8H",
868
+ # fundingQuoteSymbol: ".USDTINT8H",
869
+ # fundingRateSymbol: ".XBTUSDTMFPI8H",
870
+ # indexSymbol: ".KXBTUSDT",
871
+ # settlementSymbol: "",
872
+ # status: "Open",
873
+ # fundingFeeRate: 0.000297,
874
+ # predictedFundingFeeRate: 0.000327,
875
+ # fundingRateGranularity: 28800000,
876
+ # openInterest: "8033200",
877
+ # turnoverOf24h: 659795309.2524643,
878
+ # volumeOf24h: 9998.54,
879
+ # markPrice: 67193.51,
880
+ # indexPrice: 67184.81,
881
+ # lastTradePrice: 67191.8,
882
+ # nextFundingRateTime: 20022985,
883
+ # maxLeverage: 125,
884
+ # premiumsSymbol1M: ".XBTUSDTMPI",
885
+ # premiumsSymbol8H: ".XBTUSDTMPI8H",
886
+ # fundingBaseSymbol1M: ".XBTINT",
887
+ # fundingQuoteSymbol1M: ".USDTINT",
888
+ # lowPrice: 64041.6,
889
+ # highPrice: 67737.3,
890
+ # priceChgPct: 0.0447,
891
+ # priceChg: 2878.7
892
+ # }
893
+ #
758
894
  marketId = self.safe_string(ticker, 'symbol')
759
895
  market = self.safe_market(marketId, market, '-')
896
+ last = self.safe_string_2(ticker, 'price', 'lastTradePrice')
760
897
  timestamp = self.safe_integer_product(ticker, 'ts', 0.000001)
761
898
  return self.safe_ticker({
762
899
  'symbol': market['symbol'],
763
900
  'timestamp': timestamp,
764
901
  'datetime': self.iso8601(timestamp),
765
- 'high': None,
766
- 'low': None,
902
+ 'high': self.safe_string(ticker, 'highPrice'),
903
+ 'low': self.safe_string(ticker, 'lowPrice'),
767
904
  'bid': self.safe_string(ticker, 'bestBidPrice'),
768
905
  'bidVolume': self.safe_string(ticker, 'bestBidSize'),
769
906
  'ask': self.safe_string(ticker, 'bestAskPrice'),
@@ -773,11 +910,11 @@ class kucoinfutures(kucoin, ImplicitAPI):
773
910
  'close': last,
774
911
  'last': last,
775
912
  'previousClose': None,
776
- 'change': None,
777
- 'percentage': None,
913
+ 'change': self.safe_string(ticker, 'priceChg'),
914
+ 'percentage': self.safe_string(ticker, 'priceChgPct'),
778
915
  'average': None,
779
- 'baseVolume': None,
780
- 'quoteVolume': None,
916
+ 'baseVolume': self.safe_string(ticker, 'volumeOf24h'),
917
+ 'quoteVolume': self.safe_string(ticker, 'turnoverOf24h'),
781
918
  'info': ticker,
782
919
  }, market)
783
920
 
@@ -517,7 +517,7 @@ class kuna(Exchange, ImplicitAPI):
517
517
  'networks': {},
518
518
  }
519
519
 
520
- async def fetch_markets(self, params={}):
520
+ async def fetch_markets(self, params={}) -> List[Market]:
521
521
  """
522
522
  retrieves data on all markets for kuna
523
523
  :see: https://docs.kuna.io/docs/get-all-traded-markets
@@ -256,7 +256,7 @@ class latoken(Exchange, ImplicitAPI):
256
256
  #
257
257
  return self.safe_integer(response, 'serverTime')
258
258
 
259
- async def fetch_markets(self, params={}):
259
+ async def fetch_markets(self, params={}) -> List[Market]:
260
260
  """
261
261
  retrieves data on all markets for latoken
262
262
  :see: https://api.latoken.com/doc/v2/#tag/Pair/operation/getActivePairs
@@ -345,7 +345,7 @@ class lbank(Exchange, ImplicitAPI):
345
345
  #
346
346
  return self.safe_integer(response, 'data')
347
347
 
348
- async def fetch_markets(self, params={}):
348
+ async def fetch_markets(self, params={}) -> List[Market]:
349
349
  """
350
350
  retrieves data on all markets for lbank
351
351
  :see: https://www.lbank.com/en-US/docs/index.html#trading-pairs
@@ -180,7 +180,7 @@ class luno(Exchange, ImplicitAPI):
180
180
  'precisionMode': TICK_SIZE,
181
181
  })
182
182
 
183
- async def fetch_markets(self, params={}):
183
+ async def fetch_markets(self, params={}) -> List[Market]:
184
184
  """
185
185
  retrieves data on all markets for luno
186
186
  :see: https://www.luno.com/en/developers/api#tag/Market/operation/Markets
@@ -263,7 +263,7 @@ class lykke(Exchange, ImplicitAPI):
263
263
  }
264
264
  return result
265
265
 
266
- async def fetch_markets(self, params={}):
266
+ async def fetch_markets(self, params={}) -> List[Market]:
267
267
  """
268
268
  retrieves data on all markets for lykke
269
269
  :see: https://lykkecity.github.io/Trading-API/#get-asset-by-id