ccxt 4.3.32__py2.py3-none-any.whl → 4.3.34__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) 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/abstract/bitget.py +1 -1
  7. ccxt/ace.py +2 -2
  8. ccxt/alpaca.py +1 -1
  9. ccxt/ascendex.py +2 -2
  10. ccxt/async_support/__init__.py +1 -1
  11. ccxt/async_support/ace.py +2 -2
  12. ccxt/async_support/alpaca.py +1 -1
  13. ccxt/async_support/ascendex.py +2 -2
  14. ccxt/async_support/base/exchange.py +17 -1
  15. ccxt/async_support/bigone.py +2 -2
  16. ccxt/async_support/binance.py +4 -3
  17. ccxt/async_support/bingx.py +2 -2
  18. ccxt/async_support/bit2c.py +1 -1
  19. ccxt/async_support/bitbank.py +1 -1
  20. ccxt/async_support/bitbns.py +1 -1
  21. ccxt/async_support/bitfinex.py +2 -2
  22. ccxt/async_support/bitfinex2.py +1 -1
  23. ccxt/async_support/bitflyer.py +1 -1
  24. ccxt/async_support/bitget.py +4 -4
  25. ccxt/async_support/bithumb.py +1 -1
  26. ccxt/async_support/bitmart.py +2 -2
  27. ccxt/async_support/bitmex.py +3 -3
  28. ccxt/async_support/bitopro.py +3 -3
  29. ccxt/async_support/bitrue.py +2 -2
  30. ccxt/async_support/bitso.py +2 -2
  31. ccxt/async_support/bitstamp.py +2 -2
  32. ccxt/async_support/bitteam.py +3 -3
  33. ccxt/async_support/bitvavo.py +2 -2
  34. ccxt/async_support/blockchaincom.py +1 -1
  35. ccxt/async_support/blofin.py +3 -3
  36. ccxt/async_support/btcalpha.py +3 -3
  37. ccxt/async_support/btcbox.py +1 -1
  38. ccxt/async_support/btcmarkets.py +3 -3
  39. ccxt/async_support/btcturk.py +1 -1
  40. ccxt/async_support/bybit.py +2 -2
  41. ccxt/async_support/cex.py +1 -1
  42. ccxt/async_support/coinbase.py +96 -55
  43. ccxt/async_support/coinbaseexchange.py +1 -1
  44. ccxt/async_support/coinbaseinternational.py +3 -3
  45. ccxt/async_support/coincheck.py +2 -2
  46. ccxt/async_support/coinex.py +2 -2
  47. ccxt/async_support/coinlist.py +2 -2
  48. ccxt/async_support/coinmate.py +2 -2
  49. ccxt/async_support/coinmetro.py +2 -2
  50. ccxt/async_support/coinone.py +1 -1
  51. ccxt/async_support/coinsph.py +2 -2
  52. ccxt/async_support/cryptocom.py +1 -1
  53. ccxt/async_support/currencycom.py +2 -2
  54. ccxt/async_support/delta.py +1 -1
  55. ccxt/async_support/deribit.py +2 -2
  56. ccxt/async_support/digifinex.py +2 -2
  57. ccxt/async_support/exmo.py +2 -2
  58. ccxt/async_support/gate.py +2 -2
  59. ccxt/async_support/gemini.py +2 -2
  60. ccxt/async_support/hitbtc.py +2 -2
  61. ccxt/async_support/hollaex.py +1 -1
  62. ccxt/async_support/htx.py +2 -2
  63. ccxt/async_support/huobijp.py +2 -2
  64. ccxt/async_support/hyperliquid.py +2 -2
  65. ccxt/async_support/idex.py +2 -2
  66. ccxt/async_support/indodax.py +2 -2
  67. ccxt/async_support/kraken.py +2 -2
  68. ccxt/async_support/krakenfutures.py +1 -1
  69. ccxt/async_support/kucoin.py +2 -2
  70. ccxt/async_support/kuna.py +2 -2
  71. ccxt/async_support/latoken.py +2 -2
  72. ccxt/async_support/lbank.py +1 -1
  73. ccxt/async_support/luno.py +1 -1
  74. ccxt/async_support/lykke.py +1 -1
  75. ccxt/async_support/mercado.py +1 -1
  76. ccxt/async_support/mexc.py +1 -1
  77. ccxt/async_support/ndax.py +2 -2
  78. ccxt/async_support/novadax.py +3 -3
  79. ccxt/async_support/oceanex.py +2 -2
  80. ccxt/async_support/okcoin.py +3 -3
  81. ccxt/async_support/okx.py +3 -3
  82. ccxt/async_support/onetrading.py +2 -2
  83. ccxt/async_support/p2b.py +2 -2
  84. ccxt/async_support/paymium.py +1 -1
  85. ccxt/async_support/phemex.py +4 -4
  86. ccxt/async_support/poloniex.py +3 -3
  87. ccxt/async_support/poloniexfutures.py +2 -2
  88. ccxt/async_support/probit.py +3 -3
  89. ccxt/async_support/timex.py +2 -2
  90. ccxt/async_support/tokocrypto.py +1 -1
  91. ccxt/async_support/tradeogre.py +1 -1
  92. ccxt/async_support/upbit.py +3 -3
  93. ccxt/async_support/wavesexchange.py +1 -1
  94. ccxt/async_support/wazirx.py +3 -3
  95. ccxt/async_support/whitebit.py +3 -3
  96. ccxt/async_support/woo.py +3 -3
  97. ccxt/async_support/woofipro.py +3 -3
  98. ccxt/async_support/yobit.py +1 -1
  99. ccxt/async_support/zaif.py +2 -2
  100. ccxt/async_support/zonda.py +1 -1
  101. ccxt/base/exchange.py +25 -3
  102. ccxt/base/types.py +0 -1
  103. ccxt/bigone.py +2 -2
  104. ccxt/binance.py +4 -3
  105. ccxt/bingx.py +2 -2
  106. ccxt/bit2c.py +1 -1
  107. ccxt/bitbank.py +1 -1
  108. ccxt/bitbns.py +1 -1
  109. ccxt/bitfinex.py +2 -2
  110. ccxt/bitfinex2.py +1 -1
  111. ccxt/bitflyer.py +1 -1
  112. ccxt/bitget.py +4 -4
  113. ccxt/bithumb.py +1 -1
  114. ccxt/bitmart.py +2 -2
  115. ccxt/bitmex.py +3 -3
  116. ccxt/bitopro.py +3 -3
  117. ccxt/bitrue.py +2 -2
  118. ccxt/bitso.py +2 -2
  119. ccxt/bitstamp.py +2 -2
  120. ccxt/bitteam.py +3 -3
  121. ccxt/bitvavo.py +2 -2
  122. ccxt/blockchaincom.py +1 -1
  123. ccxt/blofin.py +3 -3
  124. ccxt/btcalpha.py +3 -3
  125. ccxt/btcbox.py +1 -1
  126. ccxt/btcmarkets.py +3 -3
  127. ccxt/btcturk.py +1 -1
  128. ccxt/bybit.py +2 -2
  129. ccxt/cex.py +1 -1
  130. ccxt/coinbase.py +96 -55
  131. ccxt/coinbaseexchange.py +1 -1
  132. ccxt/coinbaseinternational.py +3 -3
  133. ccxt/coincheck.py +2 -2
  134. ccxt/coinex.py +2 -2
  135. ccxt/coinlist.py +2 -2
  136. ccxt/coinmate.py +2 -2
  137. ccxt/coinmetro.py +2 -2
  138. ccxt/coinone.py +1 -1
  139. ccxt/coinsph.py +2 -2
  140. ccxt/cryptocom.py +1 -1
  141. ccxt/currencycom.py +2 -2
  142. ccxt/delta.py +1 -1
  143. ccxt/deribit.py +2 -2
  144. ccxt/digifinex.py +2 -2
  145. ccxt/exmo.py +2 -2
  146. ccxt/gate.py +2 -2
  147. ccxt/gemini.py +2 -2
  148. ccxt/hitbtc.py +2 -2
  149. ccxt/hollaex.py +1 -1
  150. ccxt/htx.py +2 -2
  151. ccxt/huobijp.py +2 -2
  152. ccxt/hyperliquid.py +2 -2
  153. ccxt/idex.py +2 -2
  154. ccxt/indodax.py +2 -2
  155. ccxt/kraken.py +2 -2
  156. ccxt/krakenfutures.py +1 -1
  157. ccxt/kucoin.py +2 -2
  158. ccxt/kuna.py +2 -2
  159. ccxt/latoken.py +2 -2
  160. ccxt/lbank.py +1 -1
  161. ccxt/luno.py +1 -1
  162. ccxt/lykke.py +1 -1
  163. ccxt/mercado.py +1 -1
  164. ccxt/mexc.py +1 -1
  165. ccxt/ndax.py +2 -2
  166. ccxt/novadax.py +3 -3
  167. ccxt/oceanex.py +2 -2
  168. ccxt/okcoin.py +3 -3
  169. ccxt/okx.py +3 -3
  170. ccxt/onetrading.py +2 -2
  171. ccxt/p2b.py +2 -2
  172. ccxt/paymium.py +1 -1
  173. ccxt/phemex.py +4 -4
  174. ccxt/poloniex.py +3 -3
  175. ccxt/poloniexfutures.py +2 -2
  176. ccxt/pro/__init__.py +1 -1
  177. ccxt/pro/binance.py +331 -2
  178. ccxt/pro/bitmex.py +98 -1
  179. ccxt/pro/bybit.py +82 -1
  180. ccxt/pro/gate.py +173 -1
  181. ccxt/pro/kucoinfutures.py +4 -0
  182. ccxt/pro/okx.py +245 -2
  183. ccxt/probit.py +3 -3
  184. ccxt/test/base/__init__.py +1 -0
  185. ccxt/test/base/test_liquidation.py +50 -0
  186. ccxt/timex.py +2 -2
  187. ccxt/tokocrypto.py +1 -1
  188. ccxt/tradeogre.py +1 -1
  189. ccxt/upbit.py +3 -3
  190. ccxt/wavesexchange.py +1 -1
  191. ccxt/wazirx.py +3 -3
  192. ccxt/whitebit.py +3 -3
  193. ccxt/woo.py +3 -3
  194. ccxt/woofipro.py +3 -3
  195. ccxt/yobit.py +1 -1
  196. ccxt/zaif.py +2 -2
  197. ccxt/zonda.py +1 -1
  198. {ccxt-4.3.32.dist-info → ccxt-4.3.34.dist-info}/METADATA +4 -4
  199. {ccxt-4.3.32.dist-info → ccxt-4.3.34.dist-info}/RECORD +201 -200
  200. {ccxt-4.3.32.dist-info → ccxt-4.3.34.dist-info}/WHEEL +0 -0
  201. {ccxt-4.3.32.dist-info → ccxt-4.3.34.dist-info}/top_level.txt +0 -0
