ccxt 4.3.33__py2.py3-none-any.whl → 4.3.35__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 (204) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/binance.py +1 -0
  3. ccxt/abstract/binancecoinm.py +1 -0
  4. ccxt/abstract/binanceus.py +1 -0
  5. ccxt/abstract/binanceusdm.py +1 -0
  6. ccxt/ace.py +2 -2
  7. ccxt/alpaca.py +2 -2
  8. ccxt/ascendex.py +2 -2
  9. ccxt/async_support/__init__.py +1 -1
  10. ccxt/async_support/ace.py +2 -2
  11. ccxt/async_support/alpaca.py +2 -2
  12. ccxt/async_support/ascendex.py +2 -2
  13. ccxt/async_support/base/exchange.py +56 -40
  14. ccxt/async_support/bigone.py +2 -2
  15. ccxt/async_support/binance.py +6 -5
  16. ccxt/async_support/bingx.py +4 -3
  17. ccxt/async_support/bit2c.py +1 -1
  18. ccxt/async_support/bitbank.py +1 -1
  19. ccxt/async_support/bitbns.py +1 -1
  20. ccxt/async_support/bitfinex.py +2 -2
  21. ccxt/async_support/bitfinex2.py +1 -1
  22. ccxt/async_support/bitflyer.py +1 -1
  23. ccxt/async_support/bitget.py +4 -4
  24. ccxt/async_support/bithumb.py +1 -1
  25. ccxt/async_support/bitmart.py +4 -9
  26. ccxt/async_support/bitmex.py +3 -3
  27. ccxt/async_support/bitopro.py +3 -3
  28. ccxt/async_support/bitrue.py +2 -2
  29. ccxt/async_support/bitso.py +2 -2
  30. ccxt/async_support/bitstamp.py +2 -2
  31. ccxt/async_support/bitteam.py +3 -3
  32. ccxt/async_support/bitvavo.py +2 -2
  33. ccxt/async_support/blockchaincom.py +1 -1
  34. ccxt/async_support/blofin.py +3 -3
  35. ccxt/async_support/btcalpha.py +3 -3
  36. ccxt/async_support/btcbox.py +1 -1
  37. ccxt/async_support/btcmarkets.py +6 -4
  38. ccxt/async_support/btcturk.py +1 -1
  39. ccxt/async_support/bybit.py +3 -3
  40. ccxt/async_support/cex.py +1 -1
  41. ccxt/async_support/coinbase.py +156 -58
  42. ccxt/async_support/coinbaseexchange.py +1 -1
  43. ccxt/async_support/coinbaseinternational.py +3 -3
  44. ccxt/async_support/coincheck.py +2 -2
  45. ccxt/async_support/coinex.py +28 -21
  46. ccxt/async_support/coinlist.py +2 -2
  47. ccxt/async_support/coinmate.py +2 -2
  48. ccxt/async_support/coinmetro.py +2 -2
  49. ccxt/async_support/coinone.py +1 -1
  50. ccxt/async_support/coinsph.py +2 -2
  51. ccxt/async_support/cryptocom.py +1 -1
  52. ccxt/async_support/currencycom.py +2 -2
  53. ccxt/async_support/delta.py +1 -1
  54. ccxt/async_support/deribit.py +2 -2
  55. ccxt/async_support/digifinex.py +2 -2
  56. ccxt/async_support/exmo.py +2 -2
  57. ccxt/async_support/gate.py +2 -2
  58. ccxt/async_support/gemini.py +3 -3
  59. ccxt/async_support/hitbtc.py +2 -2
  60. ccxt/async_support/hollaex.py +1 -1
  61. ccxt/async_support/htx.py +2 -2
  62. ccxt/async_support/huobijp.py +2 -2
  63. ccxt/async_support/hyperliquid.py +2 -2
  64. ccxt/async_support/idex.py +2 -2
  65. ccxt/async_support/indodax.py +2 -2
  66. ccxt/async_support/kraken.py +5 -3
  67. ccxt/async_support/krakenfutures.py +1 -1
  68. ccxt/async_support/kucoin.py +2 -2
  69. ccxt/async_support/kuna.py +2 -2
  70. ccxt/async_support/latoken.py +2 -2
  71. ccxt/async_support/lbank.py +1 -1
  72. ccxt/async_support/luno.py +1 -1
  73. ccxt/async_support/lykke.py +1 -1
  74. ccxt/async_support/mercado.py +1 -1
  75. ccxt/async_support/mexc.py +1 -1
  76. ccxt/async_support/ndax.py +2 -2
  77. ccxt/async_support/novadax.py +3 -3
  78. ccxt/async_support/oceanex.py +2 -2
  79. ccxt/async_support/okcoin.py +3 -3
  80. ccxt/async_support/okx.py +3 -3
  81. ccxt/async_support/onetrading.py +2 -2
  82. ccxt/async_support/p2b.py +2 -2
  83. ccxt/async_support/paymium.py +1 -1
  84. ccxt/async_support/phemex.py +4 -4
  85. ccxt/async_support/poloniex.py +3 -3
  86. ccxt/async_support/poloniexfutures.py +2 -2
  87. ccxt/async_support/probit.py +3 -3
  88. ccxt/async_support/timex.py +2 -2
  89. ccxt/async_support/tokocrypto.py +1 -1
  90. ccxt/async_support/tradeogre.py +1 -1
  91. ccxt/async_support/upbit.py +3 -3
  92. ccxt/async_support/wavesexchange.py +1 -1
  93. ccxt/async_support/wazirx.py +3 -3
  94. ccxt/async_support/whitebit.py +3 -3
  95. ccxt/async_support/woo.py +3 -3
  96. ccxt/async_support/woofipro.py +3 -3
  97. ccxt/async_support/yobit.py +1 -1
  98. ccxt/async_support/zaif.py +2 -2
  99. ccxt/async_support/zonda.py +1 -1
  100. ccxt/base/exchange.py +107 -76
  101. ccxt/base/types.py +0 -1
  102. ccxt/bigone.py +2 -2
  103. ccxt/binance.py +6 -5
  104. ccxt/bingx.py +4 -3
  105. ccxt/bit2c.py +1 -1
  106. ccxt/bitbank.py +1 -1
  107. ccxt/bitbns.py +1 -1
  108. ccxt/bitfinex.py +2 -2
  109. ccxt/bitfinex2.py +1 -1
  110. ccxt/bitflyer.py +1 -1
  111. ccxt/bitget.py +4 -4
  112. ccxt/bithumb.py +1 -1
  113. ccxt/bitmart.py +4 -9
  114. ccxt/bitmex.py +3 -3
  115. ccxt/bitopro.py +3 -3
  116. ccxt/bitrue.py +2 -2
  117. ccxt/bitso.py +2 -2
  118. ccxt/bitstamp.py +2 -2
  119. ccxt/bitteam.py +3 -3
  120. ccxt/bitvavo.py +2 -2
  121. ccxt/blockchaincom.py +1 -1
  122. ccxt/blofin.py +3 -3
  123. ccxt/btcalpha.py +3 -3
  124. ccxt/btcbox.py +1 -1
  125. ccxt/btcmarkets.py +6 -4
  126. ccxt/btcturk.py +1 -1
  127. ccxt/bybit.py +3 -3
  128. ccxt/cex.py +1 -1
  129. ccxt/coinbase.py +156 -58
  130. ccxt/coinbaseexchange.py +1 -1
  131. ccxt/coinbaseinternational.py +3 -3
  132. ccxt/coincheck.py +2 -2
  133. ccxt/coinex.py +28 -21
  134. ccxt/coinlist.py +2 -2
  135. ccxt/coinmate.py +2 -2
  136. ccxt/coinmetro.py +2 -2
  137. ccxt/coinone.py +1 -1
  138. ccxt/coinsph.py +2 -2
  139. ccxt/cryptocom.py +1 -1
  140. ccxt/currencycom.py +2 -2
  141. ccxt/delta.py +1 -1
  142. ccxt/deribit.py +2 -2
  143. ccxt/digifinex.py +2 -2
  144. ccxt/exmo.py +2 -2
  145. ccxt/gate.py +2 -2
  146. ccxt/gemini.py +3 -3
  147. ccxt/hitbtc.py +2 -2
  148. ccxt/hollaex.py +1 -1
  149. ccxt/htx.py +2 -2
  150. ccxt/huobijp.py +2 -2
  151. ccxt/hyperliquid.py +2 -2
  152. ccxt/idex.py +2 -2
  153. ccxt/indodax.py +2 -2
  154. ccxt/kraken.py +5 -3
  155. ccxt/krakenfutures.py +1 -1
  156. ccxt/kucoin.py +2 -2
  157. ccxt/kuna.py +2 -2
  158. ccxt/latoken.py +2 -2
  159. ccxt/lbank.py +1 -1
  160. ccxt/luno.py +1 -1
  161. ccxt/lykke.py +1 -1
  162. ccxt/mercado.py +1 -1
  163. ccxt/mexc.py +1 -1
  164. ccxt/ndax.py +2 -2
  165. ccxt/novadax.py +3 -3
  166. ccxt/oceanex.py +2 -2
  167. ccxt/okcoin.py +3 -3
  168. ccxt/okx.py +3 -3
  169. ccxt/onetrading.py +2 -2
  170. ccxt/p2b.py +2 -2
  171. ccxt/paymium.py +1 -1
  172. ccxt/phemex.py +4 -4
  173. ccxt/poloniex.py +3 -3
  174. ccxt/poloniexfutures.py +2 -2
  175. ccxt/pro/__init__.py +1 -1
  176. ccxt/pro/binance.py +331 -2
  177. ccxt/pro/bitget.py +24 -1
  178. ccxt/pro/bitmart.py +1 -1
  179. ccxt/pro/bitmex.py +98 -1
  180. ccxt/pro/bybit.py +82 -1
  181. ccxt/pro/gate.py +173 -1
  182. ccxt/pro/kraken.py +1 -1
  183. ccxt/pro/kucoinfutures.py +4 -0
  184. ccxt/pro/okx.py +244 -1
  185. ccxt/probit.py +3 -3
  186. ccxt/test/base/__init__.py +1 -0
  187. ccxt/test/base/test_crypto.py +1 -1
  188. ccxt/test/base/test_liquidation.py +50 -0
  189. ccxt/timex.py +2 -2
  190. ccxt/tokocrypto.py +1 -1
  191. ccxt/tradeogre.py +1 -1
  192. ccxt/upbit.py +3 -3
  193. ccxt/wavesexchange.py +1 -1
  194. ccxt/wazirx.py +3 -3
  195. ccxt/whitebit.py +3 -3
  196. ccxt/woo.py +3 -3
  197. ccxt/woofipro.py +3 -3
  198. ccxt/yobit.py +1 -1
  199. ccxt/zaif.py +2 -2
  200. ccxt/zonda.py +1 -1
  201. {ccxt-4.3.33.dist-info → ccxt-4.3.35.dist-info}/METADATA +4 -4
  202. {ccxt-4.3.33.dist-info → ccxt-4.3.35.dist-info}/RECORD +204 -203
  203. {ccxt-4.3.33.dist-info → ccxt-4.3.35.dist-info}/WHEEL +0 -0
  204. {ccxt-4.3.33.dist-info → ccxt-4.3.35.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, Conversion, Currencies, Currency, Int, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
9
+ from ccxt.base.types import Account, Balances, Conversion, Currencies, Currency, Int, Market, MarketInterface, 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 AuthenticationError
@@ -121,8 +121,8 @@ class coinbase(Exchange, ImplicitAPI):
121
121
  'fetchTickers': True,
122
122
  'fetchTime': True,
123
123
  'fetchTrades': True,
124
- 'fetchTradingFee': False,
125
- 'fetchTradingFees': False,
124
+ 'fetchTradingFee': 'emulated',
125
+ 'fetchTradingFees': True,
126
126
  'fetchWithdrawals': True,
127
127
  'reduceMargin': False,
128
128
  'setLeverage': False,
@@ -352,6 +352,7 @@ class coinbase(Exchange, ImplicitAPI):
352
352
  'CGLD': 'CELO',
353
353
  },
