ccxt 4.2.87__py2.py3-none-any.whl → 4.2.89__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 (154) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/ascendex.py +5 -3
  3. ccxt/async_support/__init__.py +1 -1
  4. ccxt/async_support/ascendex.py +5 -3
  5. ccxt/async_support/base/exchange.py +3 -2
  6. ccxt/async_support/bigone.py +2 -2
  7. ccxt/async_support/binance.py +17 -11
  8. ccxt/async_support/bingx.py +2 -2
  9. ccxt/async_support/bit2c.py +2 -2
  10. ccxt/async_support/bitbank.py +2 -2
  11. ccxt/async_support/bitfinex.py +2 -2
  12. ccxt/async_support/bitfinex2.py +3 -3
  13. ccxt/async_support/bitflyer.py +4 -2
  14. ccxt/async_support/bitget.py +27 -21
  15. ccxt/async_support/bitmart.py +6 -4
  16. ccxt/async_support/bitmex.py +2 -2
  17. ccxt/async_support/bitopro.py +3 -3
  18. ccxt/async_support/bitrue.py +2 -2
  19. ccxt/async_support/bitso.py +2 -2
  20. ccxt/async_support/bitstamp.py +89 -97
  21. ccxt/async_support/bitteam.py +2 -2
  22. ccxt/async_support/bitvavo.py +3 -3
  23. ccxt/async_support/bl3p.py +2 -2
  24. ccxt/async_support/blockchaincom.py +2 -2
  25. ccxt/async_support/blofin.py +4 -2
  26. ccxt/async_support/bybit.py +7 -5
  27. ccxt/async_support/cex.py +3 -3
  28. ccxt/async_support/coinbase.py +2 -2
  29. ccxt/async_support/coinbaseinternational.py +2 -2
  30. ccxt/async_support/coinbasepro.py +3 -3
  31. ccxt/async_support/coincheck.py +2 -2
  32. ccxt/async_support/coinex.py +5 -5
  33. ccxt/async_support/coinlist.py +3 -3
  34. ccxt/async_support/coinmate.py +2 -2
  35. ccxt/async_support/coinmetro.py +2 -2
  36. ccxt/async_support/coinone.py +2 -2
  37. ccxt/async_support/coinsph.py +6 -4
  38. ccxt/async_support/cryptocom.py +1 -1
  39. ccxt/async_support/currencycom.py +3 -3
  40. ccxt/async_support/delta.py +2 -2
  41. ccxt/async_support/deribit.py +3 -3
  42. ccxt/async_support/digifinex.py +6 -4
  43. ccxt/async_support/exmo.py +3 -3
  44. ccxt/async_support/gate.py +20 -18
  45. ccxt/async_support/gemini.py +3 -3
  46. ccxt/async_support/hitbtc.py +7 -5
  47. ccxt/async_support/hollaex.py +3 -3
  48. ccxt/async_support/htx.py +6 -4
  49. ccxt/async_support/huobijp.py +2 -2
  50. ccxt/async_support/hyperliquid.py +2 -2
  51. ccxt/async_support/idex.py +3 -3
  52. ccxt/async_support/independentreserve.py +2 -2
  53. ccxt/async_support/kraken.py +3 -3
  54. ccxt/async_support/krakenfutures.py +2 -1
  55. ccxt/async_support/kucoin.py +49 -22
  56. ccxt/async_support/kuna.py +2 -2
  57. ccxt/async_support/latoken.py +7 -3
  58. ccxt/async_support/lbank.py +7 -5
  59. ccxt/async_support/luno.py +4 -2
  60. ccxt/async_support/lykke.py +2 -2
  61. ccxt/async_support/mexc.py +57 -10
  62. ccxt/async_support/ndax.py +2 -2
  63. ccxt/async_support/oceanex.py +2 -2
  64. ccxt/async_support/okcoin.py +2 -2
  65. ccxt/async_support/okx.py +6 -4
  66. ccxt/async_support/onetrading.py +3 -3
  67. ccxt/async_support/phemex.py +2 -2
  68. ccxt/async_support/poloniex.py +3 -3
  69. ccxt/async_support/probit.py +2 -2
  70. ccxt/async_support/timex.py +6 -4
  71. ccxt/async_support/upbit.py +2 -2
  72. ccxt/async_support/wazirx.py +2 -2
  73. ccxt/async_support/whitebit.py +3 -3
  74. ccxt/async_support/woo.py +3 -3
  75. ccxt/async_support/yobit.py +2 -2
  76. ccxt/base/exchange.py +35 -9
  77. ccxt/base/types.py +32 -0
  78. ccxt/bigone.py +2 -2
  79. ccxt/binance.py +17 -11
  80. ccxt/bingx.py +2 -2
  81. ccxt/bit2c.py +2 -2
  82. ccxt/bitbank.py +2 -2
  83. ccxt/bitfinex.py +2 -2
  84. ccxt/bitfinex2.py +3 -3
  85. ccxt/bitflyer.py +4 -2
  86. ccxt/bitget.py +27 -21
  87. ccxt/bitmart.py +6 -4
  88. ccxt/bitmex.py +2 -2
  89. ccxt/bitopro.py +3 -3
  90. ccxt/bitrue.py +2 -2
  91. ccxt/bitso.py +2 -2
  92. ccxt/bitstamp.py +89 -97
  93. ccxt/bitteam.py +2 -2
  94. ccxt/bitvavo.py +3 -3
  95. ccxt/bl3p.py +2 -2
  96. ccxt/blockchaincom.py +2 -2
  97. ccxt/blofin.py +4 -2
  98. ccxt/bybit.py +7 -5
  99. ccxt/cex.py +3 -3
  100. ccxt/coinbase.py +2 -2
  101. ccxt/coinbaseinternational.py +2 -2
  102. ccxt/coinbasepro.py +3 -3
  103. ccxt/coincheck.py +2 -2
  104. ccxt/coinex.py +5 -5
  105. ccxt/coinlist.py +3 -3
  106. ccxt/coinmate.py +2 -2
  107. ccxt/coinmetro.py +2 -2
  108. ccxt/coinone.py +2 -2
  109. ccxt/coinsph.py +6 -4
  110. ccxt/cryptocom.py +1 -1
  111. ccxt/currencycom.py +3 -3
  112. ccxt/delta.py +2 -2
  113. ccxt/deribit.py +3 -3
  114. ccxt/digifinex.py +6 -4
  115. ccxt/exmo.py +3 -3
  116. ccxt/gate.py +20 -18
  117. ccxt/gemini.py +3 -3
  118. ccxt/hitbtc.py +7 -5
  119. ccxt/hollaex.py +3 -3
  120. ccxt/htx.py +6 -4
  121. ccxt/huobijp.py +2 -2
  122. ccxt/hyperliquid.py +2 -2
  123. ccxt/idex.py +3 -3
  124. ccxt/independentreserve.py +2 -2
  125. ccxt/kraken.py +3 -3
  126. ccxt/krakenfutures.py +2 -1
  127. ccxt/kucoin.py +49 -22
  128. ccxt/kuna.py +2 -2
  129. ccxt/latoken.py +7 -3
  130. ccxt/lbank.py +7 -5
  131. ccxt/luno.py +4 -2
  132. ccxt/lykke.py +2 -2
  133. ccxt/mexc.py +57 -10
  134. ccxt/ndax.py +2 -2
  135. ccxt/oceanex.py +2 -2
  136. ccxt/okcoin.py +2 -2
  137. ccxt/okx.py +6 -4
  138. ccxt/onetrading.py +3 -3
  139. ccxt/phemex.py +2 -2
  140. ccxt/poloniex.py +3 -3
  141. ccxt/pro/__init__.py +1 -1
  142. ccxt/pro/bitget.py +2 -0
  143. ccxt/pro/bitvavo.py +2 -2
  144. ccxt/probit.py +2 -2
  145. ccxt/timex.py +6 -4
  146. ccxt/upbit.py +2 -2
  147. ccxt/wazirx.py +2 -2
  148. ccxt/whitebit.py +3 -3
  149. ccxt/woo.py +3 -3
  150. ccxt/yobit.py +2 -2
  151. {ccxt-4.2.87.dist-info → ccxt-4.2.89.dist-info}/METADATA +5 -6
  152. {ccxt-4.2.87.dist-info → ccxt-4.2.89.dist-info}/RECORD +154 -154
  153. {ccxt-4.2.87.dist-info → ccxt-4.2.89.dist-info}/WHEEL +0 -0
  154. {ccxt-4.2.87.dist-info → ccxt-4.2.89.dist-info}/top_level.txt +0 -0
