ccxt 4.2.88__py2.py3-none-any.whl → 4.2.90__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 (156) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/bingx.py +2 -0
  3. ccxt/abstract/bybit.py +2 -0
  4. ccxt/ascendex.py +6 -3
  5. ccxt/async_support/__init__.py +1 -1
  6. ccxt/async_support/ascendex.py +6 -3
  7. ccxt/async_support/base/exchange.py +15 -2
  8. ccxt/async_support/bigone.py +2 -2
  9. ccxt/async_support/binance.py +88 -14
  10. ccxt/async_support/bingx.py +96 -3
  11. ccxt/async_support/bit2c.py +2 -2
  12. ccxt/async_support/bitbank.py +2 -2
  13. ccxt/async_support/bitfinex.py +2 -2
  14. ccxt/async_support/bitfinex2.py +4 -3
  15. ccxt/async_support/bitflyer.py +4 -2
  16. ccxt/async_support/bitget.py +12 -5
  17. ccxt/async_support/bitmart.py +6 -4
  18. ccxt/async_support/bitmex.py +3 -2
  19. ccxt/async_support/bitopro.py +3 -3
  20. ccxt/async_support/bitrue.py +3 -2
  21. ccxt/async_support/bitso.py +2 -2
  22. ccxt/async_support/bitstamp.py +89 -97
  23. ccxt/async_support/bitteam.py +2 -2
  24. ccxt/async_support/bitvavo.py +3 -3
  25. ccxt/async_support/bl3p.py +2 -2
  26. ccxt/async_support/blockchaincom.py +2 -2
  27. ccxt/async_support/blofin.py +4 -2
  28. ccxt/async_support/bybit.py +57 -5
  29. ccxt/async_support/cex.py +3 -3
  30. ccxt/async_support/coinbase.py +42 -22
  31. ccxt/async_support/coinbaseinternational.py +3 -2
  32. ccxt/async_support/coinbasepro.py +3 -3
  33. ccxt/async_support/coincheck.py +2 -2
  34. ccxt/async_support/coinex.py +101 -13
  35. ccxt/async_support/coinlist.py +3 -3
  36. ccxt/async_support/coinmate.py +2 -2
  37. ccxt/async_support/coinmetro.py +2 -2
  38. ccxt/async_support/coinone.py +2 -2
  39. ccxt/async_support/coinsph.py +6 -4
  40. ccxt/async_support/cryptocom.py +1 -0
  41. ccxt/async_support/currencycom.py +3 -3
  42. ccxt/async_support/delta.py +3 -2
  43. ccxt/async_support/deribit.py +3 -3
  44. ccxt/async_support/digifinex.py +7 -4
  45. ccxt/async_support/exmo.py +4 -3
  46. ccxt/async_support/gate.py +8 -4
  47. ccxt/async_support/gemini.py +13 -12
  48. ccxt/async_support/hitbtc.py +8 -5
  49. ccxt/async_support/hollaex.py +3 -3
  50. ccxt/async_support/htx.py +7 -4
  51. ccxt/async_support/huobijp.py +2 -2
  52. ccxt/async_support/hyperliquid.py +3 -2
  53. ccxt/async_support/idex.py +3 -3
  54. ccxt/async_support/independentreserve.py +2 -2
  55. ccxt/async_support/kraken.py +3 -3
  56. ccxt/async_support/kucoin.py +43 -18
  57. ccxt/async_support/kucoinfutures.py +32 -4
  58. ccxt/async_support/kuna.py +2 -2
  59. ccxt/async_support/latoken.py +7 -3
  60. ccxt/async_support/lbank.py +7 -5
  61. ccxt/async_support/luno.py +4 -2
  62. ccxt/async_support/lykke.py +2 -2
  63. ccxt/async_support/mexc.py +57 -9
  64. ccxt/async_support/ndax.py +2 -2
  65. ccxt/async_support/oceanex.py +2 -2
  66. ccxt/async_support/okcoin.py +2 -2
  67. ccxt/async_support/okx.py +149 -12
  68. ccxt/async_support/onetrading.py +3 -3
  69. ccxt/async_support/phemex.py +3 -2
  70. ccxt/async_support/poloniex.py +3 -3
  71. ccxt/async_support/probit.py +2 -2
  72. ccxt/async_support/timex.py +6 -4
  73. ccxt/async_support/upbit.py +2 -2
  74. ccxt/async_support/wazirx.py +2 -2
  75. ccxt/async_support/whitebit.py +3 -3
  76. ccxt/async_support/woo.py +4 -3
  77. ccxt/async_support/yobit.py +2 -2
  78. ccxt/base/exchange.py +65 -12
  79. ccxt/base/types.py +33 -0
  80. ccxt/bigone.py +2 -2
  81. ccxt/binance.py +88 -14
  82. ccxt/bingx.py +96 -3
  83. ccxt/bit2c.py +2 -2
  84. ccxt/bitbank.py +2 -2
  85. ccxt/bitfinex.py +2 -2
  86. ccxt/bitfinex2.py +4 -3
  87. ccxt/bitflyer.py +4 -2
  88. ccxt/bitget.py +12 -5
  89. ccxt/bitmart.py +6 -4
  90. ccxt/bitmex.py +3 -2
  91. ccxt/bitopro.py +3 -3
  92. ccxt/bitrue.py +3 -2
  93. ccxt/bitso.py +2 -2
  94. ccxt/bitstamp.py +89 -97
  95. ccxt/bitteam.py +2 -2
  96. ccxt/bitvavo.py +3 -3
  97. ccxt/bl3p.py +2 -2
  98. ccxt/blockchaincom.py +2 -2
  99. ccxt/blofin.py +4 -2
  100. ccxt/bybit.py +57 -5
  101. ccxt/cex.py +3 -3
  102. ccxt/coinbase.py +42 -22
  103. ccxt/coinbaseinternational.py +3 -2
  104. ccxt/coinbasepro.py +3 -3
  105. ccxt/coincheck.py +2 -2
  106. ccxt/coinex.py +101 -13
  107. ccxt/coinlist.py +3 -3
  108. ccxt/coinmate.py +2 -2
  109. ccxt/coinmetro.py +2 -2
  110. ccxt/coinone.py +2 -2
  111. ccxt/coinsph.py +6 -4
  112. ccxt/cryptocom.py +1 -0
  113. ccxt/currencycom.py +3 -3
  114. ccxt/delta.py +3 -2
  115. ccxt/deribit.py +3 -3
  116. ccxt/digifinex.py +7 -4
  117. ccxt/exmo.py +4 -3
  118. ccxt/gate.py +8 -4
  119. ccxt/gemini.py +13 -12
  120. ccxt/hitbtc.py +8 -5
  121. ccxt/hollaex.py +3 -3
  122. ccxt/htx.py +7 -4
  123. ccxt/huobijp.py +2 -2
  124. ccxt/hyperliquid.py +3 -2
  125. ccxt/idex.py +3 -3
  126. ccxt/independentreserve.py +2 -2
  127. ccxt/kraken.py +3 -3
  128. ccxt/kucoin.py +43 -18
  129. ccxt/kucoinfutures.py +32 -4
  130. ccxt/kuna.py +2 -2
  131. ccxt/latoken.py +7 -3
  132. ccxt/lbank.py +7 -5
  133. ccxt/luno.py +4 -2
  134. ccxt/lykke.py +2 -2
  135. ccxt/mexc.py +57 -9
  136. ccxt/ndax.py +2 -2
  137. ccxt/oceanex.py +2 -2
  138. ccxt/okcoin.py +2 -2
  139. ccxt/okx.py +149 -12
  140. ccxt/onetrading.py +3 -3
  141. ccxt/phemex.py +3 -2
  142. ccxt/poloniex.py +3 -3
  143. ccxt/pro/__init__.py +1 -1
  144. ccxt/pro/bitget.py +2 -0
  145. ccxt/pro/bitvavo.py +2 -2
  146. ccxt/probit.py +2 -2
  147. ccxt/timex.py +6 -4
  148. ccxt/upbit.py +2 -2
  149. ccxt/wazirx.py +2 -2
  150. ccxt/whitebit.py +3 -3
  151. ccxt/woo.py +4 -3
  152. ccxt/yobit.py +2 -2
  153. {ccxt-4.2.88.dist-info → ccxt-4.2.90.dist-info}/METADATA +4 -4
  154. {ccxt-4.2.88.dist-info → ccxt-4.2.90.dist-info}/RECORD +156 -156
  155. {ccxt-4.2.88.dist-info → ccxt-4.2.90.dist-info}/WHEEL +0 -0
  156. {ccxt-4.2.88.dist-info → ccxt-4.2.90.dist-info}/top_level.txt +0 -0