@@ -186,7 +186,7 @@ class btcalpha(Exchange, ImplicitAPI):
186
186
  #
187
187
  return self.parse_markets(response)
188
188
 
189
- def parse_market(self, market) -> Market:
189
+ def parse_market(self, market: dict) -> Market:
190
190
  id = self.safe_string(market, 'name')
191
191
  baseId = self.safe_string(market, 'currency1')
192
192
  quoteId = self.safe_string(market, 'currency2')
@@ -544,7 +544,7 @@ class btcalpha(Exchange, ImplicitAPI):
544
544
  'updated': None,
545
545
  }
546
546
 
547
- def parse_transaction_status(self, status):
547
+ def parse_transaction_status(self, status: Str):
548
548
  statuses: dict = {
549
549
  '10': 'pending', # New
550
550
  '20': 'pending', # Verified, waiting for approving
@@ -866,7 +866,7 @@ class btcalpha(Exchange, ImplicitAPI):
866
866
  headers['X-NONCE'] = str(self.nonce())
867
867
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
868
868
 
869
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
869
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
870
870
  if response is None:
871
871
  return None # fallback to default error handler
872
872
  #
@@ -519,7 +519,7 @@ class btcbox(Exchange, ImplicitAPI):
519
519
  }
520
520
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
521
521
 