ccxt/bitget.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitget import ImplicitAPI
8
8
  import hashlib
9
9
  import json
10
- from ccxt.base.types import Balances, Currency, FundingHistory, Int, Liquidation, Leverage, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
+ from ccxt.base.types import Balances, Currencies, Currency, FundingHistory, Int, Liquidation, Leverage, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, 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
@@ -1316,6 +1316,7 @@ class bitget(Exchange, ImplicitAPI):
1316
1316
  'commonCurrencies': {
1317
1317
  'JADE': 'Jade Protocol',
1318
1318
  'DEGEN': 'DegenReborn',
1319
+ 'TONCOIN': 'TON',
1319
1320
  },
1320
1321
  'options': {
1321
1322
  'timeframes': {
@@ -1812,7 +1813,7 @@ class bitget(Exchange, ImplicitAPI):
1812
1813
  data = self.safe_value(response, 'data', [])
1813
1814
  return self.parse_markets(data)
1814
1815
 
1815
- def fetch_currencies(self, params={}):
1816
+ def fetch_currencies(self, params={}) -> Currencies:
1816
1817
  """
1817
1818
  fetches all available currencies on an exchange
1818
1819
  :see: https://www.bitget.com/api-doc/spot/market/Get-Coin-List
@@ -1853,8 +1854,8 @@ class bitget(Exchange, ImplicitAPI):
1853
1854
  data = self.safe_value(response, 'data', [])
1854
1855
  for i in range(0, len(data)):
1855
1856
  entry = data[i]
1856
- id = self.safe_string(entry, 'coinId')
1857
- code = self.safe_currency_code(self.safe_string(entry, 'coin'))
1857
+ id = self.safe_string(entry, 'coin') # we don't use 'coinId' has no use. it is 'coin' field that needs to be used in currency related endpoints(deposit, withdraw, etc..)
1858
+ code = self.safe_currency_code(id)
1858
1859
  chains = self.safe_value(entry, 'chains', [])
1859
1860
  networks = {}
1860
1861
  deposit = False
@@ -1971,7 +1972,7 @@ class bitget(Exchange, ImplicitAPI):
1971
1972
  raise ArgumentsRequired(self.id + ' fetchMarketLeverageTiers() requires a code argument')
1972
1973
  params = self.omit(params, 'code')
1973
1974
  currency = self.currency(code)
1974
- request['coin'] = currency['code']
1975
+ request['coin'] = currency['id']
1975
1976
  response = self.privateMarginGetV2MarginCrossedTierData(self.extend(request, params))
1976
1977
  else:
1977
1978
  raise BadRequest(self.id + ' fetchMarketLeverageTiers() symbol does not support market ' + market['symbol'])
@@ -2118,7 +2119,7 @@ class bitget(Exchange, ImplicitAPI):
2118
2119
  if since is None:
2119
2120
  since = self.milliseconds() - 7776000000 # 90 days
2120
2121
  request = {
2121
- 'coin': currency['code'],
2122
+ 'coin': currency['id'],
2122
2123
  'startTime': since,
2123
2124
  'endTime': self.milliseconds(),
2124
2125
  }
@@ -2173,7 +2174,7 @@ class bitget(Exchange, ImplicitAPI):
2173
2174
  currency = self.currency(code)
2174
2175
  networkId = self.network_code_to_id(chain)
2175
2176
  request = {
2176
- 'coin': currency['code'],
2177
+ 'coin': currency['id'],
2177
2178
  'address': address,
2178
2179
  'chain': networkId,
2179
2180
  'size': amount,
@@ -2252,7 +2253,7 @@ class bitget(Exchange, ImplicitAPI):
2252
2253
  if since is None:
2253
2254
  since = self.milliseconds() - 7776000000 # 90 days
2254
2255
  request = {
2255
- 'coin': currency['code'],
2256
+ 'coin': currency['id'],
2256
2257
  'startTime': since,
2257
2258
  'endTime': self.milliseconds(),
2258
2259
  }
@@ -2390,7 +2391,7 @@ class bitget(Exchange, ImplicitAPI):
2390
2391
  networkId = self.network_code_to_id(networkCode, code)
2391
2392
  currency = self.currency(code)
2392
2393
  request = {
2393
- 'coin': currency['code'],
2394
+ 'coin': currency['id'],
2394
2395
  }
2395
2396
  if networkId is not None:
2396
2397
  request['chain'] = networkId
@@ -2556,7 +2557,10 @@ class bitget(Exchange, ImplicitAPI):
2556
2557
  #
2557
2558
  marketId = self.safe_string(ticker, 'symbol')
2558
2559
  close = self.safe_string(ticker, 'lastPr')
2559
- timestamp = self.safe_integer(ticker, 'ts')
2560
+ timestampString = self.omit_zero(self.safe_string(ticker, 'ts')) # exchange sometimes provided 0
2561
+ timestamp = None
2562
+ if timestampString is not None:
2563
+ timestamp = self.parse_to_int(timestampString)
2560
2564
  change = self.safe_string(ticker, 'change24h')
2561
2565
  open24 = self.safe_string(ticker, 'open24')
2562
2566
  open = self.safe_string(ticker, 'open')
@@ -3003,7 +3007,7 @@ class bitget(Exchange, ImplicitAPI):
3003
3007
  data = self.safe_list(response, 'data', [])
3004
3008
  return self.parse_trades(data, market, since, limit)
3005
3009
 
3006
- def fetch_trading_fee(self, symbol: str, params={}):
3010
+ def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
3007
3011
  """
3008
3012
  fetch the trading fees for a market
3009
3013
  :see: https://www.bitget.com/api-doc/common/public/Get-Trade-Rate
@@ -3041,7 +3045,7 @@ class bitget(Exchange, ImplicitAPI):
3041
3045
  data = self.safe_value(response, 'data', {})
3042
3046
  return self.parse_trading_fee(data, market)
3043
3047
 
3044
- def fetch_trading_fees(self, params={}):
3048
+ def fetch_trading_fees(self, params={}) -> TradingFees:
3045
3049
  """
3046
3050
  fetch the trading fees for multiple markets
3047
3051
  :see: https://www.bitget.com/api-doc/spot/market/Get-Symbols
@@ -3161,6 +3165,8 @@ class bitget(Exchange, ImplicitAPI):
3161
3165
  'symbol': self.safe_symbol(marketId, market),
3162
3166
  'maker': self.safe_number(data, 'makerFeeRate'),
3163
3167
  'taker': self.safe_number(data, 'takerFeeRate'),
3168
+ 'percentage': None,
3169
+ 'tierBased': None,
3164
3170
  }
3165
3171
 
3166
3172
  def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
@@ -5492,7 +5498,7 @@ class bitget(Exchange, ImplicitAPI):
5492
5498
  request = {}
5493
5499
  if code is not None:
5494
5500
  currency = self.currency(code)
5495
- request['coin'] = currency['code']
5501
+ request['coin'] = currency['id']
5496
5502
  request, params = self.handle_until_option('endTime', request, params)
5497
5503
  if since is not None:
5498
5504
  request['startTime'] = since
@@ -6806,7 +6812,7 @@ class bitget(Exchange, ImplicitAPI):
6806
6812
  type = self.safe_string(accountsByType, fromAccount)
6807
6813
  currency = self.currency(code)
6808
6814
  request = {
6809
- 'coin': currency['code'],
6815
+ 'coin': currency['id'],
6810
6816
  'fromType': type,
6811
6817
  }
6812
6818
  if since is not None:
@@ -6861,7 +6867,7 @@ class bitget(Exchange, ImplicitAPI):
6861
6867
  'fromType': fromType,
6862
6868
  'toType': toType,
6863
6869
  'amount': amount,
6864
- 'coin': currency['code'],
6870
+ 'coin': currency['id'],
6865
6871
  }
6866
6872
  symbol = self.safe_string(params, 'symbol')
6867
6873
  params = self.omit(params, 'symbol')
@@ -7041,7 +7047,7 @@ class bitget(Exchange, ImplicitAPI):
7041
7047
  self.load_markets()
7042
7048
  currency = self.currency(code)
7043
7049
  request = {
7044
- 'coin': currency['code'],
7050
+ 'coin': currency['id'],
7045
7051
  'borrowAmount': self.currency_to_precision(code, amount),
7046
7052
  }
7047
7053
  response = self.privateMarginPostV2MarginCrossedAccountBorrow(self.extend(request, params))
@@ -7074,7 +7080,7 @@ class bitget(Exchange, ImplicitAPI):
7074
7080
  currency = self.currency(code)
7075
7081
  market = self.market(symbol)
7076
7082
  request = {
7077
- 'coin': currency['code'],
7083
+ 'coin': currency['id'],
7078
7084
  'borrowAmount': self.currency_to_precision(code, amount),
7079
7085
  'symbol': market['id'],
7080
7086
  }
@@ -7109,7 +7115,7 @@ class bitget(Exchange, ImplicitAPI):
7109
7115
  currency = self.currency(code)
7110
7116
  market = self.market(symbol)
7111
7117
  request = {
7112
- 'coin': currency['code'],
7118
+ 'coin': currency['id'],
7113
7119
  'repayAmount': self.currency_to_precision(code, amount),
7114
7120
  'symbol': market['id'],
7115
7121
  }
@@ -7143,7 +7149,7 @@ class bitget(Exchange, ImplicitAPI):
7143
7149
  self.load_markets()
7144
7150
  currency = self.currency(code)
7145
7151
  request = {
7146
- 'coin': currency['code'],
7152
+ 'coin': currency['id'],
7147
7153
  'repayAmount': self.currency_to_precision(code, amount),
7148
7154
  }
7149
7155
  response = self.privateMarginPostV2MarginCrossedAccountRepay(self.extend(request, params))
@@ -7489,7 +7495,7 @@ class bitget(Exchange, ImplicitAPI):
7489
7495
  self.load_markets()
7490
7496
  currency = self.currency(code)
7491
7497
  request = {
7492
- 'coin': currency['code'],
7498
+ 'coin': currency['id'],
7493
7499
  }
7494
7500
  response = self.privateMarginGetV2MarginCrossedInterestRateAndLimit(self.extend(request, params))
7495
7501
  #
@@ -7580,7 +7586,7 @@ class bitget(Exchange, ImplicitAPI):
7580
7586
  currency = None
7581
7587
  if code is not None:
7582
7588
  currency = self.currency(code)
7583
- request['coin'] = currency['code']
7589
+ request['coin'] = currency['id']
7584
7590
  if since is not None:
7585
7591
  request['startTime'] = since
7586
7592
  else:
ccxt/bitmart.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitmart 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, TransferEntry
9
+ from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -985,7 +985,7 @@ class bitmart(Exchange, ImplicitAPI):
985
985
  contract = self.fetch_contract_markets(params)
986
986
  return self.array_concat(spot, contract)
987
987
 
988
- def fetch_currencies(self, params={}):
988
+ def fetch_currencies(self, params={}) -> Currencies:
989
989
  """
990
990
  fetches all available currencies on an exchange
991
991
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1999,7 +1999,7 @@ class bitmart(Exchange, ImplicitAPI):
1999
1999
  #
2000
2000
  return self.custom_parse_balance(response, marketType)
2001
2001
 
2002
- def parse_trading_fee(self, fee, market: Market = None):
2002
+ def parse_trading_fee(self, fee, market: Market = None) -> TradingFeeInterface:
2003
2003
  #
2004
2004
  # {
2005
2005
  # "symbol": "ETH_USDT",
@@ -2014,9 +2014,11 @@ class bitmart(Exchange, ImplicitAPI):
2014
2014
  'symbol': symbol,
2015
2015
  'maker': self.safe_number(fee, 'maker_fee_rate'),
2016
2016
  'taker': self.safe_number(fee, 'taker_fee_rate'),
2017
+ 'percentage': None,
2018
+ 'tierBased': None,
2017
2019
  }
2018
2020
 
2019
- def fetch_trading_fee(self, symbol: str, params={}):
2021
+ def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
2020
2022
  """
2021
2023
  fetch the trading fees for a market
2022
2024
  :param str symbol: unified market symbol
ccxt/bitmex.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitmex import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
9
+ from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, Leverages, Market, MarketType, 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
@@ -290,7 +290,7 @@ class bitmex(Exchange, ImplicitAPI):
290
290
  },
291
291
  })
292
292
 
293
- def fetch_currencies(self, params={}):
293
+ def fetch_currencies(self, params={}) -> Currencies:
294
294
  """
295
295
  fetches all available currencies on an exchange
296
296
  :see: https://www.bitmex.com/api/explorer/#not /Wallet/Wallet_getAssetsConfig
ccxt/bitopro.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitopro import ImplicitAPI
8
8
  import hashlib
9
9
  import math
10
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
10
+ from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import ArgumentsRequired
@@ -220,7 +220,7 @@ class bitopro(Exchange, ImplicitAPI):
220
220
  },
