ccxt 4.2.85__py2.py3-none-any.whl → 4.2.87__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 (84) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/coinex.py +232 -123
  3. ccxt/ascendex.py +16 -6
  4. ccxt/async_support/__init__.py +1 -1
  5. ccxt/async_support/ascendex.py +16 -6
  6. ccxt/async_support/base/exchange.py +1 -1
  7. ccxt/async_support/binance.py +18 -5
  8. ccxt/async_support/bingx.py +72 -22
  9. ccxt/async_support/bitbank.py +19 -21
  10. ccxt/async_support/bitfinex.py +2 -0
  11. ccxt/async_support/bitfinex2.py +18 -4
  12. ccxt/async_support/bitflyer.py +18 -0
  13. ccxt/async_support/bitget.py +20 -6
  14. ccxt/async_support/bitopro.py +2 -0
  15. ccxt/async_support/bitrue.py +16 -8
  16. ccxt/async_support/bitvavo.py +2 -0
  17. ccxt/async_support/btcmarkets.py +1 -1
  18. ccxt/async_support/btcturk.py +2 -1
  19. ccxt/async_support/coinex.py +572 -306
  20. ccxt/async_support/currencycom.py +1 -1
  21. ccxt/async_support/delta.py +8 -6
  22. ccxt/async_support/digifinex.py +9 -7
  23. ccxt/async_support/exmo.py +15 -15
  24. ccxt/async_support/gate.py +9 -6
  25. ccxt/async_support/hitbtc.py +31 -7
  26. ccxt/async_support/htx.py +2 -2
  27. ccxt/async_support/huobijp.py +1 -1
  28. ccxt/async_support/hyperliquid.py +242 -16
  29. ccxt/async_support/idex.py +11 -11
  30. ccxt/async_support/krakenfutures.py +2 -4
  31. ccxt/async_support/kucoinfutures.py +2 -2
  32. ccxt/async_support/lbank.py +2 -0
  33. ccxt/async_support/mexc.py +3 -3
  34. ccxt/async_support/oceanex.py +1 -1
  35. ccxt/async_support/okcoin.py +2 -1
  36. ccxt/async_support/okx.py +29 -15
  37. ccxt/async_support/phemex.py +6 -4
  38. ccxt/async_support/wazirx.py +1 -1
  39. ccxt/async_support/zonda.py +2 -0
  40. ccxt/base/exchange.py +1 -1
  41. ccxt/base/types.py +12 -0
  42. ccxt/binance.py +18 -5
  43. ccxt/bingx.py +72 -22
  44. ccxt/bitbank.py +19 -21
  45. ccxt/bitfinex.py +2 -0
  46. ccxt/bitfinex2.py +18 -4
  47. ccxt/bitflyer.py +18 -0
  48. ccxt/bitget.py +20 -6
  49. ccxt/bitopro.py +2 -0
  50. ccxt/bitrue.py +16 -8
  51. ccxt/bitvavo.py +2 -0
  52. ccxt/btcmarkets.py +1 -1
  53. ccxt/btcturk.py +2 -1
  54. ccxt/coinex.py +572 -306
  55. ccxt/currencycom.py +1 -1
  56. ccxt/delta.py +8 -6
  57. ccxt/digifinex.py +9 -7
  58. ccxt/exmo.py +15 -15
  59. ccxt/gate.py +9 -6
  60. ccxt/hitbtc.py +31 -7
  61. ccxt/htx.py +2 -2
  62. ccxt/huobijp.py +1 -1
  63. ccxt/hyperliquid.py +241 -16
  64. ccxt/idex.py +11 -11
  65. ccxt/krakenfutures.py +2 -4
  66. ccxt/kucoinfutures.py +2 -2
  67. ccxt/lbank.py +2 -0
  68. ccxt/mexc.py +3 -3
  69. ccxt/oceanex.py +1 -1
  70. ccxt/okcoin.py +2 -1
  71. ccxt/okx.py +29 -15
  72. ccxt/phemex.py +6 -4
  73. ccxt/pro/__init__.py +1 -1
  74. ccxt/pro/bitget.py +1 -0
  75. ccxt/pro/kucoin.py +10 -6
  76. ccxt/test/base/test_last_price.py +0 -1
  77. ccxt/test/base/test_shared_methods.py +1 -2
  78. ccxt/test/base/test_status.py +1 -1
  79. ccxt/wazirx.py +1 -1
  80. ccxt/zonda.py +2 -0
  81. {ccxt-4.2.85.dist-info → ccxt-4.2.87.dist-info}/METADATA +6 -6
  82. {ccxt-4.2.85.dist-info → ccxt-4.2.87.dist-info}/RECORD +84 -84
  83. {ccxt-4.2.85.dist-info → ccxt-4.2.87.dist-info}/WHEEL +0 -0
  84. {ccxt-4.2.85.dist-info → ccxt-4.2.87.dist-info}/top_level.txt +0 -0
