ccxt 4.2.86__py2.py3-none-any.whl → 4.2.88__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 (82) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/ascendex.py +16 -6
  3. ccxt/async_support/__init__.py +1 -1
  4. ccxt/async_support/ascendex.py +16 -6
  5. ccxt/async_support/base/exchange.py +1 -1
  6. ccxt/async_support/binance.py +28 -11
  7. ccxt/async_support/bingx.py +39 -3
  8. ccxt/async_support/bitfinex.py +2 -0
  9. ccxt/async_support/bitfinex2.py +18 -4
  10. ccxt/async_support/bitflyer.py +18 -0
  11. ccxt/async_support/bitget.py +37 -22
  12. ccxt/async_support/bitopro.py +2 -0
  13. ccxt/async_support/bitrue.py +16 -8
  14. ccxt/async_support/bitvavo.py +2 -0
  15. ccxt/async_support/btcmarkets.py +1 -1
  16. ccxt/async_support/btcturk.py +2 -1
  17. ccxt/async_support/coinex.py +182 -58
  18. ccxt/async_support/cryptocom.py +1 -1
  19. ccxt/async_support/currencycom.py +1 -1
  20. ccxt/async_support/delta.py +8 -6
  21. ccxt/async_support/digifinex.py +9 -7
  22. ccxt/async_support/exmo.py +15 -15
  23. ccxt/async_support/gate.py +23 -20
  24. ccxt/async_support/hitbtc.py +31 -7
  25. ccxt/async_support/htx.py +2 -2
  26. ccxt/async_support/huobijp.py +1 -1
  27. ccxt/async_support/hyperliquid.py +242 -16
  28. ccxt/async_support/idex.py +1 -1
  29. ccxt/async_support/krakenfutures.py +4 -5
  30. ccxt/async_support/kucoin.py +7 -4
  31. ccxt/async_support/kucoinfutures.py +2 -2
  32. ccxt/async_support/lbank.py +2 -0
  33. ccxt/async_support/mexc.py +4 -4
  34. ccxt/async_support/oceanex.py +1 -1
  35. ccxt/async_support/okx.py +29 -15
  36. ccxt/async_support/phemex.py +6 -4
  37. ccxt/async_support/wazirx.py +1 -1
  38. ccxt/async_support/zonda.py +2 -0
  39. ccxt/base/exchange.py +22 -3
  40. ccxt/base/types.py +12 -0
  41. ccxt/binance.py +28 -11
  42. ccxt/bingx.py +39 -3
  43. ccxt/bitfinex.py +2 -0
  44. ccxt/bitfinex2.py +18 -4
  45. ccxt/bitflyer.py +18 -0
  46. ccxt/bitget.py +37 -22
  47. ccxt/bitopro.py +2 -0
  48. ccxt/bitrue.py +16 -8
  49. ccxt/bitvavo.py +2 -0
  50. ccxt/btcmarkets.py +1 -1
  51. ccxt/btcturk.py +2 -1
  52. ccxt/coinex.py +182 -58
  53. ccxt/cryptocom.py +1 -1
  54. ccxt/currencycom.py +1 -1
  55. ccxt/delta.py +8 -6
  56. ccxt/digifinex.py +9 -7
  57. ccxt/exmo.py +15 -15
  58. ccxt/gate.py +23 -20
  59. ccxt/hitbtc.py +31 -7
  60. ccxt/htx.py +2 -2
  61. ccxt/huobijp.py +1 -1
  62. ccxt/hyperliquid.py +241 -16
  63. ccxt/idex.py +1 -1
  64. ccxt/krakenfutures.py +4 -5
  65. ccxt/kucoin.py +7 -4
  66. ccxt/kucoinfutures.py +2 -2
  67. ccxt/lbank.py +2 -0
  68. ccxt/mexc.py +4 -4
  69. ccxt/oceanex.py +1 -1
  70. ccxt/okx.py +29 -15
  71. ccxt/phemex.py +6 -4
  72. ccxt/pro/__init__.py +1 -1
  73. ccxt/pro/kucoin.py +10 -6
  74. ccxt/test/base/test_last_price.py +0 -1
  75. ccxt/test/base/test_shared_methods.py +1 -2
  76. ccxt/test/base/test_status.py +1 -1
  77. ccxt/wazirx.py +1 -1
  78. ccxt/zonda.py +2 -0
  79. {ccxt-4.2.86.dist-info → ccxt-4.2.88.dist-info}/METADATA +5 -6
  80. {ccxt-4.2.86.dist-info → ccxt-4.2.88.dist-info}/RECORD +82 -82
  81. {ccxt-4.2.86.dist-info → ccxt-4.2.88.dist-info}/WHEEL +0 -0
  82. {ccxt-4.2.86.dist-info → ccxt-4.2.88.dist-info}/top_level.txt +0 -0