522
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
522
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
523
523
  if response is None:
524
524
  return None # resort to defaultErrorHandler
525
525
  # typical error response: {"result":false,"code":"401"}
@@ -237,7 +237,7 @@ class btcmarkets(Exchange, ImplicitAPI):
237
237
  """
238
238
  return await self.fetch_transactions_with_method('privateGetWithdrawals', code, since, limit, params)
239
239
 
240
- def parse_transaction_status(self, status):
240
+ def parse_transaction_status(self, status: Str):
241
241
  statuses: dict = {
242
242
  'Accepted': 'pending',
243
243
  'Pending Authorization': 'pending',
@@ -376,7 +376,7 @@ class btcmarkets(Exchange, ImplicitAPI):
376
376
  #
377
377
  return self.parse_markets(response)
378
378
 
379
- def parse_market(self, market) -> Market:
379
+ def parse_market(self, market: dict) -> Market:
380
380
  baseId = self.safe_string(market, 'baseAssetName')
381
381
  quoteId = self.safe_string(market, 'quoteAssetName')
382
382
  id = self.safe_string(market, 'marketId')
@@ -1170,7 +1170,7 @@ class btcmarkets(Exchange, ImplicitAPI):
1170
1170
  url = self.urls['api'][api] + request
1171
1171
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
1172
1172
 
1173
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
1173
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1174
1174
  if response is None:
1175
1175
  return None # fallback to default error handler
1176
1176
  if 'success' in response:
@@ -891,7 +891,7 @@ class btcturk(Exchange, ImplicitAPI):
891
891
  }
892
892
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
893
893
 
894
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
894
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
895
895
  errorCode = self.safe_string(response, 'code', '0')
896
896
  message = self.safe_string(response, 'message')
897
897
  output = body if (message is None) else message
@@ -5284,7 +5284,7 @@ class bybit(Exchange, ImplicitAPI):
5284
5284
  data = self.add_pagination_cursor_to_result(response)
5285
5285
  return self.parse_transactions(data, currency, since, limit)
5286
5286
 
5287
- def parse_transaction_status(self, status):
5287
+ def parse_transaction_status(self, status: Str):
5288
5288
  statuses: dict = {
5289
5289
  # v3 deposit status
5290
5290
  '0': 'unknown',
@@ -8118,7 +8118,7 @@ class bybit(Exchange, ImplicitAPI):
8118
8118
  headers['Referer'] = brokerId
8119
8119
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
8120
8120
 
8121
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
8121
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
8122
8122
  if not response:
8123
8123
  return None # fallback to default error handler
8124
8124
  #
ccxt/async_support/cex.py CHANGED
@@ -1585,7 +1585,7 @@ class cex(Exchange, ImplicitAPI):
1585
1585
  }
1586
1586
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
1587
1587
 
1588
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
1588
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1589
1589
  if isinstance(response, list):
1590
1590
  return response # public endpoints may return []-arrays
1591
1591
  if body == 'true':
@@ -353,6 +353,7 @@ class coinbase(Exchange, ImplicitAPI):
353
353
  'CGLD': 'CELO',
354
354
  },
355
355
  'options': {
356
+ 'usePrivate': False,
356
357
  'brokerId': 'ccxt',
357
358
  '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'],
358
359
  'fetchCurrencies': {
@@ -775,7 +776,7 @@ class coinbase(Exchange, ImplicitAPI):
775
776
  # fiat only, for crypto transactions use fetchLedger
776
777
  return await self.fetch_transactions_with_method('v2PrivateGetAccountsAccountIdDeposits', code, since, limit, params)
777
778
 
778
- def parse_transaction_status(self, status):
779
+ def parse_transaction_status(self, status: Str):
779
780
  statuses: dict = {
780
781
  'created': 'pending',
781
782
  'completed': 'ok',
@@ -1074,6 +1075,7 @@ class coinbase(Exchange, ImplicitAPI):
1074
1075
  :see: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates
1075
1076
  retrieves data on all markets for coinbase
1076
1077
  :param dict [params]: extra parameters specific to the exchange API endpoint
1078
+ :param boolean [params.usePrivate]: use private endpoint for fetching markets
1077
1079
  :returns dict[]: an array of objects representing market data
1078
1080
  """