@@ -963,7 +963,7 @@ class currencycom(Exchange, ImplicitAPI):
963
963
  if since is not None:
964
964
  request['startTime'] = since
965
965
  if limit is not None:
966
- request['limit'] = limit # default 500, max 1000
966
+ request['limit'] = min(limit, 1000) # default 500, max 1000
967
967
  response = await self.publicGetV2Klines(self.extend(request, params))
968
968
  #
969
969
  # [
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.delta import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Greeks, Int, Leverage, MarginMode, Market, MarketInterface, Num, Option, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade
9
+ from ccxt.base.types import Balances, Currency, Greeks, Int, Leverage, MarginMode, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import ArgumentsRequired
@@ -2480,7 +2480,7 @@ class delta(Exchange, ImplicitAPI):
2480
2480
  'previousFundingDatetime': None,
2481
2481
  }
2482
2482
 
2483
- async def add_margin(self, symbol: str, amount, params={}):
2483
+ async def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
2484
2484
  """
2485
2485
  add margin
2486
2486
  :see: https://docs.delta.exchange/#add-remove-position-margin
@@ -2491,7 +2491,7 @@ class delta(Exchange, ImplicitAPI):
2491
2491
  """
2492
2492
  return await self.modify_margin_helper(symbol, amount, 'add', params)
2493
2493
 
2494
- async def reduce_margin(self, symbol: str, amount, params={}):
2494
+ async def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
2495
2495
  """
2496
2496
  remove margin from a position
2497
2497
  :see: https://docs.delta.exchange/#add-remove-position-margin
@@ -2502,7 +2502,7 @@ class delta(Exchange, ImplicitAPI):
2502
2502
  """
2503
2503
  return await self.modify_margin_helper(symbol, amount, 'reduce', params)
2504
2504
 
2505
- async def modify_margin_helper(self, symbol: str, amount, type, params={}):
2505
+ async def modify_margin_helper(self, symbol: str, amount, type, params={}) -> MarginModification:
2506
2506
  await self.load_markets()
2507
2507
  market = self.market(symbol)
2508
2508
  amount = str(amount)
@@ -2539,7 +2539,7 @@ class delta(Exchange, ImplicitAPI):
2539
2539
  result = self.safe_dict(response, 'result', {})
2540
2540
  return self.parse_margin_modification(result, market)
2541
2541
 
2542
- def parse_margin_modification(self, data, market: Market = None):
2542
+ def parse_margin_modification(self, data, market: Market = None) -> MarginModification:
2543
2543
  #
2544
2544
  # {
2545
2545
  # "auto_topup": False,
@@ -2564,12 +2564,14 @@ class delta(Exchange, ImplicitAPI):
2564
2564
  market = self.safe_market(marketId, market)
2565
2565
  return {
2566
2566
  'info': data,
2567
+ 'symbol': market['symbol'],
2567
2568
  'type': None,
2568
2569
  'amount': None,
2569
2570
  'total': self.safe_number(data, 'margin'),
2570
2571
  'code': None,
2571
- 'symbol': market['symbol'],
2572
2572
  'status': None,
2573
+ 'timestamp': None,
2574
+ 'datetime': None,
2573
2575
  }
2574
2576
 
2575
2577
  async def fetch_open_interest(self, symbol: str, params={}):
@@ -8,7 +8,7 @@ from ccxt.abstract.digifinex import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
10
  import json
11
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
11
+ from ccxt.base.types import Balances, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
12
12
  from typing import List
13
13
  from ccxt.base.errors import ExchangeError
14
14
  from ccxt.base.errors import PermissionDenied
@@ -1450,7 +1450,7 @@ class digifinex(Exchange, ImplicitAPI):
1450
1450
  request['instrument_id'] = market['id']
1451
1451
  request['granularity'] = timeframe
1452
1452
  if limit is not None:
1453
- request['limit'] = limit
1453
+ request['limit'] = min(limit, 100)
1454
1454
  response = await self.publicSwapGetPublicCandles(self.extend(request, params))
1455
1455
  else:
1456
1456
  request['symbol'] = market['id']
@@ -3777,7 +3777,7 @@ class digifinex(Exchange, ImplicitAPI):
3777
3777
  depositWithdrawFees[code] = self.assign_default_deposit_withdraw_fees(depositWithdrawFees[code], currency)