ccxt/coinbase.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.coinbase import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
9
+ from ccxt.base.types import Account, Balances, Currencies, Currency, Int, 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 ArgumentsRequired
@@ -1287,7 +1287,7 @@ class coinbase(Exchange, ImplicitAPI):
1287
1287
  })
1288
1288
  return self.safe_dict(self.options, 'fetchCurrencies', {})
1289
1289
 
1290
- def fetch_currencies(self, params={}):
1290
+ def fetch_currencies(self, params={}) -> Currencies:
1291
1291
  """
1292
1292
  fetches all available currencies on an exchange
1293
1293
  :see: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-currencies#get-fiat-currencies
@@ -3573,25 +3573,14 @@ class coinbase(Exchange, ImplicitAPI):
3573
3573
  url = self.urls['api']['rest'] + fullPath
3574
3574
  if signed:
3575
3575
  authorization = self.safe_string(self.headers, 'Authorization')
3576
+ authorizationString = None
3576
3577
  if authorization is not None:
3577
- headers = {
3578
- 'Authorization': authorization,
3579
- 'Content-Type': 'application/json',
3580
- }
3581
- if method != 'GET':
3582
- if query:
3583
- body = self.json(query)
3578
+ authorizationString = authorization
3584
3579
  elif self.token and not self.check_required_credentials(False):
3585
- headers = {
3586
- 'Authorization': 'Bearer ' + self.token,
3587
- 'Content-Type': 'application/json',
3588
- }
3589
- if method != 'GET':
3590
- if query:
3591
- body = self.json(query)
3580
+ authorizationString = 'Bearer ' + self.token
3592
3581
  else:
3593
3582
  self.check_required_credentials()
3594
- timestampString = str(self.seconds())
3583
+ seconds = self.seconds()
3595
3584
  payload = ''
3596
3585
  if method != 'GET':
3597
3586
  if query:
@@ -3605,14 +3594,45 @@ class coinbase(Exchange, ImplicitAPI):
3605
3594
  # https://docs.cloud.coinbase.com/advanced-trade-api/docs/auth#example-request
3606
3595
  # v2: 'GET' require payload in the signature
3607
3596
  # https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-key-authentication
3608
- auth = timestampString + method + savedPath + payload
3609
- signature = self.hmac(self.encode(auth), self.encode(self.secret), hashlib.sha256)
3597
+ isCloudAPiKey = (self.apiKey.find('organizations/') >= 0) or (self.secret.startswith('-----BEGIN'))
3598
+ if isCloudAPiKey:
3599
+ if self.apiKey.startswith('-----BEGIN'):
3600
+ raise ArgumentsRequired(self.id + ' apiKey should contain the name(eg: organizations/3b910e93....) and not the public key')
3601
+ # it may not work for v2
3602
+ uri = method + ' ' + url.replace('https://', '')
3603
+ quesPos = uri.find('?')
3604
+ if quesPos >= 0:
3605
+ uri = uri[0:quesPos]
3606
+ nonce = self.random_bytes(16)
3607
+ request = {
3608
+ 'aud': ['retail_rest_api_proxy'],
3609
+ 'iss': 'coinbase-cloud',
3610
+ 'nbf': seconds,
3611
+ 'exp': seconds + 120,
3612
+ 'sub': self.apiKey,
3613
+ 'uri': uri,
3614
+ 'iat': seconds,
3615
+ }
3616
+ token = self.jwt(request, self.encode(self.secret), 'sha256', False, {'kid': self.apiKey, 'nonce': nonce, 'alg': 'ES256'})
3617
+ authorizationString = 'Bearer ' + token
3618
+ else:
3619
+ timestampString = str(self.seconds())
3620
+ auth = timestampString + method + savedPath + payload
3621
+ signature = self.hmac(self.encode(auth), self.encode(self.secret), hashlib.sha256)
3622
+ headers = {
3623
+ 'CB-ACCESS-KEY': self.apiKey,
3624
+ 'CB-ACCESS-SIGN': signature,
3625
+ 'CB-ACCESS-TIMESTAMP': timestampString,
3626
+ 'Content-Type': 'application/json',
3627
+ }
3628
+ if authorizationString is not None:
3610
3629
  headers = {
3611
- 'CB-ACCESS-KEY': self.apiKey,
3612
- 'CB-ACCESS-SIGN': signature,
3613
- 'CB-ACCESS-TIMESTAMP': timestampString,
3630
+ 'Authorization': authorizationString,
3614
3631
  'Content-Type': 'application/json',
3615
3632
  }
3633
+ if method != 'GET':
3634
+ if query:
3635
+ body = self.json(query)
3616
3636
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
3617
3637
 
3618
3638
  def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.coinbaseinternational import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Order, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from typing import Any
12
12
  from ccxt.base.errors import ExchangeError
@@ -85,6 +85,7 @@ class coinbaseinternational(Exchange, ImplicitAPI):
85
85
  'fetchLedger': False,
86
86
  'fetchLeverage': False,
87
87
  'fetchLeverageTiers': False,
88
+ 'fetchMarginAdjustmentHistory': False,
88
89
  'fetchMarginMode': False,
89
90
  'fetchMarkets': True,
90
91
  'fetchMarkOHLCV': False,
@@ -1065,7 +1066,7 @@ class coinbaseinternational(Exchange, ImplicitAPI):
1065
1066
  'created': None,
1066
1067
  }
1067
1068
 
1068
- def fetch_currencies(self, params={}) -> Any:
1069
+ def fetch_currencies(self, params={}) -> Currencies:
1069
1070
  """