354
354
  'options': {
355
+ 'usePrivate': False,
355
356
  'brokerId': 'ccxt',
356
357
  'stablePairs': ['BUSD-USD', 'CBETH-ETH', 'DAI-USD', 'GUSD-USD', 'GYEN-USD', 'PAX-USD', 'PAX-USDT', 'USDC-EUR', 'USDC-GBP', 'USDT-EUR', 'USDT-GBP', 'USDT-USD', 'USDT-USDC', 'WBTC-BTC'],
357
358
  'fetchCurrencies': {
@@ -774,7 +775,7 @@ class coinbase(Exchange, ImplicitAPI):
774
775
  # fiat only, for crypto transactions use fetchLedger
775
776
  return self.fetch_transactions_with_method('v2PrivateGetAccountsAccountIdDeposits', code, since, limit, params)
776
777
 
777
- def parse_transaction_status(self, status):
778
+ def parse_transaction_status(self, status: Str):
778
779
  statuses: dict = {
779
780
  'created': 'pending',
780
781
  'completed': 'ok',
@@ -1073,6 +1074,7 @@ class coinbase(Exchange, ImplicitAPI):
1073
1074
  :see: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates
1074
1075
  retrieves data on all markets for coinbase
1075
1076
  :param dict [params]: extra parameters specific to the exchange API endpoint
1077
+ :param boolean [params.usePrivate]: use private endpoint for fetching markets
1076
1078
  :returns dict[]: an array of objects representing market data
1077
1079
  """
1078
1080
  method = self.safe_string(self.options, 'fetchMarkets', 'fetchMarketsV3')
@@ -1150,54 +1152,58 @@ class coinbase(Exchange, ImplicitAPI):
1150
1152
  return result
1151
1153
 
1152
1154
  def fetch_markets_v3(self, params={}):
1153
- spotUnresolvedPromises = [
1154
- self.v3PublicGetBrokerageMarketProducts(params),
1155
- #
1156
- # {
1157
- # products: [
1158
- # {
1159
- # product_id: 'BTC-USD',
1160
- # price: '67060',
1161
- # price_percentage_change_24h: '3.30054960636883',
1162
- # volume_24h: '10967.87426597',
1163
- # volume_percentage_change_24h: '141.73048325503036',
1164
- # base_increment: '0.00000001',
1165
- # quote_increment: '0.01',
1166
- # quote_min_size: '1',
1167
- # quote_max_size: '150000000',
1168
- # base_min_size: '0.00000001',
1169
- # base_max_size: '3400',
1170
- # base_name: 'Bitcoin',
1171
- # quote_name: 'US Dollar',
1172
- # watched: False,
1173
- # is_disabled: False,
1174
- # new: False,
1175
- # status: 'online',
1176
- # cancel_only: False,
1177
- # limit_only: False,
1178
- # post_only: False,
1179
- # trading_disabled: False,
1180
- # auction_mode: False,
1181
- # product_type: 'SPOT',
1182
- # quote_currency_id: 'USD',
1183
- # base_currency_id: 'BTC',
1184
- # fcm_trading_session_details: null,
1185
- # mid_market_price: '',
1186
- # alias: '',
1187
- # alias_to: ['BTC-USDC'],
1188
- # base_display_symbol: 'BTC',
1189
- # quote_display_symbol: 'USD',
1190
- # view_only: False,
1191
- # price_increment: '0.01',
1192
- # display_name: 'BTC-USD',
1193
- # product_venue: 'CBE'
1194
- # },
1195
- # ...
1196
- # ],
1197
- # num_products: '646'
1198
- # }
1199
- #
1200
- ]
1155
+ usePrivate = False
1156
+ usePrivate, params = self.handle_option_and_params(params, 'fetchMarkets', 'usePrivate', False)
1157
+ spotUnresolvedPromises = []
1158
+ if usePrivate:
1159
+ spotUnresolvedPromises.append(self.v3PrivateGetBrokerageProducts(params))
1160
+ else:
1161
+ spotUnresolvedPromises.append(self.v3PublicGetBrokerageMarketProducts(params))
1162
+ #
1163
+ # {
1164
+ # products: [
1165
+ # {
1166
+ # product_id: 'BTC-USD',
1167
+ # price: '67060',
1168
+ # price_percentage_change_24h: '3.30054960636883',
1169
+ # volume_24h: '10967.87426597',
1170
+ # volume_percentage_change_24h: '141.73048325503036',
1171
+ # base_increment: '0.00000001',
1172
+ # quote_increment: '0.01',
1173
+ # quote_min_size: '1',
1174
+ # quote_max_size: '150000000',
1175
+ # base_min_size: '0.00000001',
1176
+ # base_max_size: '3400',
1177
+ # base_name: 'Bitcoin',
1178
+ # quote_name: 'US Dollar',
1179
+ # watched: False,
1180
+ # is_disabled: False,
1181
+ # new: False,
1182
+ # status: 'online',
1183
+ # cancel_only: False,
1184
+ # limit_only: False,
1185
+ # post_only: False,
1186
+ # trading_disabled: False,
1187
+ # auction_mode: False,
1188
+ # product_type: 'SPOT',
1189
+ # quote_currency_id: 'USD',
1190
+ # base_currency_id: 'BTC',
1191
+ # fcm_trading_session_details: null,
1192
+ # mid_market_price: '',
1193
+ # alias: '',
1194
+ # alias_to: ['BTC-USDC'],
1195
+ # base_display_symbol: 'BTC',
1196
+ # quote_display_symbol: 'USD',
1197
+ # view_only: False,
1198
+ # price_increment: '0.01',
1199
+ # display_name: 'BTC-USD',
1200
+ # product_venue: 'CBE'
1201
+ # },
1202
+ # ...
1203
+ # ],
1204
+ # num_products: '646'
1205
+ # }
1206
+ #
1201
1207
  if self.check_required_credentials(False):
1202
1208
  spotUnresolvedPromises.append(self.v3PrivateGetBrokerageTransactionSummary(params))
1203
1209
  #
@@ -1707,6 +1713,7 @@ class coinbase(Exchange, ImplicitAPI):
1707
1713
  :see: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates
1708
1714
  :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1709
1715
  :param dict [params]: extra parameters specific to the exchange API endpoint
1716
+ :param boolean [params.usePrivate]: use private endpoint for fetching tickers
1710
1717
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
1711
1718
  """
1712
1719
  method = self.safe_string(self.options, 'fetchTickers', 'fetchTickersV3')
@@ -1757,7 +1764,13 @@ class coinbase(Exchange, ImplicitAPI):
1757
1764
  marketType, params = self.handle_market_type_and_params('fetchTickers', self.get_market_from_symbols(symbols), params, 'default')
1758
1765
  if marketType is not None and marketType != 'default':
1759
1766
  request['product_type'] = 'FUTURE' if (marketType == 'swap') else 'SPOT'
1760
- response = self.v3PublicGetBrokerageMarketProducts(self.extend(request, params))
1767
+ response = None
1768
+ usePrivate = False
1769
+ usePrivate, params = self.handle_option_and_params(params, 'fetchTickers', 'usePrivate', False)
1770
+ if usePrivate:
1771
+ response = self.v3PrivateGetBrokerageProducts(self.extend(request, params))
1772
+ else:
1773
+ response = self.v3PublicGetBrokerageMarketProducts(self.extend(request, params))
1761
1774
  #
1762
1775
  # {
1763
1776
  # "products": [
@@ -1814,6 +1827,7 @@ class coinbase(Exchange, ImplicitAPI):
1814
1827
  :see: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-prices#get-sell-price
1815
1828
  :param str symbol: unified symbol of the market to fetch the ticker for
1816
1829
  :param dict [params]: extra parameters specific to the exchange API endpoint
1830
+ :param boolean [params.usePrivate]: whether to use the private endpoint for fetching the ticker
1817
1831
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
1818
1832
  """
1819
1833
  method = self.safe_string(self.options, 'fetchTicker', 'fetchTickerV3')
@@ -1856,7 +1870,13 @@ class coinbase(Exchange, ImplicitAPI):
1856
1870
  'product_id': market['id'],
1857
1871
  'limit': 1,
1858
1872
  }
1859
- response = self.v3PublicGetBrokerageMarketProductsProductIdTicker(self.extend(request, params))
1873
+ usePrivate = False
1874
+ usePrivate, params = self.handle_option_and_params(params, 'fetchTicker', 'usePrivate', False)
1875
+ response = None
1876
+ if usePrivate:
1877
+ response = self.v3PrivateGetBrokerageProductsProductIdTicker(self.extend(request, params))
1878
+ else:
1879
+ response = self.v3PublicGetBrokerageMarketProductsProductIdTicker(self.extend(request, params))
1860
1880
  #
1861
1881
  # {
1862
1882
  # "trades": [
@@ -3303,6 +3323,7 @@ class coinbase(Exchange, ImplicitAPI):
3303
3323
  :param dict [params]: extra parameters specific to the exchange API endpoint
3304
3324
  :param int [params.until]: the latest time in ms to fetch trades for
3305
3325
  :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
3326
+ :param boolean [params.usePrivate]: default False, when True will use the private endpoint to fetch the candles
3306
3327
  :returns int[][]: A list of candles ordered, open, high, low, close, volume
3307
3328
  """
3308
3329
  self.load_markets()
@@ -3333,7 +3354,13 @@ class coinbase(Exchange, ImplicitAPI):
3333
3354
  else:
3334
3355
  # 300 candles max
3335
3356
  request['end'] = Precise.string_add(sinceString, str(requestedDuration))
3336
- response = self.v3PublicGetBrokerageMarketProductsProductIdCandles(self.extend(request, params))
3357
+ response = None
3358
+ usePrivate = False
3359
+ usePrivate, params = self.handle_option_and_params(params, 'fetchOHLCV', 'usePrivate', False)
3360
+ if usePrivate:
3361
+ response = self.v3PrivateGetBrokerageProductsProductIdCandles(self.extend(request, params))
3362
+ else:
3363
+ response = self.v3PublicGetBrokerageMarketProductsProductIdCandles(self.extend(request, params))
3337
3364
  #
3338
3365
  # {
3339
3366
  # "candles": [
@@ -3381,6 +3408,7 @@ class coinbase(Exchange, ImplicitAPI):
3381
3408
  :param int [since]: not used by coinbase fetchTrades
3382
3409
  :param int [limit]: the maximum number of trade structures to fetch
3383
3410
  :param dict [params]: extra parameters specific to the exchange API endpoint
3411
+ :param boolean [params.usePrivate]: default False, when True will use the private endpoint to fetch the trades
3384
3412
  :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
3385
3413
  """
3386
3414
  self.load_markets()
@@ -3398,7 +3426,13 @@ class coinbase(Exchange, ImplicitAPI):
3398
3426
  request['end'] = self.number_to_string(self.parse_to_int(until / 1000))
3399
3427
  elif since is not None:
3400
3428
  raise ArgumentsRequired(self.id + ' fetchTrades() requires a `until` parameter when you use `since` argument')
3401
- response = self.v3PublicGetBrokerageMarketProductsProductIdTicker(self.extend(request, params))
3429
+ response = None
3430
+ usePrivate = False
3431
+ usePrivate, params = self.handle_option_and_params(params, 'fetchTrades', 'usePrivate', False)
3432
+ if usePrivate:
3433
+ response = self.v3PrivateGetBrokerageProductsProductIdTicker(self.extend(request, params))
3434
+ else:
3435
+ response = self.v3PublicGetBrokerageMarketProductsProductIdTicker(self.extend(request, params))
3402
3436
  #
3403
3437
  # {
3404
3438
  # "trades": [
@@ -3488,6 +3522,7 @@ class coinbase(Exchange, ImplicitAPI):
3488
3522
  :param str symbol: unified symbol of the market to fetch the order book for
3489
3523
  :param int [limit]: the maximum amount of order book entries to return
3490
3524
  :param dict [params]: extra parameters specific to the exchange API endpoint
3525
+ :param boolean [params.usePrivate]: default False, when True will use the private endpoint to fetch the order book
3491
3526
  :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
3492
3527
  """
3493
3528
  self.load_markets()
@@ -3497,7 +3532,13 @@ class coinbase(Exchange, ImplicitAPI):
3497
3532
  }
3498
3533
  if limit is not None:
3499
3534
  request['limit'] = limit
3500
- response = self.v3PublicGetBrokerageMarketProductBook(self.extend(request, params))
3535
+ response = None
3536
+ usePrivate = False
3537
+ usePrivate, params = self.handle_option_and_params(params, 'fetchOrderBook', 'usePrivate', False)
3538
+ if usePrivate:
3539
+ response = self.v3PrivateGetBrokerageProductBook(self.extend(request, params))
3540
+ else:
3541
+ response = self.v3PublicGetBrokerageMarketProductBook(self.extend(request, params))
3501
3542
  #
3502
3543
  # {
3503
3544
  # "pricebook": {
@@ -4231,6 +4272,63 @@ class coinbase(Exchange, ImplicitAPI):
4231
4272
  'takeProfitPrice': None,
4232
4273
  })
