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.
- ccxt/__init__.py +1 -1
- ccxt/abstract/binance.py +1 -0
- ccxt/abstract/binancecoinm.py +1 -0
- ccxt/abstract/binanceus.py +1 -0
- ccxt/abstract/binanceusdm.py +1 -0
- ccxt/ace.py +2 -2
- ccxt/alpaca.py +2 -2
- ccxt/ascendex.py +2 -2
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ace.py +2 -2
- ccxt/async_support/alpaca.py +2 -2
- ccxt/async_support/ascendex.py +2 -2
- ccxt/async_support/base/exchange.py +56 -40
- ccxt/async_support/bigone.py +2 -2
- ccxt/async_support/binance.py +6 -5
- ccxt/async_support/bingx.py +4 -3
- ccxt/async_support/bit2c.py +1 -1
- ccxt/async_support/bitbank.py +1 -1
- ccxt/async_support/bitbns.py +1 -1
- ccxt/async_support/bitfinex.py +2 -2
- ccxt/async_support/bitfinex2.py +1 -1
- ccxt/async_support/bitflyer.py +1 -1
- ccxt/async_support/bitget.py +4 -4
- ccxt/async_support/bithumb.py +1 -1
- ccxt/async_support/bitmart.py +4 -9
- ccxt/async_support/bitmex.py +3 -3
- ccxt/async_support/bitopro.py +3 -3
- ccxt/async_support/bitrue.py +2 -2
- ccxt/async_support/bitso.py +2 -2
- ccxt/async_support/bitstamp.py +2 -2
- ccxt/async_support/bitteam.py +3 -3
- ccxt/async_support/bitvavo.py +2 -2
- ccxt/async_support/blockchaincom.py +1 -1
- ccxt/async_support/blofin.py +3 -3
- ccxt/async_support/btcalpha.py +3 -3
- ccxt/async_support/btcbox.py +1 -1
- ccxt/async_support/btcmarkets.py +6 -4
- ccxt/async_support/btcturk.py +1 -1
- ccxt/async_support/bybit.py +3 -3
- ccxt/async_support/cex.py +1 -1
- ccxt/async_support/coinbase.py +156 -58
- ccxt/async_support/coinbaseexchange.py +1 -1
- ccxt/async_support/coinbaseinternational.py +3 -3
- ccxt/async_support/coincheck.py +2 -2
- ccxt/async_support/coinex.py +28 -21
- ccxt/async_support/coinlist.py +2 -2
- ccxt/async_support/coinmate.py +2 -2
- ccxt/async_support/coinmetro.py +2 -2
- ccxt/async_support/coinone.py +1 -1
- ccxt/async_support/coinsph.py +2 -2
- ccxt/async_support/cryptocom.py +1 -1
- ccxt/async_support/currencycom.py +2 -2
- ccxt/async_support/delta.py +1 -1
- ccxt/async_support/deribit.py +2 -2
- ccxt/async_support/digifinex.py +2 -2
- ccxt/async_support/exmo.py +2 -2
- ccxt/async_support/gate.py +2 -2
- ccxt/async_support/gemini.py +3 -3
- ccxt/async_support/hitbtc.py +2 -2
- ccxt/async_support/hollaex.py +1 -1
- ccxt/async_support/htx.py +2 -2
- ccxt/async_support/huobijp.py +2 -2
- ccxt/async_support/hyperliquid.py +2 -2
- ccxt/async_support/idex.py +2 -2
- ccxt/async_support/indodax.py +2 -2
- ccxt/async_support/kraken.py +5 -3
- ccxt/async_support/krakenfutures.py +1 -1
- ccxt/async_support/kucoin.py +2 -2
- ccxt/async_support/kuna.py +2 -2
- ccxt/async_support/latoken.py +2 -2
- ccxt/async_support/lbank.py +1 -1
- ccxt/async_support/luno.py +1 -1
- ccxt/async_support/lykke.py +1 -1
- ccxt/async_support/mercado.py +1 -1
- ccxt/async_support/mexc.py +1 -1
- ccxt/async_support/ndax.py +2 -2
- ccxt/async_support/novadax.py +3 -3
- ccxt/async_support/oceanex.py +2 -2
- ccxt/async_support/okcoin.py +3 -3
- ccxt/async_support/okx.py +3 -3
- ccxt/async_support/onetrading.py +2 -2
- ccxt/async_support/p2b.py +2 -2
- ccxt/async_support/paymium.py +1 -1
- ccxt/async_support/phemex.py +4 -4
- ccxt/async_support/poloniex.py +3 -3
- ccxt/async_support/poloniexfutures.py +2 -2
- ccxt/async_support/probit.py +3 -3
- ccxt/async_support/timex.py +2 -2
- ccxt/async_support/tokocrypto.py +1 -1
- ccxt/async_support/tradeogre.py +1 -1
- ccxt/async_support/upbit.py +3 -3
- ccxt/async_support/wavesexchange.py +1 -1
- ccxt/async_support/wazirx.py +3 -3
- ccxt/async_support/whitebit.py +3 -3
- ccxt/async_support/woo.py +3 -3
- ccxt/async_support/woofipro.py +3 -3
- ccxt/async_support/yobit.py +1 -1
- ccxt/async_support/zaif.py +2 -2
- ccxt/async_support/zonda.py +1 -1
- ccxt/base/exchange.py +107 -76
- ccxt/base/types.py +0 -1
- ccxt/bigone.py +2 -2
- ccxt/binance.py +6 -5
- ccxt/bingx.py +4 -3
- ccxt/bit2c.py +1 -1
- ccxt/bitbank.py +1 -1
- ccxt/bitbns.py +1 -1
- ccxt/bitfinex.py +2 -2
- ccxt/bitfinex2.py +1 -1
- ccxt/bitflyer.py +1 -1
- ccxt/bitget.py +4 -4
- ccxt/bithumb.py +1 -1
- ccxt/bitmart.py +4 -9
- ccxt/bitmex.py +3 -3
- ccxt/bitopro.py +3 -3
- ccxt/bitrue.py +2 -2
- ccxt/bitso.py +2 -2
- ccxt/bitstamp.py +2 -2
- ccxt/bitteam.py +3 -3
- ccxt/bitvavo.py +2 -2
- ccxt/blockchaincom.py +1 -1
- ccxt/blofin.py +3 -3
- ccxt/btcalpha.py +3 -3
- ccxt/btcbox.py +1 -1
- ccxt/btcmarkets.py +6 -4
- ccxt/btcturk.py +1 -1
- ccxt/bybit.py +3 -3
- ccxt/cex.py +1 -1
- ccxt/coinbase.py +156 -58
- ccxt/coinbaseexchange.py +1 -1
- ccxt/coinbaseinternational.py +3 -3
- ccxt/coincheck.py +2 -2
- ccxt/coinex.py +28 -21
- ccxt/coinlist.py +2 -2
- ccxt/coinmate.py +2 -2
- ccxt/coinmetro.py +2 -2
- ccxt/coinone.py +1 -1
- ccxt/coinsph.py +2 -2
- ccxt/cryptocom.py +1 -1
- ccxt/currencycom.py +2 -2
- ccxt/delta.py +1 -1
- ccxt/deribit.py +2 -2
- ccxt/digifinex.py +2 -2
- ccxt/exmo.py +2 -2
- ccxt/gate.py +2 -2
- ccxt/gemini.py +3 -3
- ccxt/hitbtc.py +2 -2
- ccxt/hollaex.py +1 -1
- ccxt/htx.py +2 -2
- ccxt/huobijp.py +2 -2
- ccxt/hyperliquid.py +2 -2
- ccxt/idex.py +2 -2
- ccxt/indodax.py +2 -2
- ccxt/kraken.py +5 -3
- ccxt/krakenfutures.py +1 -1
- ccxt/kucoin.py +2 -2
- ccxt/kuna.py +2 -2
- ccxt/latoken.py +2 -2
- ccxt/lbank.py +1 -1
- ccxt/luno.py +1 -1
- ccxt/lykke.py +1 -1
- ccxt/mercado.py +1 -1
- ccxt/mexc.py +1 -1
- ccxt/ndax.py +2 -2
- ccxt/novadax.py +3 -3
- ccxt/oceanex.py +2 -2
- ccxt/okcoin.py +3 -3
- ccxt/okx.py +3 -3
- ccxt/onetrading.py +2 -2
- ccxt/p2b.py +2 -2
- ccxt/paymium.py +1 -1
- ccxt/phemex.py +4 -4
- ccxt/poloniex.py +3 -3
- ccxt/poloniexfutures.py +2 -2
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +331 -2
- ccxt/pro/bitget.py +24 -1
- ccxt/pro/bitmart.py +1 -1
- ccxt/pro/bitmex.py +98 -1
- ccxt/pro/bybit.py +82 -1
- ccxt/pro/gate.py +173 -1
- ccxt/pro/kraken.py +1 -1
- ccxt/pro/kucoinfutures.py +4 -0
- ccxt/pro/okx.py +244 -1
- ccxt/probit.py +3 -3
- ccxt/test/base/__init__.py +1 -0
- ccxt/test/base/test_crypto.py +1 -1
- ccxt/test/base/test_liquidation.py +50 -0
- ccxt/timex.py +2 -2
- ccxt/tokocrypto.py +1 -1
- ccxt/tradeogre.py +1 -1
- ccxt/upbit.py +3 -3
- ccxt/wavesexchange.py +1 -1
- ccxt/wazirx.py +3 -3
- ccxt/whitebit.py +3 -3
- ccxt/woo.py +3 -3
- ccxt/woofipro.py +3 -3
- ccxt/yobit.py +1 -1
- ccxt/zaif.py +2 -2
- ccxt/zonda.py +1 -1
- {ccxt-4.3.33.dist-info → ccxt-4.3.35.dist-info}/METADATA +4 -4
- {ccxt-4.3.33.dist-info → ccxt-4.3.35.dist-info}/RECORD +204 -203
- {ccxt-4.3.33.dist-info → ccxt-4.3.35.dist-info}/WHEEL +0 -0
- {ccxt-4.3.33.dist-info → ccxt-4.3.35.dist-info}/top_level.txt +0 -0
ccxt/async_support/coinbase.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.coinbase import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Account, Balances, Conversion, Currencies, Currency, Int, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
|
10
|
+
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
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -122,8 +122,8 @@ class coinbase(Exchange, ImplicitAPI):
|
|
122
122
|
'fetchTickers': True,
|
123
123
|
'fetchTime': True,
|
124
124
|
'fetchTrades': True,
|
125
|
-
'fetchTradingFee':
|
126
|
-
'fetchTradingFees':
|
125
|
+
'fetchTradingFee': 'emulated',
|
126
|
+
'fetchTradingFees': True,
|
127
127
|
'fetchWithdrawals': True,
|
128
128
|
'reduceMargin': False,
|
129
129
|
'setLeverage': False,
|
@@ -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
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
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 =
|
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
|
-
|
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 =
|
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 =
|
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 =
|
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": {
|
@@ -4232,6 +4273,63 @@ class coinbase(Exchange, ImplicitAPI):
|
|
4232
4273
|
'takeProfitPrice': None,
|
4233
4274
|
})
|
4234
4275
|
|
4276
|
+
async def fetch_trading_fees(self, params={}) -> TradingFees:
|
4277
|
+
"""
|
4278
|
+
:see: https://docs.cdp.coinbase.com/advanced-trade/reference/retailbrokerageapi_gettransactionsummary/
|
4279
|
+
fetch the trading fees for multiple markets
|
4280
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4281
|
+
:param str [params.type]: 'spot' or 'swap'
|
4282
|
+
:returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
|
4283
|
+
"""
|
4284
|
+
await self.load_markets()
|
4285
|
+
type = None
|
4286
|
+
type, params = self.handle_market_type_and_params('fetchTradingFees', None, params)
|
4287
|
+
isSpot = (type == 'spot')
|
4288
|
+
productType = 'SPOT' if isSpot else 'FUTURE'
|
4289
|
+
request: dict = {
|
4290
|
+
'product_type': productType,
|
4291
|
+
}
|
4292
|
+
response = await self.v3PrivateGetBrokerageTransactionSummary(self.extend(request, params))
|
4293
|
+
#
|
4294
|
+
# {
|
4295
|
+
# total_volume: '0',
|
4296
|
+
# total_fees: '0',
|
4297
|
+
# fee_tier: {
|
4298
|
+
# pricing_tier: 'Advanced 1',
|
4299
|
+
# usd_from: '0',
|
4300
|
+
# usd_to: '1000',
|
4301
|
+
# taker_fee_rate: '0.008',
|
4302
|
+
# maker_fee_rate: '0.006',
|
4303
|
+
# aop_from: '',
|
4304
|
+
# aop_to: ''
|
4305
|
+
# },
|
4306
|
+
# margin_rate: null,
|
4307
|
+
# goods_and_services_tax: null,
|
4308
|
+
# advanced_trade_only_volume: '0',
|
4309
|
+
# advanced_trade_only_fees: '0',
|
4310
|
+
# coinbase_pro_volume: '0',
|
4311
|
+
# coinbase_pro_fees: '0',
|
4312
|
+
# total_balance: '',
|
4313
|
+
# has_promo_fee: False
|
4314
|
+
# }
|
4315
|
+
#
|
4316
|
+
data = self.safe_dict(response, 'fee_tier', {})
|
4317
|
+
taker_fee = self.safe_number(data, 'taker_fee_rate')
|
4318
|
+
marker_fee = self.safe_number(data, 'maker_fee_rate')
|
4319
|
+
result: dict = {}
|
4320
|
+
for i in range(0, len(self.symbols)):
|
4321
|
+
symbol = self.symbols[i]
|
4322
|
+
market = self.market(symbol)
|
4323
|
+
if (isSpot and market['spot']) or (not isSpot and not market['spot']):
|
4324
|
+
result[symbol] = {
|
4325
|
+
'info': response,
|
4326
|
+
'symbol': symbol,
|
4327
|
+
'maker': taker_fee,
|
4328
|
+
'taker': marker_fee,
|
4329
|
+
'percentage': True,
|
4330
|
+
}
|
4331
|
+
return result
|
4332
|
+
|
4235
4333
|
def create_auth_token(self, seconds: Int, method: Str = None, url: Str = None):
|
4236
4334
|
# it may not work for v2
|
4237
4335
|
uri = None
|
@@ -4336,7 +4434,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
4336
4434
|
body = self.json(query)
|
4337
4435
|
return {'url': url, 'method': method, 'body': body, 'headers': headers}
|
4338
4436
|
|
4339
|
-
def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
|
4437
|
+
def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
|
4340
4438
|
if response is None:
|
4341
4439
|
return None # fallback to default error handler
|
4342
4440
|
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)",
|
ccxt/async_support/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/async_support/coinex.py
CHANGED
@@ -4375,7 +4375,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4375
4375
|
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
4376
4376
|
"""
|
4377
4377
|
make a withdrawal
|
4378
|
-
:see: https://
|
4378
|
+
:see: https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/withdrawal
|
4379
4379
|
:param str code: unified currency code
|
4380
4380
|
:param float amount: the amount to withdraw
|
4381
4381
|
:param str address: the address to withdraw to
|
@@ -4388,41 +4388,48 @@ class coinex(Exchange, ImplicitAPI):
|
|
4388
4388
|
self.check_address(address)
|
4389
4389
|
await self.load_markets()
|
4390
4390
|
currency = self.currency(code)
|
4391
|
-
networkCode = self.
|
4391
|
+
networkCode = self.safe_string_upper_2(params, 'network', 'chain')
|
4392
4392
|
params = self.omit(params, 'network')
|
4393
4393
|
if tag:
|
4394
4394
|
address = address + ':' + tag
|
4395
4395
|
request: dict = {
|
4396
|
-
'
|
4397
|
-
'
|
4398
|
-
'
|
4399
|
-
'transfer_method': 'onchain', # onchain, local
|
4396
|
+
'ccy': currency['id'],
|
4397
|
+
'to_address': address, # must be authorized, inter-user transfer by a registered mobile phone number or an email address is supported
|
4398
|
+
'amount': self.number_to_string(amount), # the actual amount without fees, https://www.coinex.com/fees
|
4400
4399
|
}
|
4401
4400
|
if networkCode is not None:
|
4402
|
-
request['
|
4403
|
-
response = await self.
|
4401
|
+
request['chain'] = self.network_code_to_id(networkCode) # required for on-chain, not required for inter-user transfer
|
4402
|
+
response = await self.v2PrivatePostAssetsWithdraw(self.extend(request, params))
|
4404
4403
|
#
|
4405
4404
|
# {
|
4406
4405
|
# "code": 0,
|
4407
4406
|
# "data": {
|
4408
|
-
# "
|
4409
|
-
# "
|
4410
|
-
# "
|
4411
|
-
# "
|
4412
|
-
# "
|
4407
|
+
# "withdraw_id": 31193755,
|
4408
|
+
# "created_at": 1716874165038,
|
4409
|
+
# "withdraw_method": "ON_CHAIN",
|
4410
|
+
# "ccy": "USDT",
|
4411
|
+
# "amount": "17.3",
|
4412
|
+
# "actual_amount": "15",
|
4413
|
+
# "chain": "TRC20",
|
4414
|
+
# "tx_fee": "2.3",
|
4415
|
+
# "fee_asset": "USDT",
|
4416
|
+
# "fee_amount": "2.3",
|
4417
|
+
# "to_address": "TY5vq3MT6b5cQVAHWHtpGyPg1ERcQgi3UN",
|
4418
|
+
# "memo": "",
|
4419
|
+
# "tx_id": "",
|
4413
4420
|
# "confirmations": 0,
|
4414
|
-
# "
|
4415
|
-
# "
|
4416
|
-
# "
|
4417
|
-
# "
|
4421
|
+
# "explorer_address_url": "https://tronscan.org/#/address/TY5vq3MT6b5cQVAHWHtpGyPg1ERcQgi3UN",
|
4422
|
+
# "explorer_tx_url": "https://tronscan.org/#/transaction/",
|
4423
|
+
# "remark": "",
|
4424
|
+
# "status": "audit_required"
|
4418
4425
|
# },
|
4419
|
-
# "message": "
|
4426
|
+
# "message": "OK"
|
4420
4427
|
# }
|
4421
4428
|
#
|
4422
4429
|
transaction = self.safe_dict(response, 'data', {})
|
4423
4430
|
return self.parse_transaction(transaction, currency)
|
4424
4431
|
|
4425
|
-
def parse_transaction_status(self, status):
|
4432
|
+
def parse_transaction_status(self, status: Str):
|
4426
4433
|
statuses: dict = {
|
4427
4434
|
'audit': 'pending',
|
4428
4435
|
'pass': 'pending',
|
@@ -4520,7 +4527,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4520
4527
|
# "remark": ""
|
4521
4528
|
# }
|
4522
4529
|
#
|
4523
|
-
# fetchWithdrawals
|
4530
|
+
# fetchWithdrawals and withdraw
|
4524
4531
|
#
|
4525
4532
|
# {
|
4526
4533
|
# "withdraw_id": 259364,
|
@@ -5441,7 +5448,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
5441
5448
|
url += '?' + urlencoded
|
5442
5449
|
return {'url': url, 'method': method, 'body': body, 'headers': headers}
|
5443
5450
|
|
5444
|
-
def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
|
5451
|
+
def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
|
5445
5452
|
if response is None:
|
5446
5453
|
return None
|
5447
5454
|
code = self.safe_string(response, 'code')
|
ccxt/async_support/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/async_support/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/async_support/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/async_support/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/async_support/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/async_support/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
|
@@ -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/async_support/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/async_support/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
|
#
|