1070
1071
  fetches all available currencies on an exchange
1071
1072
  :see: https://docs.cloud.coinbase.com/intx/reference/getassets
ccxt/coinbasepro.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.coinbasepro import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
9
+ from ccxt.base.types import Account, Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -239,7 +239,7 @@ class coinbasepro(Exchange, ImplicitAPI):
239
239
  },
240
240
  })
241
241
 
242
- def fetch_currencies(self, params={}):
242
+ def fetch_currencies(self, params={}) -> Currencies:
243
243
  """
244
244
  fetches all available currencies on an exchange
245
245
  :see: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getcurrencies
@@ -833,7 +833,7 @@ class coinbasepro(Exchange, ImplicitAPI):
833
833
  #
834
834
  return self.parse_trades(response, market, since, limit)
835
835
 
836
- def fetch_trading_fees(self, params={}):
836
+ def fetch_trading_fees(self, params={}) -> TradingFees:
837
837
  """
838
838
  fetch the trading fees for multiple markets
839
839
  :see: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getfees
ccxt/coincheck.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.coincheck import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, Transaction
9
+ from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, TradingFees, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import BadSymbol
@@ -503,7 +503,7 @@ class coincheck(Exchange, ImplicitAPI):
503
503
  data = self.safe_list(response, 'data', [])