3778
3778
  return depositWithdrawFees
3779
3779
 
3780
- async def add_margin(self, symbol: str, amount, params={}):
3780
+ async def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
3781
3781
  """
3782
3782
  add margin to a position
3783
3783
  :see: https://docs.digifinex.com/en-ww/swap/v2/rest.html#positionmargin
@@ -3791,7 +3791,7 @@ class digifinex(Exchange, ImplicitAPI):
3791
3791
  self.check_required_argument('addMargin', side, 'side', ['long', 'short'])
3792
3792
  return await self.modify_margin_helper(symbol, amount, 1, params)
3793
3793
 
3794
- async def reduce_margin(self, symbol: str, amount, params={}):
3794
+ async def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
3795
3795
  """
3796
3796
  remove margin from a position
3797
3797
  :see: https://docs.digifinex.com/en-ww/swap/v2/rest.html#positionmargin
@@ -3805,7 +3805,7 @@ class digifinex(Exchange, ImplicitAPI):
3805
3805
  self.check_required_argument('reduceMargin', side, 'side', ['long', 'short'])
3806
3806
  return await self.modify_margin_helper(symbol, amount, 2, params)
3807
3807
 
3808
- async def modify_margin_helper(self, symbol: str, amount, type, params={}):
3808
+ async def modify_margin_helper(self, symbol: str, amount, type, params={}) -> MarginModification:
3809
3809
  await self.load_markets()
3810
3810
  side = self.safe_string(params, 'side')
3811
3811
  market = self.market(symbol)
@@ -3834,7 +3834,7 @@ class digifinex(Exchange, ImplicitAPI):
3834
3834
  'status': status,
3835
3835
  })
3836
3836
 
3837
- def parse_margin_modification(self, data, market: Market = None):
3837
+ def parse_margin_modification(self, data, market: Market = None) -> MarginModification:
3838
3838
  #
3839
3839
  # {
3840
3840
  # "instrument_id": "BTCUSDTPERP",
@@ -3847,12 +3847,14 @@ class digifinex(Exchange, ImplicitAPI):
3847
3847
  rawType = self.safe_integer(data, 'type')
3848
3848
  return {
3849
3849
  'info': data,
3850
+ 'symbol': self.safe_symbol(marketId, market, None, 'swap'),
3850
3851
  'type': 'add' if (rawType == 1) else 'reduce',
3851
3852
  'amount': self.safe_number(data, 'amount'),
3852
3853
  'total': None,
3853
3854
  'code': market['settle'],
3854
- 'symbol': self.safe_symbol(marketId, market, None, 'swap'),
3855
3855
  'status': None,
3856
+ 'timestamp': None,
3857
+ 'datetime': None,
3856
3858
  }
3857
3859
 
3858
3860
  async def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.exmo import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
9
+ from ccxt.base.types import Balances, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -265,21 +265,23 @@ class exmo(Exchange, ImplicitAPI):
265
265
  margin['amount'] = amount
266
266
  return margin
267
267
 
268
- def parse_margin_modification(self, data, market: Market = None):
268
+ def parse_margin_modification(self, data, market: Market = None) -> MarginModification:
269
269
  #
270
270
  # {}
271
271
  #
272
272
  return {
273
273
  'info': data,
274
+ 'symbol': self.safe_symbol(None, market),
274
275
  'type': None,
275
276
  'amount': None,
276
- 'code': self.safe_value(market, 'quote'),
277
- 'symbol': self.safe_symbol(None, market),
278
277
  'total': None,
278
+ 'code': self.safe_value(market, 'quote'),
279
279
  'status': 'ok',
280
+ 'timestamp': None,
281
+ 'datetime': None,
280
282
  }
281
283
 
282
- async def reduce_margin(self, symbol: str, amount, params={}):
284
+ async def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
283
285
  """
284
286
  remove margin from a position
285
287
  :see: https://documenter.getpostman.com/view/10287440/SzYXWKPi#eebf9f25-0289-4946-9482-89872c738449
@@ -290,7 +292,7 @@ class exmo(Exchange, ImplicitAPI):
290
292
  """
291
293
  return await self.modify_margin_helper(symbol, amount, 'reduce', params)
292
294
 