1079
1081
  method = self.safe_string(self.options, 'fetchMarkets', 'fetchMarketsV3')
@@ -1151,54 +1153,58 @@ class coinbase(Exchange, ImplicitAPI):
1151
1153
  return result
1152
1154
 
1153
1155
  async def fetch_markets_v3(self, params={}):
1154
- spotUnresolvedPromises = [
1155
- self.v3PublicGetBrokerageMarketProducts(params),
1156
- #
1157
- # {
1158
- # products: [
1159
- # {
1160
- # product_id: 'BTC-USD',
1161
- # price: '67060',
1162
- # price_percentage_change_24h: '3.30054960636883',
1163
- # volume_24h: '10967.87426597',
1164
- # volume_percentage_change_24h: '141.73048325503036',
1165
- # base_increment: '0.00000001',
1166
- # quote_increment: '0.01',
1167
- # quote_min_size: '1',
1168
- # quote_max_size: '150000000',
1169
- # base_min_size: '0.00000001',
1170
- # base_max_size: '3400',
1171
- # base_name: 'Bitcoin',
1172
- # quote_name: 'US Dollar',
1173
- # watched: False,
1174
- # is_disabled: False,
1175
- # new: False,
1176
- # status: 'online',
1177
- # cancel_only: False,
1178
- # limit_only: False,
1179
- # post_only: False,
1180
- # trading_disabled: False,
1181
- # auction_mode: False,
1182
- # product_type: 'SPOT',
1183
- # quote_currency_id: 'USD',
1184
- # base_currency_id: 'BTC',
1185
- # fcm_trading_session_details: null,
1186
- # mid_market_price: '',
1187
- # alias: '',
1188
- # alias_to: ['BTC-USDC'],
1189
- # base_display_symbol: 'BTC',
1190
- # quote_display_symbol: 'USD',
1191
- # view_only: False,
1192
- # price_increment: '0.01',
1193
- # display_name: 'BTC-USD',
1194
- # product_venue: 'CBE'
1195
- # },
1196
- # ...
1197
- # ],
1198
- # num_products: '646'
1199
- # }
1200
- #
1201
- ]
1156
+ usePrivate = False
1157
+ usePrivate, params = self.handle_option_and_params(params, 'fetchMarkets', 'usePrivate', False)
1158
+ spotUnresolvedPromises = []
1159
+ if usePrivate:
1160
+ spotUnresolvedPromises.append(self.v3PrivateGetBrokerageProducts(params))
1161
+ else:
1162
+ spotUnresolvedPromises.append(self.v3PublicGetBrokerageMarketProducts(params))
1163
+ #
1164
+ # {
1165
+ # products: [
1166
+ # {
1167
+ # product_id: 'BTC-USD',
1168
+ # price: '67060',
1169
+ # price_percentage_change_24h: '3.30054960636883',
1170
+ # volume_24h: '10967.87426597',
1171
+ # volume_percentage_change_24h: '141.73048325503036',
1172
+ # base_increment: '0.00000001',
1173
+ # quote_increment: '0.01',
1174
+ # quote_min_size: '1',
1175
+ # quote_max_size: '150000000',
1176
+ # base_min_size: '0.00000001',
1177
+ # base_max_size: '3400',
1178
+ # base_name: 'Bitcoin',
1179
+ # quote_name: 'US Dollar',
1180
+ # watched: False,
1181
+ # is_disabled: False,
1182
+ # new: False,
1183
+ # status: 'online',
1184
+ # cancel_only: False,
1185
+ # limit_only: False,
1186
+ # post_only: False,
1187
+ # trading_disabled: False,
1188
+ # auction_mode: False,
1189
+ # product_type: 'SPOT',
1190
+ # quote_currency_id: 'USD',
1191
+ # base_currency_id: 'BTC',
1192
+ # fcm_trading_session_details: null,
1193
+ # mid_market_price: '',
1194
+ # alias: '',
1195
+ # alias_to: ['BTC-USDC'],
1196
+ # base_display_symbol: 'BTC',
1197
+ # quote_display_symbol: 'USD',
1198
+ # view_only: False,
1199
+ # price_increment: '0.01',
1200
+ # display_name: 'BTC-USD',
1201
+ # product_venue: 'CBE'
1202
+ # },
1203
+ # ...
1204
+ # ],
1205
+ # num_products: '646'
1206
+ # }
1207
+ #
1202
1208
  if self.check_required_credentials(False):