504
504
  return self.parse_trades(data, market, since, limit)
505
505
 
506
- def fetch_trading_fees(self, params={}):
506
+ def fetch_trading_fees(self, params={}) -> TradingFees:
507
507
  """
508
508
  fetch the trading fees for multiple markets
509
509
  :see: https://coincheck.com/documents/exchange/api#account-info
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, MarginModification, Market, Num, Order, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
8
+ from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, Leverages, MarginModification, Market, Num, Order, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import PermissionDenied
@@ -92,6 +92,7 @@ class coinex(Exchange, ImplicitAPI):
92
92
  'fetchLeverage': 'emulated',
93
93
  'fetchLeverages': True,
94
94
  'fetchLeverageTiers': True,
95
+ 'fetchMarginAdjustmentHistory': True,
95
96
  'fetchMarketLeverageTiers': 'emulated',
96
97
  'fetchMarkets': True,
97
98
  'fetchMarkOHLCV': False,
@@ -489,7 +490,7 @@ class coinex(Exchange, ImplicitAPI):
489
490
  },
490
491
  })
491
492
 
492
- def fetch_currencies(self, params={}):
493
+ def fetch_currencies(self, params={}) -> Currencies:
493
494
  response = self.v1PublicGetCommonAssetConfig(params)
494
495
  # {
495
496
  # "code": 0,
@@ -1305,7 +1306,7 @@ class coinex(Exchange, ImplicitAPI):
1305
1306
  #
1306
1307
  return self.parse_trades(response['data'], market, since, limit)
1307
1308
 
1308
- def fetch_trading_fee(self, symbol: str, params={}):
1309
+ def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
1309
1310
  """
1310
1311
  fetch the trading fees for a market
1311
1312
  :see: https://docs.coinex.com/api/v2/spot/market/http/list-market
@@ -1369,7 +1370,7 @@ class coinex(Exchange, ImplicitAPI):
1369
1370
  result = self.safe_dict(data, 0, {})
1370
1371
  return self.parse_trading_fee(result, market)
1371
1372
 