4233
4274
 
4275
+ def fetch_trading_fees(self, params={}) -> TradingFees:
4276
+ """
4277
+ :see: https://docs.cdp.coinbase.com/advanced-trade/reference/retailbrokerageapi_gettransactionsummary/
4278
+ fetch the trading fees for multiple markets
4279
+ :param dict [params]: extra parameters specific to the exchange API endpoint
4280
+ :param str [params.type]: 'spot' or 'swap'
4281
+ :returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
4282
+ """
4283
+ self.load_markets()
4284
+ type = None
4285
+ type, params = self.handle_market_type_and_params('fetchTradingFees', None, params)
4286
+ isSpot = (type == 'spot')
4287
+ productType = 'SPOT' if isSpot else 'FUTURE'
4288
+ request: dict = {
4289
+ 'product_type': productType,
4290
+ }
4291
+ response = self.v3PrivateGetBrokerageTransactionSummary(self.extend(request, params))
4292
+ #
4293
+ # {
4294
+ # total_volume: '0',
4295
+ # total_fees: '0',
4296
+ # fee_tier: {
4297
+ # pricing_tier: 'Advanced 1',
4298
+ # usd_from: '0',
4299
+ # usd_to: '1000',
4300
+ # taker_fee_rate: '0.008',
4301
+ # maker_fee_rate: '0.006',
4302
+ # aop_from: '',
4303
+ # aop_to: ''
4304
+ # },
4305
+ # margin_rate: null,
4306
+ # goods_and_services_tax: null,
4307
+ # advanced_trade_only_volume: '0',
4308
+ # advanced_trade_only_fees: '0',
4309
+ # coinbase_pro_volume: '0',
4310
+ # coinbase_pro_fees: '0',
4311
+ # total_balance: '',
4312
+ # has_promo_fee: False
4313
+ # }
4314
+ #
4315
+ data = self.safe_dict(response, 'fee_tier', {})
4316
+ taker_fee = self.safe_number(data, 'taker_fee_rate')
4317
+ marker_fee = self.safe_number(data, 'maker_fee_rate')
4318
+ result: dict = {}
4319
+ for i in range(0, len(self.symbols)):
4320
+ symbol = self.symbols[i]
4321
+ market = self.market(symbol)
4322
+ if (isSpot and market['spot']) or (not isSpot and not market['spot']):
4323
+ result[symbol] = {
4324
+ 'info': response,
4325
+ 'symbol': symbol,
4326
+ 'maker': taker_fee,
4327
+ 'taker': marker_fee,
4328
+ 'percentage': True,
4329
+ }
4330
+ return result
4331
+
4234
4332
  def create_auth_token(self, seconds: Int, method: Str = None, url: Str = None):