1203
1209
  spotUnresolvedPromises.append(self.v3PrivateGetBrokerageTransactionSummary(params))
1204
1210
  #
@@ -1708,6 +1714,7 @@ class coinbase(Exchange, ImplicitAPI):
1708
1714
  :see: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates
1709
1715
  :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1710
1716
  :param dict [params]: extra parameters specific to the exchange API endpoint
1717
+ :param boolean [params.usePrivate]: use private endpoint for fetching tickers
1711
1718
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
1712
1719
  """
1713
1720
  method = self.safe_string(self.options, 'fetchTickers', 'fetchTickersV3')
@@ -1758,7 +1765,13 @@ class coinbase(Exchange, ImplicitAPI):
1758
1765
  marketType, params = self.handle_market_type_and_params('fetchTickers', self.get_market_from_symbols(symbols), params, 'default')
1759
1766
  if marketType is not None and marketType != 'default':
1760
1767
  request['product_type'] = 'FUTURE' if (marketType == 'swap') else 'SPOT'
1761
- response = await self.v3PublicGetBrokerageMarketProducts(self.extend(request, params))
1768
+ response = None
1769
+ usePrivate = False
1770
+ usePrivate, params = self.handle_option_and_params(params, 'fetchTickers', 'usePrivate', False)
1771
+ if usePrivate:
1772
+ response = await self.v3PrivateGetBrokerageProducts(self.extend(request, params))
1773
+ else:
1774
+ response = await self.v3PublicGetBrokerageMarketProducts(self.extend(request, params))
1762
1775
  #
1763
1776
  # {
1764
1777
  # "products": [
@@ -1815,6 +1828,7 @@ class coinbase(Exchange, ImplicitAPI):
1815
1828
  :see: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-prices#get-sell-price
1816
1829
  :param str symbol: unified symbol of the market to fetch the ticker for
1817
1830
  :param dict [params]: extra parameters specific to the exchange API endpoint
1831
+ :param boolean [params.usePrivate]: whether to use the private endpoint for fetching the ticker
1818
1832
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
1819
1833
  """