1372
- def fetch_trading_fees(self, params={}):
1373
+ def fetch_trading_fees(self, params={}) -> TradingFees:
1373
1374
  """
1374
1375
  fetch the trading fees for multiple markets
1375
1376
  :see: https://docs.coinex.com/api/v2/spot/market/http/list-market
@@ -1436,7 +1437,7 @@ class coinex(Exchange, ImplicitAPI):
1436
1437
  result[symbol] = self.parse_trading_fee(entry, market)
1437
1438
  return result
1438
1439
 
1439
- def parse_trading_fee(self, fee, market: Market = None):
1440
+ def parse_trading_fee(self, fee, market: Market = None) -> TradingFeeInterface:
1440
1441
  marketId = self.safe_value(fee, 'market')
1441
1442
  symbol = self.safe_symbol(marketId, market)
1442
1443
  return {
@@ -3966,11 +3967,10 @@ class coinex(Exchange, ImplicitAPI):
3966
3967
  # "message":"OK"
3967
3968
  # }
3968
3969
  #
3970
+ data = self.safe_dict(response, 'data')
3969
3971
  status = self.safe_string(response, 'message')
3970
- type = 'add' if (addOrReduce == 1) else 'reduce'
3971
- return self.extend(self.parse_margin_modification(response, market), {
3972
+ return self.extend(self.parse_margin_modification(data, market), {
3972
3973
  'amount': self.parse_number(amount),
3973
- 'type': type,
3974
3974
  'status': status,
3975
3975
  })
3976
3976
 
@@ -4030,13 +4030,34 @@ class coinex(Exchange, ImplicitAPI):
4030
4030
  # "user_id": 3620173
4031
4031
  # }
4032
4032
  #
4033
- timestamp = self.safe_integer_product(data, 'update_time', 1000)
4033
+ # fetchMarginAdjustmentHistory
4034
+ #
4035
+ # {
4036
+ # bkr_price: '0',
4037
+ # leverage: '3',
4038
+ # liq_price: '0',
4039
+ # margin_amount: '5.33236666666666666666',
4040
+ # margin_change: '3',
4041
+ # market: 'XRPUSDT',
4042
+ # position_amount: '11',
4043
+ # position_id: '297155652',
4044
+ # position_type: '2',
4045
+ # settle_price: '0.6361',
4046
+ # time: '1711050906.382891',
4047
+ # type: '1',
4048
+ # user_id: '3685860'
4049
+ # }
4050
+ #
4051
+ marketId = self.safe_string(data, 'market')
4052
+ type = self.safe_string(data, 'type')
4053
+ timestamp = self.safe_integer_product_2(data, 'time', 'update_time', 1000)
4034
4054
  return {
4035
4055
  'info': data,
4036
- 'symbol': self.safe_symbol(None, market),
4037
- 'type': None,
4038
- 'amount': self.safe_number(data, 'margin_amount'),
4039
- 'total': None,
4056
+ 'symbol': self.safe_symbol(marketId, market, None, 'swap'),
4057
+ 'type': 'add' if (type == '1') else 'reduce',
4058
+ 'marginMode': 'isolated',
4059
+ 'amount': self.safe_number(data, 'margin_change'),
4060
+ 'total': self.safe_number(data, 'position_amount'),
4040
4061
  'code': market['quote'],
4041
4062
  'status': None,
4042
4063
  'timestamp': timestamp,
@@ -4644,6 +4665,7 @@ class coinex(Exchange, ImplicitAPI):
4644
4665
  currencyId = self.safe_string(transfer, 'asset')
4645
4666
  currencyCode = self.safe_currency_code(currencyId, currency)
4646
4667
  return {
4668
+ 'info': transfer,
4647
4669
  'id': self.safe_integer(transfer, 'id'),
4648
4670
  'timestamp': timestamp,
4649
4671
  'datetime': self.iso8601(timestamp),
@@ -5410,3 +5432,69 @@ class coinex(Exchange, ImplicitAPI):
5410
5432
  self.throw_exactly_matched_exception(self.exceptions['exact'], code, feedback)
5411
5433
  raise ExchangeError(feedback)
5412
5434
  return None
5435
+
5436
+ def fetch_margin_adjustment_history(self, symbol: Str = None, type: Str = None, since: Num = None, limit: Num = None, params={}) -> List[MarginModification]:
5437
+ """
5438
+ fetches the history of margin added or reduced from contract isolated positions
5439
+ :see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http046_position_margin_history
5440
+ :param str [symbol]: unified market symbol
5441
+ :param str [type]: not used by coinex fetchMarginAdjustmentHistory
5442
+ :param int [since]: timestamp in ms of the earliest change to fetch
5443
+ :param int [limit]: the maximum amount of changes to fetch, default=100, max=100
5444
+ :param dict params: extra parameters specific to the exchange api endpoint
5445
+ :param int [params.until]: timestamp in ms of the latest change to fetch
5446
+ *
5447
+ * EXCHANGE SPECIFIC PARAMETERS
5448
+ :param int [params.offset]: offset
5449
+ :returns dict[]: a list of `margin structures <https://docs.ccxt.com/#/?id=margin-loan-structure>`
5450
+ """
5451
+ self.load_markets()
5452
+ until = self.safe_integer(params, 'until')
5453
+ params = self.omit(params, 'until')
5454
+ if limit is None:
5455
+ limit = 100
5456
+ request = {
5457
+ 'market': '',
5458
+ 'position_id': 0,
5459
+ 'offset': 0,
5460
+ 'limit': limit,
5461
+ }
5462
+ if symbol is not None:
5463
+ market = self.market(symbol)
5464
+ request['market'] = market['id']
5465
+ if since is not None:
5466
+ request['start_time'] = since
5467
+ if until is not None:
5468
+ request['end_time'] = until
5469
+ response = self.v1PerpetualPrivateGetPositionMarginHistory(self.extend(request, params))
5470
+ #
5471
+ # {
5472
+ # code: '0',
5473
+ # data: {
5474
+ # limit: '100',
5475
+ # offset: '0',
5476
+ # records: [
5477
+ # {
5478
+ # bkr_price: '0',
5479
+ # leverage: '3',
5480
+ # liq_price: '0',
5481
+ # margin_amount: '5.33236666666666666666',
5482
+ # margin_change: '3',
5483
+ # market: 'XRPUSDT',
5484
+ # position_amount: '11',
5485
+ # position_id: '297155652',
5486
+ # position_type: '2',
5487
+ # settle_price: '0.6361',
5488
+ # time: '1711050906.382891',
5489
+ # type: '1',
5490
+ # user_id: '3685860'
5491
+ # }
5492
+ # ]
5493
+ # },
5494
+ # message: 'OK'
5495
+ # }
5496
+ #
5497
+ data = self.safe_dict(response, 'data', {})
5498
+ records = self.safe_list(data, 'records', [])
5499
+ modifications = self.parse_margin_modifications(records, None, 'market', 'swap')
5500
+ return self.filter_by_symbol_since_limit(modifications, symbol, since, limit)
ccxt/coinlist.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.coinlist import ImplicitAPI
8
8
  import hashlib
9
9
  import math
10
- from ccxt.base.types import Account, Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
+ from ccxt.base.types import Account, Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import PermissionDenied
@@ -336,7 +336,7 @@ class coinlist(Exchange, ImplicitAPI):
336
336
  string = self.safe_string(response, 'iso')
337
337
  return self.parse8601(string)
338
338
 
339
- def fetch_currencies(self, params={}):
339
+ def fetch_currencies(self, params={}) -> Currencies:
340
340
  """
