ccxt 4.4.44__py2.py3-none-any.whl → 4.4.45__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 (69) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/blofin.py +22 -0
  3. ccxt/async_support/__init__.py +1 -1
  4. ccxt/async_support/base/exchange.py +1 -1
  5. ccxt/async_support/binance.py +178 -62
  6. ccxt/async_support/bingx.py +15 -9
  7. ccxt/async_support/bitfinex.py +1 -1
  8. ccxt/async_support/bitget.py +3 -3
  9. ccxt/async_support/bitmart.py +3 -3
  10. ccxt/async_support/bitmex.py +1 -1
  11. ccxt/async_support/blofin.py +22 -0
  12. ccxt/async_support/bybit.py +4 -4
  13. ccxt/async_support/coinbase.py +1 -1
  14. ccxt/async_support/coinex.py +1 -1
  15. ccxt/async_support/cryptocom.py +1 -1
  16. ccxt/async_support/exmo.py +16 -8
  17. ccxt/async_support/gate.py +1 -1
  18. ccxt/async_support/hashkey.py +6 -1
  19. ccxt/async_support/htx.py +2 -2
  20. ccxt/async_support/hyperliquid.py +1 -1
  21. ccxt/async_support/kraken.py +1 -1
  22. ccxt/async_support/krakenfutures.py +1 -1
  23. ccxt/async_support/kucoin.py +1 -1
  24. ccxt/async_support/kucoinfutures.py +2 -3
  25. ccxt/async_support/lykke.py +1 -1
  26. ccxt/async_support/mexc.py +2 -2
  27. ccxt/async_support/myokx.py +8 -0
  28. ccxt/async_support/okx.py +4 -4
  29. ccxt/async_support/onetrading.py +2 -1
  30. ccxt/async_support/whitebit.py +31 -8
  31. ccxt/async_support/woo.py +1 -1
  32. ccxt/async_support/woofipro.py +2 -2
  33. ccxt/base/exchange.py +1 -1
  34. ccxt/binance.py +178 -62
  35. ccxt/bingx.py +15 -9
  36. ccxt/bitfinex.py +1 -1
  37. ccxt/bitget.py +3 -3
  38. ccxt/bitmart.py +3 -3
  39. ccxt/bitmex.py +1 -1
  40. ccxt/blofin.py +22 -0
  41. ccxt/bybit.py +4 -4
  42. ccxt/coinbase.py +1 -1
  43. ccxt/coinex.py +1 -1
  44. ccxt/cryptocom.py +1 -1
  45. ccxt/exmo.py +16 -8
  46. ccxt/gate.py +1 -1
  47. ccxt/hashkey.py +6 -1
  48. ccxt/htx.py +2 -2
  49. ccxt/hyperliquid.py +1 -1
  50. ccxt/kraken.py +1 -1
  51. ccxt/krakenfutures.py +1 -1
  52. ccxt/kucoin.py +1 -1
  53. ccxt/kucoinfutures.py +2 -3
  54. ccxt/lykke.py +1 -1
  55. ccxt/mexc.py +2 -2
  56. ccxt/myokx.py +8 -0
  57. ccxt/okx.py +4 -4
  58. ccxt/onetrading.py +2 -1
  59. ccxt/pro/__init__.py +1 -1
  60. ccxt/pro/binance.py +2 -1
  61. ccxt/pro/myokx.py +5 -0
  62. ccxt/whitebit.py +31 -8
  63. ccxt/woo.py +1 -1
  64. ccxt/woofipro.py +2 -2
  65. {ccxt-4.4.44.dist-info → ccxt-4.4.45.dist-info}/METADATA +4 -4
  66. {ccxt-4.4.44.dist-info → ccxt-4.4.45.dist-info}/RECORD +69 -69
  67. {ccxt-4.4.44.dist-info → ccxt-4.4.45.dist-info}/LICENSE.txt +0 -0
  68. {ccxt-4.4.44.dist-info → ccxt-4.4.45.dist-info}/WHEEL +0 -0
  69. {ccxt-4.4.44.dist-info → ccxt-4.4.45.dist-info}/top_level.txt +0 -0