293
- async def add_margin(self, symbol: str, amount, params={}):
295
+ async def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
294
296
  """
295
297
  add margin
296
298
  :see: https://documenter.getpostman.com/view/10287440/SzYXWKPi#143ef808-79ca-4e49-9e79-a60ea4d8c0e3
@@ -824,26 +826,24 @@ class exmo(Exchange, ImplicitAPI):
824
826
  'symbol': market['id'],
825
827
  'resolution': self.safe_string(self.timeframes, timeframe, timeframe),
826
828
  }
827
- options = self.safe_value(self.options, 'fetchOHLCV')
828
- maxLimit = self.safe_integer(options, 'maxLimit', 3000)
829
+ maxLimit = 3000
829
830
  duration = self.parse_timeframe(timeframe)
830
831
  now = self.milliseconds()
831
832
  if since is None:
832
833
  if limit is None:
833
834
  limit = 1000 # cap default at generous amount
834
- if limit > maxLimit:
835
- limit = maxLimit # avoid exception
835
+ else:
836
+ limit = min(limit, maxLimit)
836
837
  request['from'] = self.parse_to_int(now / 1000) - limit * duration - 1
837
838
  request['to'] = self.parse_to_int(now / 1000)
838
839
  else:
839
840
  request['from'] = self.parse_to_int(since / 1000) - 1
840
841
  if limit is None:
841
- request['to'] = self.parse_to_int(now / 1000)
842
+ limit = maxLimit
842
843
  else:
843
- if limit > maxLimit:
844
- raise BadRequest(self.id + ' fetchOHLCV() will serve ' + str(maxLimit) + ' candles at most')
845
- to = self.sum(since, limit * duration * 1000)
846
- request['to'] = self.parse_to_int(to / 1000)
844
+ limit = min(limit, maxLimit)
845
+ to = self.sum(since, limit * duration * 1000)
846
+ request['to'] = self.parse_to_int(to / 1000)
847
847
  response = await self.publicGetCandlesHistory(self.extend(request, params))
848
848
  #
849
849
  # {
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.gate import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- from ccxt.base.types import Balances, Currency, FundingHistory, Greeks, Int, Leverage, Leverages, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
+ from ccxt.base.types import Balances, Currency, FundingHistory, Greeks, Int, Leverage, Leverages, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import PermissionDenied
@@ -5651,7 +5651,7 @@ class gate(Exchange, ImplicitAPI):
5651
5651
  raise NotSupported(self.id + ' modifyMarginHelper() not support self market type')
5652
5652
  return self.parse_margin_modification(response, market)
5653
5653
 
5654
- def parse_margin_modification(self, data, market: Market = None):
5654
+ def parse_margin_modification(self, data, market: Market = None) -> MarginModification:
5655
5655
  #
5656
5656
  # {
5657
5657
  # "value": "11.9257",
@@ -5684,14 +5684,17 @@ class gate(Exchange, ImplicitAPI):
5684
5684
  total = self.safe_number(data, 'margin')
5685
5685
  return {
5686
5686
  'info': data,
5687
- 'amount': None,
5688
- 'code': self.safe_value(market, 'quote'),
5689
5687
  'symbol': market['symbol'],
5688
+ 'type': None,
5689
+ 'amount': None,
5690
5690
  'total': total,
5691
+ 'code': self.safe_value(market, 'quote'),
5691
5692
  'status': 'ok',
5693
+ 'timestamp': None,
5694
+ 'datetime': None,
5692
5695
  }
5693
5696
 
5694
- async def reduce_margin(self, symbol: str, amount, params={}):
5697
+ async def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
5695
5698
  """
5696
5699
  remove margin from a position
5697
5700
  :see: https://www.gate.io/docs/developers/apiv4/en/#update-position-margin
@@ -5703,7 +5706,7 @@ class gate(Exchange, ImplicitAPI):
5703
5706
  """
5704
5707
  return await self.modify_margin_helper(symbol, -amount, params)
5705
5708
 
5706
- async def add_margin(self, symbol: str, amount, params={}):
5709
+ async def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
5707
5710
  """
5708
5711
  add margin
5709
5712
  :see: https://www.gate.io/docs/developers/apiv4/en/#update-position-margin
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.hitbtc import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Leverage, MarginMode, MarginModes, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Balances, Currency, Int, Leverage, MarginMode, MarginModes, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -1658,7 +1658,7 @@ class hitbtc(Exchange, ImplicitAPI):
1658
1658
  request['from'] = self.iso8601(since)
1659
1659
  request, params = self.handle_until_option('till', request, params)
1660
1660
  if limit is not None:
1661
- request['limit'] = limit
1661
+ request['limit'] = min(limit, 1000)
1662
1662
  price = self.safe_string(params, 'price')
1663
1663
  params = self.omit(params, 'price')
1664
1664
  response = None
@@ -2999,7 +2999,7 @@ class hitbtc(Exchange, ImplicitAPI):
2999
2999
  'previousFundingDatetime': None,
3000
3000
  }