341
341
  fetches all available currencies on an exchange
342
342
  :see: https://trade-docs.coinlist.co/?javascript--nodejs#list-supported-assets
@@ -856,7 +856,7 @@ class coinlist(Exchange, ImplicitAPI):
856
856
  'info': trade,
857
857
  }, market)
858
858
 
859
- def fetch_trading_fees(self, params={}):
859
+ def fetch_trading_fees(self, params={}) -> TradingFees:
860
860
  """
861
861
  fetch the trading fees for multiple markets
862
862
  :see: https://trade-docs.coinlist.co/?javascript--nodejs#list-fees
ccxt/coinmate.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.coinmate 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, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import ArgumentsRequired
@@ -761,7 +761,7 @@ class coinmate(Exchange, ImplicitAPI):
761
761
  data = self.safe_list(response, 'data', [])
762
762
  return self.parse_trades(data, market, since, limit)
763
763
 
764
- def fetch_trading_fee(self, symbol: str, params={}):
764
+ def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
765
765
  """
766
766
  fetch the trading fees for a market
767
767
  :see: https://coinmate.docs.apiary.io/#reference/trader-fees/get-trading-fees/post
ccxt/coinmetro.py CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.coinmetro import ImplicitAPI
8
- from ccxt.base.types import Balances, Currency, IndexType, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade
8
+ from ccxt.base.types import Balances, Currencies, Currency, IndexType, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import PermissionDenied
@@ -256,7 +256,7 @@ class coinmetro(Exchange, ImplicitAPI):
256
256
  },