ccxt/coinex.py CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.coinex import ImplicitAPI
8
- from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages, Market, Num, Order, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
8
+ from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages, MarginModification, Market, Num, Order, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import PermissionDenied
@@ -1054,19 +1054,22 @@ class coinex(Exchange, ImplicitAPI):
1054
1054
  def fetch_time(self, params={}):
1055
1055
  """
1056
1056
  fetches the current integer timestamp in milliseconds from the exchange server
1057
- :see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http005_system_time
1057
+ :see: https://docs.coinex.com/api/v2/common/http/time
1058
1058
  :param dict [params]: extra parameters specific to the exchange API endpoint
1059
1059
  :returns int: the current integer timestamp in milliseconds from the exchange server
1060
1060
  """
1061
- response = self.v1PerpetualPublicGetTime(params)
1061
+ response = self.v2PublicGetTime(params)
1062
1062
  #
1063
1063
  # {
1064
- # "code": "0",
1065
- # "data": "1653261274414",
1064
+ # "code": 0,
1065
+ # "data": {
1066
+ # "timestamp": 1711699867777
1067
+ # },
1066
1068
  # "message": "OK"
1067
1069
  # }
1068
1070
  #
1069
- return self.safe_integer(response, 'data')
1071
+ data = self.safe_dict(response, 'data', {})
1072
+ return self.safe_integer(data, 'timestamp')
1070
1073
 
1071
1074
  def fetch_order_book(self, symbol: str, limit: Int = 20, params={}):
1072
1075
  """
@@ -1305,7 +1308,8 @@ class coinex(Exchange, ImplicitAPI):
1305
1308
  def fetch_trading_fee(self, symbol: str, params={}):
1306
1309
  """
1307
1310
  fetch the trading fees for a market
1308
- :see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market003_single_market_info
1311
+ :see: https://docs.coinex.com/api/v2/spot/market/http/list-market
1312
+ :see: https://docs.coinex.com/api/v2/futures/market/http/list-market
1309
1313
  :param str symbol: unified market symbol
1310
1314
  :param dict [params]: extra parameters specific to the exchange API endpoint
1311
1315
  :returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
@@ -1315,64 +1319,125 @@ class coinex(Exchange, ImplicitAPI):
1315
1319
  request = {
1316
1320
  'market': market['id'],
1317
1321
  }
1318
- response = self.v1PublicGetMarketDetail(self.extend(request, params))
1319
- #
1320
- # {
1321
- # "code": 0,
1322
- # "data": {
1323
- # "name": "BTCUSDC",
1324
- # "min_amount": "0.0005",
1325
- # "maker_fee_rate": "0.002",
1326
- # "taker_fee_rate": "0.002",
1327
- # "pricing_name": "USDC",
1328
- # "pricing_decimal": 2,
1329
- # "trading_name": "BTC",
1330
- # "trading_decimal": 8
1331
- # },
1332
- # "message": "OK"
1333
- # }
1334
- #
1335
- data = self.safe_value(response, 'data', {})
1336
- return self.parse_trading_fee(data, market)
1322
+ response = None
1323
+ if market['spot']:
1324
+ response = self.v2PublicGetSpotMarket(self.extend(request, params))
1325
+ #
1326
+ # {
1327
+ # "code": 0,
1328
+ # "data": [
1329
+ # {
1330
+ # "base_ccy": "BTC",
1331
+ # "base_ccy_precision": 8,
1332
+ # "is_amm_available": False,
1333
+ # "is_margin_available": True,
1334
+ # "maker_fee_rate": "0.002",
1335
+ # "market": "BTCUSDT",
1336
+ # "min_amount": "0.0001",
1337
+ # "quote_ccy": "USDT",
1338
+ # "quote_ccy_precision": 2,
1339
+ # "taker_fee_rate": "0.002"
1340
+ # }
1341
+ # ],
1342
+ # "message": "OK"
1343
+ # }
1344
+ #
1345
+ else:
1346
+ response = self.v2PublicGetFuturesMarket(self.extend(request, params))
1347
+ #
1348
+ # {
1349
+ # "code": 0,
1350
+ # "data": [
1351
+ # {
1352
+ # "base_ccy": "BTC",
1353
+ # "base_ccy_precision": 8,
1354
+ # "contract_type": "linear",
1355
+ # "leverage": ["1","2","3","5","8","10","15","20","30","50","100"],
1356
+ # "maker_fee_rate": "0",
1357
+ # "market": "BTCUSDT",
1358
+ # "min_amount": "0.0001",
1359
+ # "open_interest_volume": "185.7498",
1360
+ # "quote_ccy": "USDT",
1361
+ # "quote_ccy_precision": 2,
1362
+ # "taker_fee_rate": "0"
1363
+ # }
1364
+ # ],
1365
+ # "message": "OK"
1366
+ # }
1367
+ #
1368
+ data = self.safe_list(response, 'data', [])
1369
+ result = self.safe_dict(data, 0, {})
1370
+ return self.parse_trading_fee(result, market)
1337
1371
 