4235
4333
  # it may not work for v2
4236
4334
  uri = None
@@ -4335,7 +4433,7 @@ class coinbase(Exchange, ImplicitAPI):
4335
4433
  body = self.json(query)
4336
4434
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
4337
4435
 
4338
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
4436
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
4339
4437
  if response is None:
4340
4438
  return None # fallback to default error handler
4341
4439
  feedback = self.id + ' ' + body
ccxt/coinbaseexchange.py CHANGED
@@ -1715,7 +1715,7 @@ class coinbaseexchange(Exchange, ImplicitAPI):
1715
1715
  }
1716
1716
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
1717
1717
 
1718
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
1718
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1719
1719
  if (code == 400) or (code == 404):
1720
1720
  if body[0] == '{':
1721
1721
  message = self.safe_string(response, 'message')
@@ -800,7 +800,7 @@ class coinbaseinternational(Exchange, ImplicitAPI):
800
800
  params['type'] = 'DEPOSIT'
801
801
  return self.fetch_deposits_withdrawals(code, since, limit, params)
802
802
 
803
- def parse_transaction_status(self, status):
803
+ def parse_transaction_status(self, status: Str):
804
804
  statuses: dict = {
805
805
  'PROCESSED': 'ok',
806
806
  'NEW': 'pending',
@@ -957,7 +957,7 @@ class coinbaseinternational(Exchange, ImplicitAPI):
957
957
  #
958
958
  return self.parse_markets(response)
959
959
 
960
- def parse_market(self, market) -> Market:
960
+ def parse_market(self, market: dict) -> Market:
961
961
  #
962
962
  # {
963
963
  # "instrument_id":"149264164756389888",
@@ -1881,7 +1881,7 @@ class coinbaseinternational(Exchange, ImplicitAPI):
1881
1881
  }