257
257
  })
258
258
 
259
- def fetch_currencies(self, params={}):
259
+ def fetch_currencies(self, params={}) -> Currencies:
260
260
  """
261
261
  fetches all available currencies on an exchange
262
262
  :see: https://documenter.getpostman.com/view/3653795/SVfWN6KS#d5876d43-a3fe-4479-8c58-24d0f044edfb
ccxt/coinone.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.coinone import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade
9
+ from ccxt.base.types import Balances, Currencies, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, 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
@@ -205,7 +205,7 @@ class coinone(Exchange, ImplicitAPI):
205
205
  },
206
206
  })
207
207
 
208
- def fetch_currencies(self, params={}):
208
+ def fetch_currencies(self, params={}) -> Currencies:
209
209
  """
210
210
  fetches all available currencies on an exchange
211
211
  :see: https://docs.coinone.co.kr/reference/currencies
ccxt/coinsph.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.coinsph 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, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -1421,7 +1421,7 @@ class coinsph(Exchange, ImplicitAPI):
1421
1421
  }
1422
1422
  return self.safe_string(statuses, status, status)
1423
1423
 
1424
- def fetch_trading_fee(self, symbol: str, params={}):
1424
+ def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
1425
1425
  """
1426
1426
  fetch the trading fees for a market
1427
1427
  :see: https://coins-docs.github.io/rest-api/#trade-fee-user_data
@@ -1447,7 +1447,7 @@ class coinsph(Exchange, ImplicitAPI):
1447
1447
  tradingFee = self.safe_value(response, 0, {})
1448
1448
  return self.parse_trading_fee(tradingFee, market)
1449
1449
 
1450
- def fetch_trading_fees(self, params={}):
1450
+ def fetch_trading_fees(self, params={}) -> TradingFees:
1451
1451
  """
1452
1452
  fetch the trading fees for multiple markets
1453
1453
  :see: https://coins-docs.github.io/rest-api/#trade-fee-user_data
@@ -1477,7 +1477,7 @@ class coinsph(Exchange, ImplicitAPI):
1477
1477
  result[symbol] = fee
1478
1478
  return result
1479
1479
 
1480
- def parse_trading_fee(self, fee, market: Market = None):
1480
+ def parse_trading_fee(self, fee, market: Market = None) -> TradingFeeInterface:
1481
1481
  #
1482
1482
  # {
1483
1483
  # "symbol": "ETHUSDT",
@@ -1493,6 +1493,8 @@ class coinsph(Exchange, ImplicitAPI):
1493
1493
  'symbol': symbol,
1494
1494
  'maker': self.safe_number(fee, 'makerCommission'),
1495
1495
  'taker': self.safe_number(fee, 'takerCommission'),
1496
+ 'percentage': None,
1497
+ 'tierBased': None,
1496
1498
  }
1497
1499
 
1498
1500
  def withdraw(self, code: str, amount: float, address, tag=None, params={}):
ccxt/cryptocom.py CHANGED
@@ -81,6 +81,7 @@ class cryptocom(Exchange, ImplicitAPI):
81
81
  'fetchLedger': True,
82
82
  'fetchLeverage': False,
83
83
  'fetchLeverageTiers': False,
84
+ 'fetchMarginAdjustmentHistory': False,
84
85
  'fetchMarginMode': False,
85
86
  'fetchMarketLeverageTiers': False,
86
87
  'fetchMarkets': True,
ccxt/currencycom.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.currencycom import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Currency, Int, Leverage, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
9
+ from ccxt.base.types import Account, Balances, Currencies, Currency, Int, Leverage, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import ArgumentsRequired
@@ -326,7 +326,7 @@ class currencycom(Exchange, ImplicitAPI):
326
326
  #
327
327
  return self.safe_integer(response, 'serverTime')
328
328
 
329
- def fetch_currencies(self, params={}):
329
+ def fetch_currencies(self, params={}) -> Currencies:
330
330
  """
331
331
  fetches all available currencies on an exchange
332
332
  :see: https://apitradedoc.currency.com/swagger-ui.html#/rest-api/getCurrenciesUsingGET
@@ -628,7 +628,7 @@ class currencycom(Exchange, ImplicitAPI):
628
628
  })
629
629
  return result
630
630
 
631
- def fetch_trading_fees(self, params={}):
631
+ def fetch_trading_fees(self, params={}) -> TradingFees:
632
632
  """
633
633
  fetch the trading fees for multiple markets