1338
1372
  def fetch_trading_fees(self, params={}):
1339
1373
  """
1340
1374
  fetch the trading fees for multiple markets
1341
- :see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market002_all_market_info
1375
+ :see: https://docs.coinex.com/api/v2/spot/market/http/list-market
1376
+ :see: https://docs.coinex.com/api/v2/futures/market/http/list-market
1342
1377
  :param dict [params]: extra parameters specific to the exchange API endpoint
1343
1378
  :returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
1344
1379
  """
1345
1380
  self.load_markets()
1346
- response = self.v1PublicGetMarketInfo(params)
1347
- #
1348
- # {
1349
- # "code": 0,
1350
- # "data": {
1351
- # "WAVESBTC": {
1352
- # "name": "WAVESBTC",
1353
- # "min_amount": "1",
1354
- # "maker_fee_rate": "0.001",
1355
- # "taker_fee_rate": "0.001",
1356
- # "pricing_name": "BTC",
1357
- # "pricing_decimal": 8,
1358
- # "trading_name": "WAVES",
1359
- # "trading_decimal": 8
1360
- # }
1361
- # ...
1362
- # }
1363
- # }
1364
- #
1365
- data = self.safe_value(response, 'data', {})
1381
+ type = None
1382
+ type, params = self.handle_market_type_and_params('fetchTradingFees', None, params)
1383
+ response = None
1384
+ if type == 'swap':
1385
+ response = self.v2PublicGetFuturesMarket(params)
1386
+ #
1387
+ # {
1388
+ # "code": 0,
1389
+ # "data": [
1390
+ # {
1391
+ # "base_ccy": "BTC",
1392
+ # "base_ccy_precision": 8,
1393
+ # "contract_type": "linear",
1394
+ # "leverage": ["1","2","3","5","8","10","15","20","30","50","100"],
1395
+ # "maker_fee_rate": "0",
1396
+ # "market": "BTCUSDT",
1397
+ # "min_amount": "0.0001",
1398
+ # "open_interest_volume": "185.7498",
1399
+ # "quote_ccy": "USDT",
1400
+ # "quote_ccy_precision": 2,
1401
+ # "taker_fee_rate": "0"
1402
+ # }
1403
+ # ],
1404
+ # "message": "OK"
1405
+ # }
1406
+ #
1407
+ else:
1408
+ response = self.v2PublicGetSpotMarket(params)
1409
+ #
1410
+ # {
1411
+ # "code": 0,
1412
+ # "data": [
1413
+ # {
1414
+ # "base_ccy": "BTC",
1415
+ # "base_ccy_precision": 8,
1416
+ # "is_amm_available": False,
1417
+ # "is_margin_available": True,
1418
+ # "maker_fee_rate": "0.002",
1419
+ # "market": "BTCUSDT",
1420
+ # "min_amount": "0.0001",
1421
+ # "quote_ccy": "USDT",
1422
+ # "quote_ccy_precision": 2,
1423
+ # "taker_fee_rate": "0.002"
1424
+ # },
1425
+ # ],
1426
+ # "message": "OK"
1427
+ # }
1428
+ #
1429
+ data = self.safe_list(response, 'data', [])
1366
1430
  result = {}
1367
- for i in range(0, len(self.symbols)):
1368
- symbol = self.symbols[i]
1369
- market = self.market(symbol)
1370
- fee = self.safe_value(data, market['id'], {})
1371
- result[symbol] = self.parse_trading_fee(fee, market)
1431
+ for i in range(0, len(data)):
1432
+ entry = data[i]
1433
+ marketId = self.safe_string(entry, 'market')
1434
+ market = self.safe_market(marketId, None, None, type)
1435
+ symbol = market['symbol']
1436
+ result[symbol] = self.parse_trading_fee(entry, market)
1372
1437
  return result
1373
1438
 
1374
1439
  def parse_trading_fee(self, fee, market: Market = None):
1375
- marketId = self.safe_value(fee, 'name')
1440
+ marketId = self.safe_value(fee, 'market')
1376
1441
  symbol = self.safe_symbol(marketId, market)
1377
1442
  return {
1378
1443
  'info': fee,
@@ -3909,17 +3974,76 @@ class coinex(Exchange, ImplicitAPI):
3909
3974
  'status': status,
3910
3975
  })
3911
3976
 