@@ -1116,7 +1116,7 @@ class bybit(Exchange, ImplicitAPI):
1116
1116
  'mark': True,
1117
1117
  'index': True,
1118
1118
  },
1119
- 'limitPrice': True,
1119
+ 'price': True,
1120
1120
  },
1121
1121
  'timeInForce': {
1122
1122
  'IOC': True,
@@ -1156,7 +1156,7 @@ class bybit(Exchange, ImplicitAPI):
1156
1156
  'fetchClosedOrders': {
1157
1157
  'marginMode': False,
1158
1158
  'limit': 50,
1159
- 'daysBackClosed': 365 * 2, # 2 years
1159
+ 'daysBack': 365 * 2, # 2 years
1160
1160
  'daysBackCanceled': 1,
1161
1161
  'untilDays': 7,
1162
1162
  'trigger': True,
@@ -1173,7 +1173,7 @@ class bybit(Exchange, ImplicitAPI):
1173
1173
  'triggerDirection': False,
1174
1174
  'attachedStopLossTakeProfit': {
1175
1175
  'triggerPriceType': None,
1176
- 'limitPrice': True,
1176
+ 'price': True,
1177
1177
  },
1178
1178
  'marketBuyRequiresPrice': True,
1179
1179
  },
@@ -1254,7 +1254,7 @@ class bybit(Exchange, ImplicitAPI):
1254
1254
  :param dict [params]: extra parameters specific to the exchange API endpoint
1255
1255
  :returns any: [enableUnifiedMargin, enableUnifiedAccount]
1256
1256
  """
1257
- # The API key of user id must own one of permissions will be allowed to call following API endpoints.
1257
+ # The API key of user id must own one of permissions will be allowed to call following API endpoints:
1258
1258
  # SUB UID: "Account Transfer"
1259
1259
  # MASTER UID: "Account Transfer", "Subaccount Transfer", "Withdrawal"
1260
1260
  enableUnifiedMargin = self.safe_bool(self.options, 'enableUnifiedMargin')
@@ -439,7 +439,7 @@ class coinbase(Exchange, ImplicitAPI):
439
439
  'fetchClosedOrders': {
440
440
  'marginMode': False,
441
441
  'limit': None,
442
- 'daysBackClosed': None,
442
+ 'daysBack': None,
443
443
  'daysBackCanceled': None,
444
444
  'untilDays': 10000,
445
445
  'trigger': False,
@@ -563,7 +563,7 @@ class coinex(Exchange, ImplicitAPI):
563
563
  'fetchClosedOrders': {
564
564
  'marginMode': True,
565
565
  'limit': 1000,
566
- 'daysBackClosed': None,
566
+ 'daysBack': None,
567
567
  'daysBackCanceled': None,
568
568
  'untilDays': None,
569
569
  'trigger': True,
@@ -427,7 +427,7 @@ class cryptocom(Exchange, ImplicitAPI):
427
427
  'fetchClosedOrders': {
428
428
  'marginMode': False,
429
429
  'limit': 100,
430
- 'daysBackClosed': None,
430
+ 'daysBack': None,
431
431
  'daysBackCanceled': None,
432
432
  'untilDays': 1,
433
433
  'trigger': False,
@@ -846,32 +846,40 @@ class exmo(Exchange, ImplicitAPI):
846
846
  :param int [since]: timestamp in ms of the earliest candle to fetch
847
847
  :param int [limit]: the maximum amount of candles to fetch
848
848
  :param dict [params]: extra parameters specific to the exchange API endpoint
849
+ :param int [params.until]: timestamp in ms of the latest candle to fetch
849
850
  :returns int[][]: A list of candles ordered, open, high, low, close, volume
850
851
  """
851
852
  await self.load_markets()
852
853
  market = self.market(symbol)
854
+ until = self.safe_integer_product(params, 'until', 0.001)
855
+ untilIsDefined = (until is not None)
853
856
  request: dict = {
854
857
  'symbol': market['id'],
855
858
  'resolution': self.safe_string(self.timeframes, timeframe, timeframe),
856
859
  }
857
860
  maxLimit = 3000
858
861
  duration = self.parse_timeframe(timeframe)
859
- now = self.milliseconds()
862
+ now = self.parse_to_int(self.milliseconds() / 1000)
860
863
  if since is None:
864
+ to = min(until, now) if untilIsDefined else now
861
865
  if limit is None:
862
866
  limit = 1000 # cap default at generous amount
863
867
  else:
864
868
  limit = min(limit, maxLimit)
865
- request['from'] = self.parse_to_int(now / 1000) - limit * duration - 1
866
- request['to'] = self.parse_to_int(now / 1000)
869
+ request['from'] = to - (limit * duration) - 1
870
+ request['to'] = to
867
871
  else:
868
872
  request['from'] = self.parse_to_int(since / 1000) - 1
869
- if limit is None:
870
- limit = maxLimit
873
+ if untilIsDefined:
874
+ request['to'] = min(until, now)
871
875
  else:
872
- limit = min(limit, maxLimit)
873
- to = self.sum(since, limit * duration * 1000)
874
- request['to'] = self.parse_to_int(to / 1000)
876
+ if limit is None:
877
+ limit = maxLimit
878
+ else:
879
+ limit = min(limit, maxLimit)
880
+ to = self.sum(since, limit * duration)
881
+ request['to'] = min(to, now)
882
+ params = self.omit(params, 'until')
875
883
  response = await self.publicGetCandlesHistory(self.extend(request, params))
876
884
  #
877
885
  # {
@@ -776,7 +776,7 @@ class gate(Exchange, ImplicitAPI):
776
776
  'trailing': False,
777
777
  'limit': 100,
778
778
  'untilDays': 30,
779
- 'daysBackClosed': None,
779
+ 'daysBack': None,
780
780
  'daysBackCanceled': None,
781
781
  },