634
634
  :see: https://apitradedoc.currency.com/swagger-ui.html#/rest-api/accountUsingGET
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, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade
9
+ from ccxt.base.types import Balances, Currencies, 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
@@ -409,7 +409,7 @@ class delta(Exchange, ImplicitAPI):
409
409
  'info': response,
410
410
  }
411
411
 
412
- def fetch_currencies(self, params={}):
412
+ def fetch_currencies(self, params={}) -> Currencies:
413
413
  """
414
414
  fetches all available currencies on an exchange
415
415
  :see: https://docs.delta.exchange/#get-list-of-all-assets
@@ -2566,6 +2566,7 @@ class delta(Exchange, ImplicitAPI):
2566
2566
  'info': data,
2567
2567
  'symbol': market['symbol'],
2568
2568
  'type': None,
2569
+ 'marginMode': 'isolated',
2569
2570
  'amount': None,
2570
2571
  'total': self.safe_number(data, 'margin'),
2571
2572
  'code': None,
ccxt/deribit.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.deribit import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Currency, Greeks, Int, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Balances, Currencies, Currency, Greeks, Int, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -518,7 +518,7 @@ class deribit(Exchange, ImplicitAPI):
518
518
  #
519
519
  return self.safe_integer(response, 'result')
520
520
 
521
- def fetch_currencies(self, params={}):
521
+ def fetch_currencies(self, params={}) -> Currencies:
522
522
  """
523
523
  fetches all available currencies on an exchange
524
524
  :see: https://docs.deribit.com/#public-get_currencies
@@ -1435,7 +1435,7 @@ class deribit(Exchange, ImplicitAPI):
1435
1435
  trades = self.safe_list(result, 'trades', [])
1436
1436
  return self.parse_trades(trades, market, since, limit)
1437
1437
 
1438
- def fetch_trading_fees(self, params={}):
1438
+ def fetch_trading_fees(self, params={}) -> TradingFees:
1439
1439
  """
1440
1440
  fetch the trading fees for multiple markets
1441
1441
  :see: https://docs.deribit.com/#private-get_account_summary
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, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
+ from ccxt.base.types import Balances, Currencies, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import PermissionDenied
@@ -365,7 +365,7 @@ class digifinex(Exchange, ImplicitAPI):
365
365
  },
366
366
  })
367
367
 
368
- def fetch_currencies(self, params={}):
368
+ def fetch_currencies(self, params={}) -> Currencies:
369
369
  """
370
370
  fetches all available currencies on an exchange
371
371
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -3075,7 +3075,7 @@ class digifinex(Exchange, ImplicitAPI):
3075
3075
  sorted = self.sort_by(rates, 'timestamp')
3076
3076
  return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
3077
3077
 
3078
- def fetch_trading_fee(self, symbol: str, params={}):
3078
+ def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
3079
3079
  """
3080
3080
  fetch the trading fees for a market
3081
3081
  :see: https://docs.digifinex.com/en-ww/swap/v2/rest.html#tradingfee
@@ -3104,7 +3104,7 @@ class digifinex(Exchange, ImplicitAPI):
3104
3104
  data = self.safe_value(response, 'data', {})
3105
3105
  return self.parse_trading_fee(data, market)
3106
3106
 
3107
- def parse_trading_fee(self, fee, market: Market = None):
3107
+ def parse_trading_fee(self, fee, market: Market = None) -> TradingFeeInterface:
3108
3108
  #
3109
3109
  # {
3110
3110
  # "instrument_id": "BTCUSDTPERP",
@@ -3119,6 +3119,8 @@ class digifinex(Exchange, ImplicitAPI):
3119
3119
  'symbol': symbol,
3120
3120
  'maker': self.safe_number(fee, 'maker_fee_rate'),
3121
3121
  'taker': self.safe_number(fee, 'taker_fee_rate'),
3122
+ 'percentage': None,
3123
+ 'tierBased': None,
3122
3124
  }
3123
3125
 
3124
3126
  def fetch_positions(self, symbols: Strings = None, params={}):
@@ -3848,6 +3850,7 @@ class digifinex(Exchange, ImplicitAPI):
3848
3850
  'info': data,
3849
3851
  'symbol': self.safe_symbol(marketId, market, None, 'swap'),
3850
3852
  'type': 'add' if (rawType == 1) else 'reduce',
3853
+ 'marginMode': 'isolated',
3851
3854
  'amount': self.safe_number(data, 'amount'),
3852
3855
  'total': None,
3853
3856
  'code': market['settle'],