3912
- def parse_margin_modification(self, data, market: Market = None):
3977
+ def parse_margin_modification(self, data, market: Market = None) -> MarginModification:
3978
+ #
3979
+ # addMargin/reduceMargin
3980
+ #
3981
+ # {
3982
+ # "adl_sort": 1,
3983
+ # "adl_sort_val": "0.00004320",
3984
+ # "amount": "0.0005",
3985
+ # "amount_max": "0.0005",
3986
+ # "amount_max_margin": "6.57352000000000000000",
3987
+ # "bkr_price": "16294.08000000000000011090",
3988
+ # "bkr_price_imply": "0.00000000000000000000",
3989
+ # "close_left": "0.0005",
3990
+ # "create_time": 1651202571.320778,
3991
+ # "deal_all": "19.72000000000000000000",
3992
+ # "deal_asset_fee": "0.00000000000000000000",
3993
+ # "fee_asset": "",
3994
+ # "finish_type": 1,
3995
+ # "first_price": "39441.12",
3996
+ # "insurance": "0.00000000000000000000",
3997
+ # "latest_price": "39441.12",
3998
+ # "leverage": "3",
3999
+ # "liq_amount": "0.00000000000000000000",
4000
+ # "liq_order_price": "0",
4001
+ # "liq_order_time": 0,
4002
+ # "liq_price": "16491.28560000000000011090",
4003
+ # "liq_price_imply": "0.00000000000000000000",
4004
+ # "liq_profit": "0.00000000000000000000",
4005
+ # "liq_time": 0,
4006
+ # "mainten_margin": "0.005",
4007
+ # "mainten_margin_amount": "0.09860280000000000000",
4008
+ # "maker_fee": "0.00000000000000000000",
4009
+ # "margin_amount": "11.57352000000000000000",
4010
+ # "market": "BTCUSDT",
4011
+ # "open_margin": "0.58687582908396110455",
4012
+ # "open_margin_imply": "0.00000000000000000000",
4013
+ # "open_price": "39441.12000000000000000000",
4014
+ # "open_val": "19.72056000000000000000",
4015
+ # "open_val_max": "19.72056000000000000000",
4016
+ # "position_id": 65171206,
4017
+ # "profit_clearing": "-0.00986028000000000000",
4018
+ # "profit_real": "-0.00986028000000000000",
4019
+ # "profit_unreal": "0.00",
4020
+ # "side": 2,
4021
+ # "stop_loss_price": "0.00000000000000000000",
4022
+ # "stop_loss_type": 0,
4023
+ # "sys": 0,
4024
+ # "take_profit_price": "0.00000000000000000000",
4025
+ # "take_profit_type": 0,
4026
+ # "taker_fee": "0.00000000000000000000",
4027
+ # "total": 3464,
4028
+ # "type": 1,
4029
+ # "update_time": 1651202638.911212,
4030
+ # "user_id": 3620173
4031
+ # }
4032
+ #
4033
+ timestamp = self.safe_integer_product(data, 'update_time', 1000)
3913
4034
  return {
3914
4035
  'info': data,
4036
+ 'symbol': self.safe_symbol(None, market),
3915
4037
  'type': None,
3916
- 'amount': None,
4038
+ 'amount': self.safe_number(data, 'margin_amount'),
4039
+ 'total': None,
3917
4040
  'code': market['quote'],
3918
- 'symbol': self.safe_symbol(None, market),
3919
4041
  'status': None,
4042
+ 'timestamp': timestamp,
4043
+ 'datetime': self.iso8601(timestamp),
3920
4044
  }
3921
4045
 
3922
- def add_margin(self, symbol: str, amount, params={}):
4046
+ def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
3923
4047
  """
3924
4048
  add margin
3925
4049
  :see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http032_adjust_position_margin
@@ -3930,7 +4054,7 @@ class coinex(Exchange, ImplicitAPI):
3930
4054
  """
3931
4055
  return self.modify_margin_helper(symbol, amount, 1, params)
3932
4056
 
3933
- def reduce_margin(self, symbol: str, amount, params={}):
4057
+ def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
3934
4058
  """
3935
4059
  remove margin from a position
3936
4060
  :see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http032_adjust_position_margin
ccxt/cryptocom.py CHANGED
@@ -2565,7 +2565,7 @@ class cryptocom(Exchange, ImplicitAPI):
2565
2565
  #
2566
2566
  result = self.safe_dict(response, 'result', {})
2567
2567
  data = self.safe_list(result, 'data', [])
2568
- return self.parse_position(data[0], market)
2568
+ return self.parse_position(self.safe_dict(data, 0), market)
2569
2569
 
2570
2570
  def fetch_positions(self, symbols: Strings = None, params={}):
2571
2571
  """
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
  # {