221
221
  })
222
222
 
223
- def fetch_currencies(self, params={}):
223
+ def fetch_currencies(self, params={}) -> Currencies:
224
224
  """
225
225
  fetches all available currencies on an exchange
226
226
  :see: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/public/get_currency_info.md
@@ -617,7 +617,7 @@ class bitopro(Exchange, ImplicitAPI):
617
617
  #
618
618
  return self.parse_trades(trades, market, since, limit)
619
619
 
620
- def fetch_trading_fees(self, params={}):
620
+ def fetch_trading_fees(self, params={}) -> TradingFees:
621
621
  """
622
622
  fetch the trading fees for multiple markets
623
623
  :see: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/public/get_limitations_and_fees.md
ccxt/bitrue.py CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitrue import ImplicitAPI
8
8
  import hashlib
9
9
  import json
10
- from ccxt.base.types import Balances, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
+ from ccxt.base.types import Balances, Currencies, Currency, Int, MarginModification, Market, Num, Order, OrderBook, 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
@@ -592,7 +592,7 @@ class bitrue(Exchange, ImplicitAPI):
592
592
  }
593
593
  return self.safe_string_2(networksById, networkId, uppercaseNetworkId, networkId)
594
594
 
595
- def fetch_currencies(self, params={}):
595
+ def fetch_currencies(self, params={}) -> Currencies:
596
596
  """
597
597
  fetches all available currencies on an exchange
598
598
  :param dict [params]: extra parameters specific to the exchange API endpoint
ccxt/bitso.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitso import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Trade, Transaction
9
+ from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, 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 ArgumentsRequired
@@ -814,7 +814,7 @@ class bitso(Exchange, ImplicitAPI):
814
814
  response = self.publicGetTrades(self.extend(request, params))
815
815
  return self.parse_trades(response['payload'], market, since, limit)
816
816
 
817
- def fetch_trading_fees(self, params={}):
817
+ def fetch_trading_fees(self, params={}) -> TradingFees:
818
818
  """