3001
3001
 
3002
- async def modify_margin_helper(self, symbol: str, amount, type, params={}):
3002
+ async def modify_margin_helper(self, symbol: str, amount, type, params={}) -> MarginModification:
3003
3003
  await self.load_markets()
3004
3004
  market = self.market(symbol)
3005
3005
  leverage = self.safe_string(params, 'leverage')
@@ -3052,19 +3052,43 @@ class hitbtc(Exchange, ImplicitAPI):
3052
3052
  'type': type,
3053
3053
  })
3054
3054
 
3055
- def parse_margin_modification(self, data, market: Market = None):
3055
+ def parse_margin_modification(self, data, market: Market = None) -> MarginModification:
3056
+ #
3057
+ # addMargin/reduceMargin
3058
+ #
3059
+ # {
3060
+ # "symbol": "BTCUSDT_PERP",
3061
+ # "type": "isolated",
3062
+ # "leverage": "8.00",
3063
+ # "created_at": "2022-03-30T23:34:27.161Z",
3064
+ # "updated_at": "2022-03-30T23:34:27.161Z",
3065
+ # "currencies": [
3066
+ # {
3067
+ # "code": "USDT",
3068
+ # "margin_balance": "7.000000000000",
3069
+ # "reserved_orders": "0",
3070
+ # "reserved_positions": "0"
3071
+ # }
3072
+ # ],
3073
+ # "positions": null
3074
+ # }
3075
+ #
3056
3076
  currencies = self.safe_value(data, 'currencies', [])
3057
3077
  currencyInfo = self.safe_value(currencies, 0)
3078
+ datetime = self.safe_string(data, 'updated_at')
3058
3079
  return {
3059
3080
  'info': data,
3081
+ 'symbol': market['symbol'],
3060
3082
  'type': None,
3061
3083
  'amount': None,
3084
+ 'total': None,
3062
3085
  'code': self.safe_string(currencyInfo, 'code'),
3063
- 'symbol': market['symbol'],
3064
3086
  'status': None,
3087
+ 'timestamp': self.parse8601(datetime),
3088
+ 'datetime': datetime,
3065
3089
  }
3066
3090
 
3067
- async def reduce_margin(self, symbol: str, amount, params={}):
3091
+ async def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
3068
3092
  """
3069
3093
  remove margin from a position
3070
3094
  :see: https://api.hitbtc.com/#create-update-margin-account-2
@@ -3080,7 +3104,7 @@ class hitbtc(Exchange, ImplicitAPI):
3080
3104
  raise BadRequest(self.id + ' reduceMargin() on hitbtc requires the amount to be 0 and that will remove the entire margin amount')
3081
3105
  return await self.modify_margin_helper(symbol, amount, 'reduce', params)
3082
3106
 
3083
- async def add_margin(self, symbol: str, amount, params={}):
3107
+ async def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
3084
3108
  """
3085
3109
  add margin
3086
3110
  :see: https://api.hitbtc.com/#create-update-margin-account-2
ccxt/async_support/htx.py CHANGED
@@ -2834,7 +2834,7 @@ class htx(Exchange, ImplicitAPI):
2834
2834
  untilSeconds = self.parse_to_int(until / 1000) if (until is not None) else None
2835
2835
  if market['contract']:
2836
2836
  if limit is not None:
2837
- request['size'] = limit # when using limit: from & to are ignored
2837
+ request['size'] = min(limit, 2000) # when using limit: from & to are ignored
2838
2838
  # https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-kline-data
2839
2839
  else:
2840
2840
  limit = 2000 # only used for from/to calculation
@@ -2898,7 +2898,7 @@ class htx(Exchange, ImplicitAPI):
2898
2898
  useHistorical, params = self.handle_option_and_params(params, 'fetchOHLCV', 'useHistoricalEndpointForSpot', True)
2899
2899
  if not useHistorical:
2900
2900
  if limit is not None:
2901
- request['size'] = min(2000, limit) # max 2000
2901
+ request['size'] = min(limit, 2000) # max 2000
2902
2902
  response = await self.spotPublicGetMarketHistoryKline(self.extend(request, params))
2903
2903
  else:
2904
2904
  # "from & to" only available for the self endpoint
@@ -927,7 +927,7 @@ class huobijp(Exchange, ImplicitAPI):
927
927
  'period': self.safe_string(self.timeframes, timeframe, timeframe),
928
928
  }
929
929
  if limit is not None:
930
- request['size'] = limit
930
+ request['size'] = min(limit, 2000)
931
931
  response = await self.marketGetHistoryKline(self.extend(request, params))
932
932
  #
933
933
  # {