1820
1834
  method = self.safe_string(self.options, 'fetchTicker', 'fetchTickerV3')
@@ -1857,7 +1871,13 @@ class coinbase(Exchange, ImplicitAPI):
1857
1871
  'product_id': market['id'],
1858
1872
  'limit': 1,
1859
1873
  }
1860
- response = await self.v3PublicGetBrokerageMarketProductsProductIdTicker(self.extend(request, params))
1874
+ usePrivate = False
1875
+ usePrivate, params = self.handle_option_and_params(params, 'fetchTicker', 'usePrivate', False)
1876
+ response = None
1877
+ if usePrivate:
1878
+ response = await self.v3PrivateGetBrokerageProductsProductIdTicker(self.extend(request, params))
1879
+ else:
1880
+ response = await self.v3PublicGetBrokerageMarketProductsProductIdTicker(self.extend(request, params))
1861
1881
  #
1862
1882
  # {
1863
1883
  # "trades": [
@@ -3304,6 +3324,7 @@ class coinbase(Exchange, ImplicitAPI):
3304
3324
  :param dict [params]: extra parameters specific to the exchange API endpoint
3305
3325
  :param int [params.until]: the latest time in ms to fetch trades for
3306
3326
  :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)
3327
+ :param boolean [params.usePrivate]: default False, when True will use the private endpoint to fetch the candles
3307
3328
  :returns int[][]: A list of candles ordered, open, high, low, close, volume