819
819
  fetch the trading fees for multiple markets
820
820
  :see: https://docs.bitso.com/bitso-api/docs/list-fees
ccxt/bitstamp.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitstamp 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, TransferEntry
9
+ from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, 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
@@ -441,6 +441,30 @@ class bitstamp(Exchange, ImplicitAPI):
441
441
  'commonCurrencies': {
442
442
  'UST': 'USTC',
443
443
  },
444
+ # exchange-specific options
445
+ 'options': {
446
+ 'networksById': {
447
+ 'bitcoin-cash': 'BCH',
448
+ 'bitcoin': 'BTC',
449
+ 'ethereum': 'ERC20',
450
+ 'litecoin': 'LTC',
451
+ 'stellar': 'XLM',
452
+ 'xrpl': 'XRP',
453
+ 'tron': 'TRC20',
454
+ 'algorand': 'ALGO',
455
+ 'flare': 'FLR',
456
+ 'hedera': 'HBAR',
457
+ 'cardana': 'ADA',
458
+ 'songbird': 'FLR',
459
+ 'avalanche-c-chain': 'AVAX',
460
+ 'solana': 'SOL',
461
+ 'polkadot': 'DOT',
462
+ 'near': 'NEAR',
463
+ 'doge': 'DOGE',
464
+ 'sui': 'SUI',
465
+ 'casper': 'CSRP',
466
+ },
467
+ },
444
468
  'exceptions': {
445
469
  'exact': {
446
470
  'No permission found': PermissionDenied,
@@ -607,7 +631,7 @@ class bitstamp(Exchange, ImplicitAPI):
607
631
  })
