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
ccxt/currencycom.py CHANGED
@@ -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 = self.publicGetV2Klines(self.extend(request, params))
968
968
  #
969
969
  # [
ccxt/delta.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.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
- def add_margin(self, symbol: str, amount, params={}):
2483
+ 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 self.modify_margin_helper(symbol, amount, 'add', params)
2493
2493
 
2494
- def reduce_margin(self, symbol: str, amount, params={}):
2494
+ 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 self.modify_margin_helper(symbol, amount, 'reduce', params)
2504
2504
 
2505
- def modify_margin_helper(self, symbol: str, amount, type, params={}):
2505
+ def modify_margin_helper(self, symbol: str, amount, type, params={}) -> MarginModification:
2506
2506
  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
  def fetch_open_interest(self, symbol: str, params={}):
ccxt/digifinex.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.digifinex import ImplicitAPI
8
8
  import hashlib
9
9
  import json
10
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
+ from ccxt.base.types import Balances, Currency, Int, MarginModification, Market, Num, 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
@@ -1449,7 +1449,7 @@ class digifinex(Exchange, ImplicitAPI):
1449
1449
  request['instrument_id'] = market['id']
1450
1450
  request['granularity'] = timeframe
1451
1451
  if limit is not None:
1452
- request['limit'] = limit
1452
+ request['limit'] = min(limit, 100)
1453
1453
  response = self.publicSwapGetPublicCandles(self.extend(request, params))
1454
1454
  else:
1455
1455
  request['symbol'] = market['id']
@@ -3776,7 +3776,7 @@ class digifinex(Exchange, ImplicitAPI):
3776
3776
  depositWithdrawFees[code] = self.assign_default_deposit_withdraw_fees(depositWithdrawFees[code], currency)
3777
3777
  return depositWithdrawFees
3778
3778
 
3779
- def add_margin(self, symbol: str, amount, params={}):
3779
+ def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
3780
3780
  """
3781
3781
  add margin to a position
3782
3782
  :see: https://docs.digifinex.com/en-ww/swap/v2/rest.html#positionmargin
@@ -3790,7 +3790,7 @@ class digifinex(Exchange, ImplicitAPI):
3790
3790
  self.check_required_argument('addMargin', side, 'side', ['long', 'short'])
3791
3791
  return self.modify_margin_helper(symbol, amount, 1, params)
3792
3792
 
3793
- def reduce_margin(self, symbol: str, amount, params={}):
3793
+ def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
3794
3794
  """
3795
3795
  remove margin from a position
3796
3796
  :see: https://docs.digifinex.com/en-ww/swap/v2/rest.html#positionmargin
@@ -3804,7 +3804,7 @@ class digifinex(Exchange, ImplicitAPI):
3804
3804
  self.check_required_argument('reduceMargin', side, 'side', ['long', 'short'])
3805
3805
  return self.modify_margin_helper(symbol, amount, 2, params)
3806
3806
 
3807
- def modify_margin_helper(self, symbol: str, amount, type, params={}):
3807
+ def modify_margin_helper(self, symbol: str, amount, type, params={}) -> MarginModification:
3808
3808
  self.load_markets()
3809
3809
  side = self.safe_string(params, 'side')
3810
3810
  market = self.market(symbol)
@@ -3833,7 +3833,7 @@ class digifinex(Exchange, ImplicitAPI):
3833
3833
  'status': status,
3834
3834
  })
3835
3835
 
3836
- def parse_margin_modification(self, data, market: Market = None):
3836
+ def parse_margin_modification(self, data, market: Market = None) -> MarginModification:
3837
3837
  #
3838
3838
  # {
3839
3839
  # "instrument_id": "BTCUSDTPERP",
@@ -3846,12 +3846,14 @@ class digifinex(Exchange, ImplicitAPI):
3846
3846
  rawType = self.safe_integer(data, 'type')
3847
3847
  return {
3848
3848
  'info': data,
3849
+ 'symbol': self.safe_symbol(marketId, market, None, 'swap'),
3849
3850
  'type': 'add' if (rawType == 1) else 'reduce',
3850
3851
  'amount': self.safe_number(data, 'amount'),
3851
3852
  'total': None,
3852
3853
  'code': market['settle'],
3853
- 'symbol': self.safe_symbol(marketId, market, None, 'swap'),
3854
3854
  'status': None,
3855
+ 'timestamp': None,
3856
+ 'datetime': None,
3855
3857
  }