3308
3329
  """
3309
3330
  await self.load_markets()
@@ -3334,7 +3355,13 @@ class coinbase(Exchange, ImplicitAPI):
3334
3355
  else:
3335
3356
  # 300 candles max
3336
3357
  request['end'] = Precise.string_add(sinceString, str(requestedDuration))
3337
- response = await self.v3PublicGetBrokerageMarketProductsProductIdCandles(self.extend(request, params))
3358
+ response = None
3359
+ usePrivate = False
3360
+ usePrivate, params = self.handle_option_and_params(params, 'fetchOHLCV', 'usePrivate', False)
3361
+ if usePrivate:
3362
+ response = await self.v3PrivateGetBrokerageProductsProductIdCandles(self.extend(request, params))
3363
+ else:
3364
+ response = await self.v3PublicGetBrokerageMarketProductsProductIdCandles(self.extend(request, params))
3338
3365
  #
3339
3366
  # {
3340
3367
  # "candles": [
@@ -3382,6 +3409,7 @@ class coinbase(Exchange, ImplicitAPI):
3382
3409
  :param int [since]: not used by coinbase fetchTrades
3383
3410
  :param int [limit]: the maximum number of trade structures to fetch
3384
3411
  :param dict [params]: extra parameters specific to the exchange API endpoint
3412
+ :param boolean [params.usePrivate]: default False, when True will use the private endpoint to fetch the trades
3385
3413
  :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
3386
3414
  """
3387
3415
  await self.load_markets()
@@ -3399,7 +3427,13 @@ class coinbase(Exchange, ImplicitAPI):
3399
3427
  request['end'] = self.number_to_string(self.parse_to_int(until / 1000))
3400
3428
  elif since is not None:
3401
3429
  raise ArgumentsRequired(self.id + ' fetchTrades() requires a `until` parameter when you use `since` argument')
3402
- response = await self.v3PublicGetBrokerageMarketProductsProductIdTicker(self.extend(request, params))
3430
+ response = None
3431
+ usePrivate = False
3432
+ usePrivate, params = self.handle_option_and_params(params, 'fetchTrades', 'usePrivate', False)
3433
+ if usePrivate:
3434
+ response = await self.v3PrivateGetBrokerageProductsProductIdTicker(self.extend(request, params))
3435
+ else:
3436
+ response = await self.v3PublicGetBrokerageMarketProductsProductIdTicker(self.extend(request, params))
3403
3437
  #
3404
3438
  # {
3405
3439
  # "trades": [
@@ -3489,6 +3523,7 @@ class coinbase(Exchange, ImplicitAPI):
3489
3523
  :param str symbol: unified symbol of the market to fetch the order book for
3490
3524
  :param int [limit]: the maximum amount of order book entries to return
3491
3525
  :param dict [params]: extra parameters specific to the exchange API endpoint
3526
+ :param boolean [params.usePrivate]: default False, when True will use the private endpoint to fetch the order book
3492
3527
  :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