608
632
  return self.safe_value(self.options['fetchMarkets'], 'response')
609
633
 
610
- def fetch_currencies(self, params={}):
634
+ def fetch_currencies(self, params={}) -> Currencies:
611
635
  """
612
636
  fetches all available currencies on an exchange
613
637
  :see: https://www.bitstamp.net/api/#tag/Market-info/operation/GetTradingPairsInfo
@@ -1117,7 +1141,7 @@ class bitstamp(Exchange, ImplicitAPI):
1117
1141
  #
1118
1142
  return self.parse_balance(response)
1119
1143
 
1120
- def fetch_trading_fee(self, symbol: str, params={}):
1144
+ def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
1121
1145
  """
1122
1146
  fetch the trading fees for a market
1123
1147
  :see: https://www.bitstamp.net/api/#tag/Fees/operation/GetTradingFeesForCurrency
@@ -1149,7 +1173,7 @@ class bitstamp(Exchange, ImplicitAPI):
1149
1173
  tradingFee = self.safe_dict(tradingFeesByMarketId, market['id'])
1150
1174
  return self.parse_trading_fee(tradingFee, market)
1151
1175
 
1152
- def parse_trading_fee(self, fee, market: Market = None):
1176
+ def parse_trading_fee(self, fee, market: Market = None) -> TradingFeeInterface:
1153
1177
  marketId = self.safe_string(fee, 'market')
