ccxt 4.3.33__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 (200) 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 +1 -1
  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 +1 -1
  12. ccxt/async_support/ascendex.py +2 -2
  13. ccxt/async_support/base/exchange.py +17 -1
  14. ccxt/async_support/bigone.py +2 -2
  15. ccxt/async_support/binance.py +4 -3
  16. ccxt/async_support/bingx.py +2 -2
  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 +3 -3
  24. ccxt/async_support/bithumb.py +1 -1
  25. ccxt/async_support/bitmart.py +2 -2
  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 +3 -3
  38. ccxt/async_support/btcturk.py +1 -1
  39. ccxt/async_support/bybit.py +2 -2
  40. ccxt/async_support/cex.py +1 -1
  41. ccxt/async_support/coinbase.py +96 -55
  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 +2 -2
  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 +2 -2
  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 +2 -2
  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 +25 -3
  101. ccxt/base/types.py +0 -1
  102. ccxt/bigone.py +2 -2
  103. ccxt/binance.py +4 -3
  104. ccxt/bingx.py +2 -2
  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 +3 -3
  112. ccxt/bithumb.py +1 -1
  113. ccxt/bitmart.py +2 -2
  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 +3 -3
  126. ccxt/btcturk.py +1 -1
  127. ccxt/bybit.py +2 -2
  128. ccxt/cex.py +1 -1
  129. ccxt/coinbase.py +96 -55
  130. ccxt/coinbaseexchange.py +1 -1
  131. ccxt/coinbaseinternational.py +3 -3
  132. ccxt/coincheck.py +2 -2
  133. ccxt/coinex.py +2 -2
  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 +2 -2
  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 +2 -2
  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/bitmex.py +98 -1
  178. ccxt/pro/bybit.py +82 -1
  179. ccxt/pro/gate.py +173 -1
  180. ccxt/pro/kucoinfutures.py +4 -0
  181. ccxt/pro/okx.py +245 -2
  182. ccxt/probit.py +3 -3
  183. ccxt/test/base/__init__.py +1 -0
  184. ccxt/test/base/test_liquidation.py +50 -0
  185. ccxt/timex.py +2 -2
  186. ccxt/tokocrypto.py +1 -1
  187. ccxt/tradeogre.py +1 -1
  188. ccxt/upbit.py +3 -3
  189. ccxt/wavesexchange.py +1 -1
  190. ccxt/wazirx.py +3 -3
  191. ccxt/whitebit.py +3 -3
  192. ccxt/woo.py +3 -3
  193. ccxt/woofipro.py +3 -3
  194. ccxt/yobit.py +1 -1
  195. ccxt/zaif.py +2 -2
  196. ccxt/zonda.py +1 -1
  197. {ccxt-4.3.33.dist-info → ccxt-4.3.34.dist-info}/METADATA +4 -4
  198. {ccxt-4.3.33.dist-info → ccxt-4.3.34.dist-info}/RECORD +200 -199
  199. {ccxt-4.3.33.dist-info → ccxt-4.3.34.dist-info}/WHEEL +0 -0
  200. {ccxt-4.3.33.dist-info → ccxt-4.3.34.dist-info}/top_level.txt +0 -0
ccxt/btcalpha.py CHANGED
@@ -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
  #
ccxt/btcbox.py CHANGED
@@ -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"}
ccxt/btcmarkets.py CHANGED
@@ -237,7 +237,7 @@ class btcmarkets(Exchange, ImplicitAPI):
237
237
  """
238
238
  return 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:
ccxt/btcturk.py CHANGED
@@ -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
ccxt/bybit.py CHANGED
@@ -5283,7 +5283,7 @@ class bybit(Exchange, ImplicitAPI):
5283
5283
  data = self.add_pagination_cursor_to_result(response)
5284
5284
  return self.parse_transactions(data, currency, since, limit)
5285
5285
 
5286
- def parse_transaction_status(self, status):
5286
+ def parse_transaction_status(self, status: Str):
5287
5287
  statuses: dict = {
5288
5288
  # v3 deposit status
5289
5289
  '0': 'unknown',
@@ -8117,7 +8117,7 @@ class bybit(Exchange, ImplicitAPI):
8117
8117
  headers['Referer'] = brokerId
8118
8118
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
8119
8119
 
8120
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
8120
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
8121
8121
  if not response:
8122
8122
  return None # fallback to default error handler
8123
8123
  #
ccxt/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':
ccxt/coinbase.py CHANGED
@@ -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": {
@@ -4335,7 +4376,7 @@ class coinbase(Exchange, ImplicitAPI):
4335
4376
  body = self.json(query)
4336
4377
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
4337
4378
 
4338
- def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
4379
+ def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
4339
4380
  if response is None:
4340
4381
  return None # fallback to default error handler
4341
4382
  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
@@ -4421,7 +4421,7 @@ class coinex(Exchange, ImplicitAPI):
4421
4421
  transaction = self.safe_dict(response, 'data', {})
4422
4422
  return self.parse_transaction(transaction, currency)
4423
4423
 
4424
- def parse_transaction_status(self, status):
4424
+ def parse_transaction_status(self, status: Str):
4425
4425
  statuses: dict = {
4426
4426
  'audit': 'pending',
4427
4427
  'pass': 'pending',
@@ -5440,7 +5440,7 @@ class coinex(Exchange, ImplicitAPI):
5440
5440
  url += '?' + urlencoded
5441
5441
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
5442
5442
 
5443
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
5443
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
5444
5444
  if response is None:
5445
5445
  return None
5446
5446
  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
  #
ccxt/digifinex.py CHANGED
@@ -2605,7 +2605,7 @@ class digifinex(Exchange, ImplicitAPI):
2605
2605
  """
2606
2606
  return self.fetch_transactions_by_type('withdrawal', code, since, limit, params)
2607
2607
 
2608
- def parse_transaction_status(self, status):
2608
+ def parse_transaction_status(self, status: Str):
2609
2609
  # deposit state includes: 1(in deposit), 2(to be confirmed), 3(successfully deposited), 4(stopped)
2610
2610
  # withdrawal state includes: 1(application in progress), 2(to be confirmed), 3(completed), 4(rejected)
2611
2611
  statuses: dict = {
@@ -3945,7 +3945,7 @@ class digifinex(Exchange, ImplicitAPI):
3945
3945
  url += '?' + urlencoded
3946
3946
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
3947
3947
 
3948
- def handle_errors(self, statusCode, statusText, url, method, responseHeaders, responseBody, response, requestHeaders, requestBody):
3948
+ def handle_errors(self, statusCode: int, statusText: str, url: str, method: str, responseHeaders: dict, responseBody, response, requestHeaders, requestBody):
3949
3949
  if not response:
3950
3950
  return None # fall back to default error handler
3951
3951
  code = self.safe_string(response, 'code')
ccxt/exmo.py CHANGED
@@ -2015,7 +2015,7 @@ class exmo(Exchange, ImplicitAPI):
2015
2015
  response = 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):