3493
3528
  """
3494
3529
  await self.load_markets()
@@ -3498,7 +3533,13 @@ class coinbase(Exchange, ImplicitAPI):
3498
3533
  }
3499
3534
  if limit is not None:
3500
3535
  request['limit'] = limit
3501
- response = await self.v3PublicGetBrokerageMarketProductBook(self.extend(request, params))
3536
+ response = None
3537
+ usePrivate = False
3538
+ usePrivate, params = self.handle_option_and_params(params, 'fetchOrderBook', 'usePrivate', False)
3539
+ if usePrivate:
3540
+ response = await self.v3PrivateGetBrokerageProductBook(self.extend(request, params))
3541
+ else:
3542
+ response = await self.v3PublicGetBrokerageMarketProductBook(self.extend(request, params))
3502
3543
  #
3503
3544
  # {
3504
3545
  # "pricebook": {
@@ -4336,7 +4377,7 @@ class coinbase(Exchange, ImplicitAPI):
4336
4377
  body = self.json(query)
4337
4378
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
4338
4379
 
4339
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
4380
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
4340
4381
  if response is None:
4341
4382
  return None # fallback to default error handler
4342
4383
  feedback = self.id + ' ' + body
@@ -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 await 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)",
@@ -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
  #
@@ -4422,7 +4422,7 @@ class coinex(Exchange, ImplicitAPI):
4422
4422
  transaction = self.safe_dict(response, 'data', {})
4423
4423
  return self.parse_transaction(transaction, currency)
4424
4424
 
4425
- def parse_transaction_status(self, status):
4425
+ def parse_transaction_status(self, status: Str):
4426
4426
  statuses: dict = {
4427
4427
  'audit': 'pending',
4428
4428
  'pass': 'pending',
@@ -5441,7 +5441,7 @@ class coinex(Exchange, ImplicitAPI):
5441
5441
  url += '?' + urlencoded
5442
5442
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
5443
5443
 
5444
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
5444
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
5445
5445
  if response is None:
5446
5446
  return None
5447
5447
  code = self.safe_string(response, 'code')
@@ -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.
@@ -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}
@@ -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):
@@ -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:
@@ -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)
@@ -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
@@ -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."}
@@ -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
  #
@@ -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
  #
@@ -2606,7 +2606,7 @@ class digifinex(Exchange, ImplicitAPI):
2606
2606
  """
2607
2607
  return await self.fetch_transactions_by_type('withdrawal', code, since, limit, params)
2608
2608
 
2609
- def parse_transaction_status(self, status):
2609
+ def parse_transaction_status(self, status: Str):
2610
2610
  # deposit state includes: 1(in deposit), 2(to be confirmed), 3(successfully deposited), 4(stopped)
2611
2611
  # withdrawal state includes: 1(application in progress), 2(to be confirmed), 3(completed), 4(rejected)
2612
2612
  statuses: dict = {
@@ -3946,7 +3946,7 @@ class digifinex(Exchange, ImplicitAPI):
3946
3946
  url += '?' + urlencoded
3947
3947
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
3948
3948
 
3949
- def handle_errors(self, statusCode, statusText, url, method, responseHeaders, responseBody, response, requestHeaders, requestBody):
3949
+ def handle_errors(self, statusCode: int, statusText: str, url: str, method: str, responseHeaders: dict, responseBody, response, requestHeaders, requestBody):
3950
3950
  if not response:
3951
3951
  return None # fall back to default error handler
3952
3952
  code = self.safe_string(response, 'code')
@@ -2015,7 +2015,7 @@ class exmo(Exchange, ImplicitAPI):
2015
2015
  response = await self.privatePostWithdrawCrypt(self.extend(request, params))
2016
2016
  return self.parse_transaction(response, currency)
2017
2017
 
2018
- def parse_transaction_status(self, status):
2018
+ def parse_transaction_status(self, status: Str):
2019
2019
  statuses: dict = {
2020
2020
  'transferred': 'ok',
2021
2021
  'paid': 'ok',
@@ -2419,7 +2419,7 @@ class exmo(Exchange, ImplicitAPI):
2419
2419
  def nonce(self):
2420
2420
  return self.milliseconds()
2421
2421
 
2422
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
2422
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
2423
2423
  if response is None:
2424
2424
  return None # fallback to default error handler
2425
2425
  if ('error' in response) and not ('result' in response):