1154
1178
  fees = self.safe_dict(fee, 'fees', {})
1155
1179
  return {
@@ -1157,6 +1181,8 @@ class bitstamp(Exchange, ImplicitAPI):
1157
1181
  'symbol': self.safe_symbol(marketId, market),
1158
1182
  'maker': self.safe_number(fees, 'maker'),
1159
1183
  'taker': self.safe_number(fees, 'taker'),
1184
+ 'percentage': None,
1185
+ 'tierBased': None,
1160
1186
  }
1161
1187
 
1162
1188
  def parse_trading_fees(self, fees):
@@ -1168,7 +1194,7 @@ class bitstamp(Exchange, ImplicitAPI):
1168
1194
  result[symbol] = fee
1169
1195
  return result
1170
1196
 
1171
- def fetch_trading_fees(self, params={}):
1197
+ def fetch_trading_fees(self, params={}) -> TradingFees:
1172
1198
  """
1173
1199
  fetch the trading fees for multiple markets
1174
1200
  :see: https://www.bitstamp.net/api/#tag/Fees/operation/GetAllTradingFees
@@ -1197,58 +1223,43 @@ class bitstamp(Exchange, ImplicitAPI):
1197
1223
  """
1198
1224
  * @deprecated
1199
1225
  please use fetchDepositWithdrawFees instead
1200
- :see: https://www.bitstamp.net/api/#balance
1226
+ :see: https://www.bitstamp.net/api/#tag/Fees
1201
1227
  :param str[]|None codes: list of unified currency codes
1202
1228
  :param dict [params]: extra parameters specific to the exchange API endpoint