782
782
  'fetchOHLCV': {
@@ -1454,9 +1454,14 @@ class hashkey(Exchange, ImplicitAPI):
1454
1454
  if isBuyer is not None:
1455
1455
  side = 'buy' if isBuyer else 'sell'
1456
1456
  takerOrMaker = None
1457
- isMaker = self.safe_bool_n(trade, ['isMaker', 'isMarker', 'ibm'])
1457
+ isMaker = self.safe_bool_n(trade, ['isMaker', 'isMarker'])
1458
1458
  if isMaker is not None:
1459
1459
  takerOrMaker = 'maker' if isMaker else 'taker'
1460
+ isBuyerMaker = self.safe_bool(trade, 'ibm')
1461
+ # if public trade
1462
+ if isBuyerMaker is not None:
1463
+ takerOrMaker = 'taker'
1464
+ side = 'sell' if isBuyerMaker else 'buy'
1460
1465
  feeCost = self.safe_string(trade, 'commission')
1461
1466
  feeCurrncyId = self.safe_string(trade, 'commissionAsset')
1462
1467
  feeInfo = self.safe_dict(trade, 'fee')
ccxt/async_support/htx.py CHANGED
@@ -1311,7 +1311,7 @@ class htx(Exchange, ImplicitAPI):
1311
1311
  'trailing': False,
1312
1312
  'untilDays': 2,
1313
1313
  'limit': 500,
1314
- 'daysBackClosed': 180,
1314
+ 'daysBack': 180,
1315
1315
  'daysBackCanceled': 1 / 12,
1316
1316
  },
1317
1317
  'fetchOHLCV': {
@@ -1352,7 +1352,7 @@ class htx(Exchange, ImplicitAPI):
1352
1352
  'trailing': False,
1353
1353
  'untilDays': 2,
1354
1354
  'limit': 50,
1355
- 'daysBackClosed': 90,
1355
+ 'daysBack': 90,
1356
1356
  'daysBackCanceled': 1 / 12,
1357
1357
  },