1882
1882
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
1883
1883
 
1884
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
1884
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1885
1885
  #
1886
1886
  # {
1887
1887
  # "title":"io.javalin.http.BadRequestResponse: Order rejected(DUPLICATE_CLIENT_ORDER_ID - duplicate client order id detected)",
ccxt/coincheck.py CHANGED
@@ -684,7 +684,7 @@ class coincheck(Exchange, ImplicitAPI):
684
684
  data = self.safe_list(response, 'data', [])
685
685
  return self.parse_transactions(data, currency, since, limit, {'type': 'withdrawal'})
686
686
 
687
- def parse_transaction_status(self, status):
687
+ def parse_transaction_status(self, status: Str):
688
688
  statuses: dict = {
689
689
  # withdrawals
690
690
  'pending': 'pending',
@@ -791,7 +791,7 @@ class coincheck(Exchange, ImplicitAPI):
791
791
  }
792
792
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
793
793
 
794
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
794
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
795
795
  if response is None:
796
796
  return None
797
797
  #
ccxt/coinex.py CHANGED
@@ -4374,7 +4374,7 @@ class coinex(Exchange, ImplicitAPI):
4374
4374
  def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
4375
4375
  """
4376
4376
  make a withdrawal
4377
- :see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account015_submit_withdraw
4377
+ :see: https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/withdrawal
4378
4378
  :param str code: unified currency code
4379
4379
  :param float amount: the amount to withdraw
4380
4380
  :param str address: the address to withdraw to
@@ -4387,41 +4387,48 @@ class coinex(Exchange, ImplicitAPI):
4387
4387
  self.check_address(address)
4388
4388
  self.load_markets()
4389
4389
  currency = self.currency(code)
4390
- networkCode = self.safe_string_upper(params, 'network')
4390
+ networkCode = self.safe_string_upper_2(params, 'network', 'chain')
4391
4391
  params = self.omit(params, 'network')
4392
4392
  if tag:
4393
4393
  address = address + ':' + tag
4394
4394
  request: dict = {
4395
- 'coin_type': currency['id'],
4396
- 'coin_address': address, # must be authorized, inter-user transfer by a registered mobile phone number or an email address is supported
4397
- 'actual_amount': float(self.number_to_string(amount)), # the actual amount without fees, https://www.coinex.com/fees
4398
- 'transfer_method': 'onchain', # onchain, local
4395
+ 'ccy': currency['id'],
4396
+ 'to_address': address, # must be authorized, inter-user transfer by a registered mobile phone number or an email address is supported
4397
+ 'amount': self.number_to_string(amount), # the actual amount without fees, https://www.coinex.com/fees
4399
4398
  }
4400
4399
  if networkCode is not None:
4401
- request['smart_contract_name'] = self.network_code_to_id(networkCode)
4402
- response = self.v1PrivatePostBalanceCoinWithdraw(self.extend(request, params))
4400
+ request['chain'] = self.network_code_to_id(networkCode) # required for on-chain, not required for inter-user transfer
4401
+ response = self.v2PrivatePostAssetsWithdraw(self.extend(request, params))
4403
4402
  #
4404
4403
  # {
4405
4404
  # "code": 0,
4406
4405
  # "data": {
4407
- # "actual_amount": "1.00000000",
4408
- # "amount": "1.00000000",
4409
- # "coin_address": "1KAv3pazbTk2JnQ5xTo6fpKK7p1it2RzD4",
4410
- # "coin_type": "BCH",
4411
- # "coin_withdraw_id": 206,
4406
+ # "withdraw_id": 31193755,
4407
+ # "created_at": 1716874165038,
4408
+ # "withdraw_method": "ON_CHAIN",
4409
+ # "ccy": "USDT",
4410
+ # "amount": "17.3",
4411
+ # "actual_amount": "15",
4412
+ # "chain": "TRC20",
4413
+ # "tx_fee": "2.3",
4414
+ # "fee_asset": "USDT",
4415
+ # "fee_amount": "2.3",
4416
+ # "to_address": "TY5vq3MT6b5cQVAHWHtpGyPg1ERcQgi3UN",
4417
+ # "memo": "",
4418
+ # "tx_id": "",
4412
4419
  # "confirmations": 0,
4413
- # "create_time": 1524228297,
4414
- # "status": "audit",
4415
- # "tx_fee": "0",
4416
- # "tx_id": ""
4420
+ # "explorer_address_url": "https://tronscan.org/#/address/TY5vq3MT6b5cQVAHWHtpGyPg1ERcQgi3UN",
4421
+ # "explorer_tx_url": "https://tronscan.org/#/transaction/",
4422
+ # "remark": "",
4423
+ # "status": "audit_required"
4417
4424
  # },
4418
- # "message": "Ok"
4425
+ # "message": "OK"
4419
4426
  # }
4420
4427
  #
4421
4428
  transaction = self.safe_dict(response, 'data', {})
4422
4429
  return self.parse_transaction(transaction, currency)
4423
4430
 
4424
- def parse_transaction_status(self, status):
4431
+ def parse_transaction_status(self, status: Str):
4425
4432
  statuses: dict = {
4426
4433
  'audit': 'pending',
4427
4434
  'pass': 'pending',
@@ -4519,7 +4526,7 @@ class coinex(Exchange, ImplicitAPI):
4519
4526
  # "remark": ""
4520
4527
  # }
4521
4528
  #
4522
- # fetchWithdrawals
4529
+ # fetchWithdrawals and withdraw
4523
4530
  #
4524
4531
  # {
4525
4532
  # "withdraw_id": 259364,
@@ -5440,7 +5447,7 @@ class coinex(Exchange, ImplicitAPI):
5440
5447
  url += '?' + urlencoded
5441
5448
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
5442
5449
 
5443
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
5450
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
5444
5451
  if response is None:
5445
5452
  return None
5446
5453
  code = self.safe_string(response, 'code')
ccxt/coinlist.py CHANGED
@@ -437,7 +437,7 @@ class coinlist(Exchange, ImplicitAPI):
437
437
  markets = self.safe_value(response, 'symbols', [])
438
438
  return self.parse_markets(markets)
439
439
 
440
- def parse_market(self, market) -> Market:
440
+ def parse_market(self, market: dict) -> Market:
441
441
  id = self.safe_string(market, 'symbol')
442
442
  baseId = self.safe_string(market, 'base_currency')
443
443
  quoteId = self.safe_string(market, 'quote_currency')
@@ -2200,7 +2200,7 @@ class coinlist(Exchange, ImplicitAPI):
2200
2200
  url += '?' + query
2201
2201
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
2202
2202
 
2203
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
2203
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
2204
2204
  if response is None:
2205
2205
  # In some cases the exchange returns 202 Accepted for bad orders.
2206
2206
  # The body of that response contains order_id of the order.
ccxt/coinmate.py CHANGED
@@ -504,7 +504,7 @@ class coinmate(Exchange, ImplicitAPI):
504
504
  items = response['data']
505
505
  return self.parse_transactions(items, None, since, limit)
506
506
 
507
- def parse_transaction_status(self, status):
507
+ def parse_transaction_status(self, status: Str):
508
508
  statuses: dict = {
509
509
  'COMPLETED': 'ok',
510
510
  'WAITING': 'pending',
@@ -1031,7 +1031,7 @@ class coinmate(Exchange, ImplicitAPI):
1031
1031
  }
1032
1032
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
1033
1033
 
1034
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
1034
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1035
1035
  if response is not None:
1036
1036
  if 'error' in response:
1037
1037
  # {"error":true,"errorMessage":"Minimum Order Size 0.01 ETH","data":null}
ccxt/coinmetro.py CHANGED
@@ -373,7 +373,7 @@ class coinmetro(Exchange, ImplicitAPI):
373
373
  #
374
374
  return self.parse_markets(response)
375
375
 
376
- def parse_market(self, market) -> Market:
376
+ def parse_market(self, market: dict) -> Market:
377
377
  id = self.safe_string(market, 'pair')
378
378
  parsedMarketId = self.parse_market_id(id)
379
379
  baseId = self.safe_string(parsedMarketId, 'baseId')
@@ -1794,7 +1794,7 @@ class coinmetro(Exchange, ImplicitAPI):
1794
1794
  url = url[0:len(url) - 1]
1795
1795
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
1796
1796
 
1797
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
1797
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1798
1798
  if response is None:
1799
1799
  return None
1800
1800
  if (code != 200) and (code != 201) and (code != 202):
ccxt/coinone.py CHANGED
@@ -1109,7 +1109,7 @@ class coinone(Exchange, ImplicitAPI):
1109
1109
  }
1110
1110
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
1111
1111
 
1112
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
1112
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1113
1113
  if response is None:
1114
1114
  return None
1115
1115
  if 'result' in response:
ccxt/coinsph.py CHANGED
@@ -1731,7 +1731,7 @@ class coinsph(Exchange, ImplicitAPI):
1731
1731
  'fee': fee,
1732
1732
  }
1733
1733
 
1734
- def parse_transaction_status(self, status):
1734
+ def parse_transaction_status(self, status: Str):
1735
1735
  statuses: dict = {
1736
1736
  '0': 'pending',
1737
1737
  '1': 'ok',
@@ -1838,7 +1838,7 @@ class coinsph(Exchange, ImplicitAPI):
1838
1838
  url += '?' + query
1839
1839
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
1840
1840
 
1841
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
1841
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1842
1842
  if response is None:
1843
1843
  return None
1844
1844
  responseCode = self.safe_string(response, 'code', None)
ccxt/cryptocom.py CHANGED
@@ -2813,7 +2813,7 @@ class cryptocom(Exchange, ImplicitAPI):
2813
2813
  }
2814
2814
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
2815
2815
 
2816
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
2816
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
2817
2817
  errorCode = self.safe_string(response, 'code')
2818
2818
  if errorCode != '0':
2819
2819
  feedback = self.id + ' ' + body
ccxt/currencycom.py CHANGED
@@ -1605,7 +1605,7 @@ class currencycom(Exchange, ImplicitAPI):
1605
1605
  'fee': fee,
1606
1606
  }
1607
1607
 
1608
- def parse_transaction_status(self, status):
1608
+ def parse_transaction_status(self, status: Str):
1609
1609
  statuses: dict = {
1610
1610
  'APPROVAL': 'pending',
1611
1611
  'PROCESSED': 'ok',
@@ -1922,7 +1922,7 @@ class currencycom(Exchange, ImplicitAPI):
1922
1922
  'takeProfitPrice': None,
1923
1923
  })
1924
1924
 
1925
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
1925
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1926
1926
  if (httpCode == 418) or (httpCode == 429):
1927
1927
  raise DDoSProtection(self.id + ' ' + str(httpCode) + ' ' + reason + ' ' + body)
1928
1928
  # error response in a form: {"code": -1013, "msg": "Invalid quantity."}
ccxt/delta.py CHANGED
@@ -3360,7 +3360,7 @@ class delta(Exchange, ImplicitAPI):
3360
3360
  headers['signature'] = signature
3361
3361
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
3362
3362
 
3363
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
3363
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
3364
3364
  if response is None:
3365
3365
  return None
3366
3366
  #
ccxt/deribit.py CHANGED
@@ -2297,7 +2297,7 @@ class deribit(Exchange, ImplicitAPI):
2297
2297
  data = self.safe_list(result, 'data', [])
2298
2298
  return self.parse_transactions(data, currency, since, limit, params)
2299
2299
 
2300
- def parse_transaction_status(self, status):
2300
+ def parse_transaction_status(self, status: Str):
2301
2301
  statuses: dict = {
2302
2302
  'completed': 'ok',
2303
2303
  'unconfirmed': 'pending',
@@ -3411,7 +3411,7 @@ class deribit(Exchange, ImplicitAPI):
3411
3411
  url = self.urls['api']['rest'] + request
3412
3412
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
3413
3413
 
3414
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
3414
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
3415
3415
  if not response:
3416
3416
  return None # fallback to default error handler
3417
3417
  #