1203
1229
  :returns dict[]: a list of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>`
1204
1230
  """
1205
1231
  self.load_markets()
1206
- balance = self.privatePostBalance(params)
1207
- return self.parse_transaction_fees(balance)
1232
+ response = self.privatePostFeesWithdrawal(params)
1233
+ #
1234
+ # [
1235
+ # {
1236
+ # "currency": "btc",
1237
+ # "fee": "0.00015000",
1238
+ # "network": "bitcoin"
1239
+ # }
1240
+ # ...
1241
+ # ]
1242
+ #
1243
+ return self.parse_transaction_fees(response)
1208
1244
 
1209
1245
  def parse_transaction_fees(self, response, codes=None):
1210
- #
1211
- # {
1212
- # "yfi_available": "0.00000000",
1213
- # "yfi_balance": "0.00000000",
1214
- # "yfi_reserved": "0.00000000",
1215
- # "yfi_withdrawal_fee": "0.00070000",
1216
- # "yfieur_fee": "0.000",
1217
- # "yfiusd_fee": "0.000",
1218
- # "zrx_available": "0.00000000",
1219
- # "zrx_balance": "0.00000000",
1220
- # "zrx_reserved": "0.00000000",
1221
- # "zrx_withdrawal_fee": "12.00000000",
1222
- # "zrxeur_fee": "0.000",
1223
- # "zrxusd_fee": "0.000",
1224
- # ...
1225
- # }
1226
- #
1227
- if codes is None:
1228
- codes = list(self.currencies.keys())
1229
1246
  result = {}
1230
- mainCurrencyId = None
1231
- ids = list(response.keys())
1247
+ currencies = self.index_by(response, 'currency')
1248
+ ids = list(currencies.keys())
1232
1249
  for i in range(0, len(ids)):
1233
1250
  id = ids[i]
1234
- currencyId = id.split('_')[0]
1235
- code = self.safe_currency_code(currencyId)
1236
- if codes is not None and not self.in_array(code, codes):
1251
+ fees = self.safe_value(response, i, {})
1252
+ code = self.safe_currency_code(id)
1253
+ if (codes is not None) and not self.in_array(code, codes):
1237
1254
  continue
1238
- if id.find('_available') >= 0:
1239
- mainCurrencyId = currencyId
1240
- result[code] = {
1241
- 'deposit': None,
1242
- 'withdraw': None,
1243
- 'info': {},
1244
- }
1245
- if currencyId == mainCurrencyId:
1246
- result[code]['info'][id] = self.safe_number(response, id)
1247
- if id.find('_withdrawal_fee') >= 0:
1248
- result[code]['withdraw'] = self.safe_number(response, id)
1255
+ result[code] = {
1256
+ 'withdraw_fee': self.safe_number(fees, 'fee'),
1257
+ 'deposit': {},
1258
+ 'info': self.safe_dict(currencies, id),
1259
+ }
1249
1260
  return result
1250
1261
 
1251
- def fetch_deposit_withdraw_fees(self, codes: Strings = None, params={}):
1262
+ def fetch_deposit_withdraw_fees(self, codes=None, params={}):
1252
1263
  """
1253
1264
  fetch deposit and withdraw fees
1254
1265
  :see: https://www.bitstamp.net/api/#tag/Fees/operation/GetAllWithdrawalFees
@@ -1257,60 +1268,41 @@ class bitstamp(Exchange, ImplicitAPI):
1257
1268
  :returns dict[]: a list of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>`