3856
3858
 
3857
3859
  def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
ccxt/exmo.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.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
- def reduce_margin(self, symbol: str, amount, params={}):
284
+ 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 self.modify_margin_helper(symbol, amount, 'reduce', params)
292
294
 
293
- def add_margin(self, symbol: str, amount, params={}):
295
+ 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 = self.publicGetCandlesHistory(self.extend(request, params))
848
848
  #
849
849
  # {
ccxt/gate.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.gate import ImplicitAPI
8
8
  import hashlib
9
- 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
9
+ 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
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -5650,7 +5650,7 @@ class gate(Exchange, ImplicitAPI):
5650
5650
  raise NotSupported(self.id + ' modifyMarginHelper() not support self market type')
5651
5651
  return self.parse_margin_modification(response, market)
5652
5652
 
5653
- def parse_margin_modification(self, data, market: Market = None):
5653
+ def parse_margin_modification(self, data, market: Market = None) -> MarginModification:
5654
5654
  #
5655
5655
  # {
5656
5656
  # "value": "11.9257",
@@ -5683,14 +5683,17 @@ class gate(Exchange, ImplicitAPI):
5683
5683
  total = self.safe_number(data, 'margin')
5684
5684
  return {
5685
5685
  'info': data,
5686
- 'amount': None,
5687
- 'code': self.safe_value(market, 'quote'),
5688
5686
  'symbol': market['symbol'],
5687
+ 'type': None,
5688
+ 'amount': None,
5689
5689
  'total': total,
5690
+ 'code': self.safe_value(market, 'quote'),
5690
5691
  'status': 'ok',
5692
+ 'timestamp': None,
5693
+ 'datetime': None,
5691
5694
  }
5692
5695
 
5693
- def reduce_margin(self, symbol: str, amount, params={}):
5696
+ def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
5694
5697
  """
5695
5698
  remove margin from a position
5696
5699
  :see: https://www.gate.io/docs/developers/apiv4/en/#update-position-margin
@@ -5702,7 +5705,7 @@ class gate(Exchange, ImplicitAPI):
5702
5705
  """
5703
5706
  return self.modify_margin_helper(symbol, -amount, params)
5704
5707
 
5705
- def add_margin(self, symbol: str, amount, params={}):
5708
+ def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
5706
5709
  """
5707
5710
  add margin
5708
5711
  :see: https://www.gate.io/docs/developers/apiv4/en/#update-position-margin
ccxt/hitbtc.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.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
- def modify_margin_helper(self, symbol: str, amount, type, params={}):
3002
+ def modify_margin_helper(self, symbol: str, amount, type, params={}) -> MarginModification:
3003
3003
  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
- def reduce_margin(self, symbol: str, amount, params={}):
3091
+ 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 self.modify_margin_helper(symbol, amount, 'reduce', params)
3082
3106
 
3083
- def add_margin(self, symbol: str, amount, params={}):
3107
+ 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/htx.py CHANGED
@@ -2833,7 +2833,7 @@ class htx(Exchange, ImplicitAPI):
2833
2833
  untilSeconds = self.parse_to_int(until / 1000) if (until is not None) else None
2834
2834
  if market['contract']:
2835
2835
  if limit is not None:
2836
- request['size'] = limit # when using limit: from & to are ignored
2836
+ request['size'] = min(limit, 2000) # when using limit: from & to are ignored
2837
2837
  # https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-kline-data
2838
2838
  else:
2839
2839
  limit = 2000 # only used for from/to calculation
@@ -2897,7 +2897,7 @@ class htx(Exchange, ImplicitAPI):
2897
2897
  useHistorical, params = self.handle_option_and_params(params, 'fetchOHLCV', 'useHistoricalEndpointForSpot', True)
2898
2898
  if not useHistorical:
2899
2899
  if limit is not None:
2900
- request['size'] = min(2000, limit) # max 2000
2900
+ request['size'] = min(limit, 2000) # max 2000
2901
2901
  response = self.spotPublicGetMarketHistoryKline(self.extend(request, params))
2902
2902
  else:
2903
2903
  # "from & to" only available for the self endpoint
ccxt/huobijp.py CHANGED
@@ -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 = self.marketGetHistoryKline(self.extend(request, params))
932
932
  #
933
933
  # {