1358
1358
  'fetchOHLCV': {
@@ -284,7 +284,7 @@ class hyperliquid(Exchange, ImplicitAPI):
284
284
  'fetchClosedOrders': {
285
285
  'marginMode': False,
286
286
  'limit': 2000,
287
- 'daysBackClosed': None,
287
+ 'daysBack': None,
288
288
  'daysBackCanceled': None,
289
289
  'untilDays': None,
290
290
  'trigger': False,
@@ -492,7 +492,7 @@ class kraken(Exchange, ImplicitAPI):
492
492
  'fetchClosedOrders': {
493
493
  'marginMode': False,
494
494
  'limit': None,
495
- 'daysBackClosed': None,
495
+ 'daysBack': None,
496
496
  'daysBackCanceled': None,
497
497
  'untilDays': 100000,
498
498
  'trigger': False,
@@ -325,7 +325,7 @@ class krakenfutures(Exchange, ImplicitAPI):
325
325
  'fetchClosedOrders': {
326
326
  'marginMode': False,
327
327
  'limit': None,
328
- 'daysBackClosed': None,
328
+ 'daysBack': None,
329
329
  'daysBackCanceled': None,
330
330
  'untilDays': None,
331
331
  'trigger': False,
@@ -1056,7 +1056,7 @@ class kucoin(Exchange, ImplicitAPI):
1056
1056
  'fetchClosedOrders': {
1057
1057
  'marginMode': True,
1058
1058
  'limit': 500,
1059
- 'daysBackClosed': None,
1059
+ 'daysBack': None,
1060
1060
  'daysBackCanceled': None,
1061
1061
  'untilDays': 7,
1062
1062
  'trigger': True,
@@ -386,9 +386,8 @@ class kucoinfutures(kucoin, ImplicitAPI):
386
386
  'stopLossPrice': True,
387
387
  'takeProfitPrice': True,
388
388
  'attachedStopLossTakeProfit': {
389
- 'triggerPrice': None,
390
389
  'triggerPriceType': None,
391
- 'limitPrice': True,
390
+ 'price': True,
392
391
  },
393
392
  'timeInForce': {
394
393
  'IOC': True,
@@ -428,7 +427,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
428
427
  'fetchClosedOrders': {
429
428
  'marginMode': False,
430
429
  'limit': 1000,
431
- 'daysBackClosed': None,
430
+ 'daysBack': None,
432
431
  'daysBackCanceled': None,
433
432
  'untilDays': None,
434
433
  'trigger': True,
@@ -209,7 +209,7 @@ class lykke(Exchange, ImplicitAPI):
209
209
  # {
210
210
  # "payload":[
211
211
  # {
212
- # "assetId":"115a60c2-0da1-40f9-a7f2-41da723b9074",
212
+ # "assetId":"115a60c2-0da1-40f9-a7f2-41da723b9075",
213
213
  # "name":"Monaco Token",
214
214
  # "symbol":"MCO",
215
215
  # "accuracy":6,
@@ -749,7 +749,7 @@ class mexc(Exchange, ImplicitAPI):
749
749
  'fetchClosedOrders': {
750
750
  'marginMode': True,
751
751
  'limit': 1000,
752
- 'daysBackClosed': 7,
752
+ 'daysBack': 7,
753
753
  'daysBackCanceled': 7,
754
754
  'untilDays': 7,
755
755
  'trigger': False,
@@ -805,7 +805,7 @@ class mexc(Exchange, ImplicitAPI):
805
805
  'fetchClosedOrders': {
806
806
  'marginMode': False,
807
807
  'limit': 100,
808
- 'daysBackClosed': 90,
808
+ 'daysBack': 90,
809
809
  'daysBackCanceled': None,
810
810
  'untilDays': 90,
811
811
  'trigger': True,
@@ -32,4 +32,12 @@ class myokx(okx, ImplicitAPI):
32
32
  'rest': 'https://{hostname}',
33
33
  },
34
34
  },
35
+ 'has': {
36
+ 'CORS': None,
37
+ 'spot': True,
38
+ 'margin': None,
39
+ 'swap': False,
40
+ 'future': False,
41
+ 'option': False,
42
+ },
35
43
  })
ccxt/async_support/okx.py CHANGED
@@ -1226,7 +1226,7 @@ class okx(Exchange, ImplicitAPI):
1226
1226
  'mark': True,
1227
1227
  'index': True,
1228
1228
  },
1229
- 'limitPrice': True,
1229
+ 'price': True,
1230
1230
  },
1231
1231
  'timeInForce': {
1232
1232
  'IOC': True,
@@ -1266,7 +1266,7 @@ class okx(Exchange, ImplicitAPI):
1266
1266
  'fetchClosedOrders': {
1267
1267
  'marginMode': False,
1268
1268
  'limit': 100,
1269
- 'daysBackClosed': 90, # 3 months
1269
+ 'daysBack': 90, # 3 months
1270
1270
  'daysBackCanceled': 1 / 12, # 2 hour
1271
1271
  'untilDays': None,
1272
1272
  'trigger': True,
@@ -1636,7 +1636,7 @@ class okx(Exchange, ImplicitAPI):
1636
1636
  'contractSize': self.safe_number(market, 'ctVal') if contract else None,
1637
1637
  'expiry': expiry,
1638
1638
  'expiryDatetime': self.iso8601(expiry),
1639
- 'strike': strikePrice,
1639
+ 'strike': self.parse_number(strikePrice),
1640
1640
  'optionType': optionType,
1641
1641
  'created': self.safe_integer(market, 'listTime'),
1642
1642
  'precision': {
@@ -1835,7 +1835,7 @@ class okx(Exchange, ImplicitAPI):
1835
1835
  }
1836
1836
  firstChain = self.safe_dict(chains, 0, {})
1837
1837
  result[code] = {
1838
- 'info': None,
1838
+ 'info': chains,
1839
1839
  'code': code,
1840
1840
  'id': currencyId,
1841
1841
  'name': self.safe_string(firstChain, 'name'),
@@ -865,7 +865,8 @@ class onetrading(Exchange, ImplicitAPI):
865
865
  # {"instrument_code":"BTC_EUR","granularity":{"unit":"HOURS","period":1},"high":"9135.7","low":"9002.59","open":"9055.45","close":"9133.98","total_amount":"26.21919","volume":"238278.8724959","time":"2020-05-09T00:59:59.999Z","last_sequence":461521},
866
866
  # ]
867
867
  #
868
- return self.parse_ohlcvs(response, market, timeframe, since, limit)
868
+ ohlcv = self.safe_list(response, 'candlesticks')
869
+ return self.parse_ohlcvs(ohlcv, market, timeframe, since, limit)
869
870
 
870
871
  def parse_trade(self, trade: dict, market: Market = None) -> Trade:
871
872
  #
@@ -820,9 +820,22 @@ class whitebit(Exchange, ImplicitAPI):
820
820
  # "last": "55913.88",
821
821
  # "period": 86400
822
822
  # }
823
- market = self.safe_market(None, market)
823
+ # v2
824
+ # {
825
+ # lastUpdateTimestamp: '2025-01-02T09:16:36.000Z',
826
+ # tradingPairs: 'ARB_USDC',
827
+ # lastPrice: '0.7727',
828
+ # lowestAsk: '0.7735',
829
+ # highestBid: '0.7732',
830
+ # baseVolume24h: '1555793.74',
831
+ # quoteVolume24h: '1157602.622406',
832
+ # tradesEnabled: True
833
+ # }
834
+ #
835
+ marketId = self.safe_string(ticker, 'tradingPairs')
836
+ market = self.safe_market(marketId, market)
824
837
  # last price is provided as "last" or "last_price"
825
- last = self.safe_string_2(ticker, 'last', 'last_price')
838
+ last = self.safe_string_n(ticker, ['last', 'last_price', 'lastPrice'])
826
839
  # if "close" is provided, use it, otherwise use <last>
827
840
  close = self.safe_string(ticker, 'close', last)
828
841
  return self.safe_ticker({
@@ -831,9 +844,9 @@ class whitebit(Exchange, ImplicitAPI):
831
844
  'datetime': None,
832
845
  'high': self.safe_string(ticker, 'high'),
833
846
  'low': self.safe_string(ticker, 'low'),
834
- 'bid': self.safe_string(ticker, 'bid'),
847
+ 'bid': self.safe_string_2(ticker, 'bid', 'highestBid'),
835
848
  'bidVolume': None,
836
- 'ask': self.safe_string(ticker, 'ask'),
849
+ 'ask': self.safe_string_2(ticker, 'ask', 'lowestAsk'),
837
850
  'askVolume': None,
838
851
  'vwap': None,
839
852
  'open': self.safe_string(ticker, 'open'),
@@ -843,8 +856,8 @@ class whitebit(Exchange, ImplicitAPI):
843
856
  'change': None,
844
857
  'percentage': self.safe_string(ticker, 'change'),
845
858
  'average': None,
846
- 'baseVolume': self.safe_string_2(ticker, 'base_volume', 'volume'),
847
- 'quoteVolume': self.safe_string_2(ticker, 'quote_volume', 'deal'),
859
+ 'baseVolume': self.safe_string_n(ticker, ['base_volume', 'volume', 'baseVolume24h']),
860
+ 'quoteVolume': self.safe_string_n(ticker, ['quote_volume', 'deal', 'quoteVolume24h']),
848
861
  'info': ticker,
849
862
  }, market)
850
863
 
@@ -854,13 +867,20 @@ class whitebit(Exchange, ImplicitAPI):
854
867
 
855
868
  https://docs.whitebit.com/public/http-v4/#market-activity
856
869
 
857
- :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
870
+ :param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
858
871
  :param dict [params]: extra parameters specific to the exchange API endpoint
872
+ :param str [params.method]: either v2PublicGetTicker or v4PublicGetTicker default is v4PublicGetTicker
859
873
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
860
874
  """
861
875
  await self.load_markets()
862
876
  symbols = self.market_symbols(symbols)
863
- response = await self.v4PublicGetTicker(params)
877
+ method = 'v4PublicGetTicker'
878
+ method, params = self.handle_option_and_params(params, 'fetchTickers', 'method', method)
879
+ response = None
880
+ if method == 'v4PublicGetTicker':
881
+ response = await self.v4PublicGetTicker(params)
882
+ else:
883
+ response = await self.v2PublicGetTicker(params)
864
884
  #
865
885
  # "BCH_RUB": {
866
886
  # "base_id":1831,
@@ -872,6 +892,9 @@ class whitebit(Exchange, ImplicitAPI):
872
892
  # "change":"2.12"
873
893
  # },
874
894
  #
895
+ resultList = self.safe_list(response, 'result')
896
+ if resultList is not None:
897
+ return self.parse_tickers(resultList, symbols)
875
898
  marketIds = list(response.keys())
876
899
  result: dict = {}
877
900
  for i in range(0, len(marketIds)):
ccxt/async_support/woo.py CHANGED
@@ -379,7 +379,7 @@ class woo(Exchange, ImplicitAPI):
379
379
  'fetchClosedOrders': {
380
380
  'marginMode': False,
381
381
  'limit': 500,
382
- 'daysBackClosed': None,
382
+ 'daysBack': None,
383
383
  'daysBackCanceled': None,
384
384
  'untilDays': 100000,
385
385
  'trigger': True,
@@ -357,7 +357,7 @@ class woofipro(Exchange, ImplicitAPI):
357
357
  'fetchClosedOrders': {
358
358
  'marginMode': False,
359
359
  'limit': 500,
360
- 'daysBackClosed': None,
360
+ 'daysBack': None,
361
361
  'daysBackCanceled': None,
362
362
  'untilDays': 100000,
363
363
  'trigger': True,
@@ -378,7 +378,7 @@ class woofipro(Exchange, ImplicitAPI):
378
378
  'attachedStopLossTakeProfit': {
379
379
  # todo: implementation needs unification
380
380
  'triggerPriceType': None,
381
- 'limitPrice': False,
381
+ 'price': False,
382
382
  },
383
383
  },
384
384
  },
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.44'
7
+ __version__ = '4.4.45'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10