1258
1269
  """
1259
1270
  self.load_markets()
1260
- response = self.privatePostBalance(params)
1261
- #
1262
- # {
1263
- # "yfi_available": "0.00000000",
1264
- # "yfi_balance": "0.00000000",
1265
- # "yfi_reserved": "0.00000000",
1266
- # "yfi_withdrawal_fee": "0.00070000",
1267
- # "yfieur_fee": "0.000",
1268
- # "yfiusd_fee": "0.000",
1269
- # "zrx_available": "0.00000000",
1270
- # "zrx_balance": "0.00000000",
1271
- # "zrx_reserved": "0.00000000",
1272
- # "zrx_withdrawal_fee": "12.00000000",
1273
- # "zrxeur_fee": "0.000",
1274
- # "zrxusd_fee": "0.000",
1275
- # ...
1276
- # }
1277
- #
1278
- return self.parse_deposit_withdraw_fees(response, codes)
1279
-
1280
- def parse_deposit_withdraw_fees(self, response, codes=None, currencyIdKey=None):
1281
- #
1282
- # {
1283
- # "yfi_available": "0.00000000",
1284
- # "yfi_balance": "0.00000000",
1285
- # "yfi_reserved": "0.00000000",
1286
- # "yfi_withdrawal_fee": "0.00070000",
1287
- # "yfieur_fee": "0.000",
1288
- # "yfiusd_fee": "0.000",
1289
- # "zrx_available": "0.00000000",
1290
- # "zrx_balance": "0.00000000",
1291
- # "zrx_reserved": "0.00000000",
1292
- # "zrx_withdrawal_fee": "12.00000000",
1293
- # "zrxeur_fee": "0.000",
1294
- # "zrxusd_fee": "0.000",
1295
- # ...
1296
- # }
1271
+ response = self.privatePostFeesWithdrawal(params)
1297
1272
  #
1298
- result = {}
1299
- ids = list(response.keys())
1300
- for i in range(0, len(ids)):
1301
- id = ids[i]
1302
- currencyId = id.split('_')[0]
1303
- code = self.safe_currency_code(currencyId)
1304
- dictValue = self.safe_number(response, id)
1305
- if codes is not None and not self.in_array(code, codes):
1306
- continue
1307
- if id.find('_available') >= 0:
1308
- result[code] = self.deposit_withdraw_fee({})
1309
- if id.find('_withdrawal_fee') >= 0:
1310
- result[code]['withdraw']['fee'] = dictValue
1311
- resultValue = self.safe_value(result, code)
1312
- if resultValue is not None:
1313
- result[code]['info'][id] = dictValue
1273
+ # [
1274
+ # {
1275
+ # "currency": "btc",
1276
+ # "fee": "0.00015000",
1277
+ # "network": "bitcoin"
1278
+ # }
1279
+ # ...
1280
+ # ]
1281
+ #
1282
+ responseByCurrencyId = self.group_by(response, 'currency')
1283
+ return self.parse_deposit_withdraw_fees(responseByCurrencyId, codes)
1284
+
1285
+ def parse_deposit_withdraw_fee(self, fee, currency=None):
1286
+ result = self.deposit_withdraw_fee(fee)
1287
+ for j in range(0, len(fee)):
1288
+ networkEntry = fee[j]
1289
+ networkId = self.safe_string(networkEntry, 'network')
1290
+ networkCode = self.network_id_to_code(networkId)
1291
+ withdrawFee = self.safe_number(networkEntry, 'fee')
1292
+ result['withdraw'] = {
1293
+ 'fee': withdrawFee,
1294
+ 'percentage': None,
1295
+ }
1296
+ result['networks'][networkCode] = {
1297
+ 'withdraw': {
1298
+ 'fee': withdrawFee,
1299
+ 'percentage': None,
1300
+ },
1301
+ 'deposit': {
1302
+ 'fee': None,
1303
+ 'percentage': None,
1304
+ },
1305
+ }
1314
1306
  return result
1315
1307
 
1316
1308
  def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
ccxt/bitteam.py CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitteam import ImplicitAPI
8
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
8
+ from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import ArgumentsRequired
@@ -415,7 +415,7 @@ class bitteam(Exchange, ImplicitAPI):
415
415
  'info': market,
416
416
  })
417
417
 
418
- def fetch_currencies(self, params={}):
418
+ def fetch_currencies(self, params={}) -> Currencies:
419
419
  """
420
420
  fetches all available currencies on an exchange
421
421
  :see: https://bit.team/trade/api/documentation#/PUBLIC/getTradeApiCurrencies
ccxt/bitvavo.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitvavo 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, 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
@@ -414,7 +414,7 @@ class bitvavo(Exchange, ImplicitAPI):
414
414
  }))
415
415
  return result
416
416
 
417
- def fetch_currencies(self, params={}):
417
+ def fetch_currencies(self, params={}) -> Currencies:
418
418
  """
419
419
  :see: https://docs.bitvavo.com/#tag/General/paths/~1assets/get
420
420
  fetches all available currencies on an exchange
@@ -805,7 +805,7 @@ class bitvavo(Exchange, ImplicitAPI):
805
805
  'fee': fee,
806
806
  }, market)
807
807
 
808
- def fetch_trading_fees(self, params={}):
808
+ def fetch_trading_fees(self, params={}) -> TradingFees:
809
809
  """
810
810
  :see: https://docs.bitvavo.com/#tag/Account/paths/~1account/get
811
811
  fetch the trading fees for multiple markets
ccxt/bl3p.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bl3p import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, IndexType, Int, Market, Num, OrderBook, OrderSide, OrderType, Str, Ticker, Trade
9
+ from ccxt.base.types import Balances, Currency, IndexType, Int, Market, Num, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, TradingFees
10
10
  from typing import List
11
11
  from ccxt.base.decimal_to_precision import TICK_SIZE
12
12
  from ccxt.base.precise import Precise
@@ -311,7 +311,7 @@ class bl3p(Exchange, ImplicitAPI):
311
311
  result = self.parse_trades(response['data']['trades'], market, since, limit)
312
312
  return result
313
313
 
314
- def fetch_trading_fees(self, params={}):
314
+ def fetch_trading_fees(self, params={}) -> TradingFees:
315
315
  """
316
316
  fetch the trading fees for multiple markets
317
317
  :see: https://github.com/BitonicNL/bl3p-api/blob/master/docs/authenticated_api/http.md#35---get-account-info--balance