ccxt 4.2.70__py2.py3-none-any.whl → 4.2.71__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/coinbase.py +2 -0
- ccxt/ascendex.py +1 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ascendex.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bigone.py +1 -1
- ccxt/async_support/binance.py +1 -1
- ccxt/async_support/bingx.py +1 -1
- ccxt/async_support/bitfinex.py +1 -1
- ccxt/async_support/bitfinex2.py +1 -1
- ccxt/async_support/bitget.py +13 -7
- ccxt/async_support/bitmart.py +1 -1
- ccxt/async_support/bitmex.py +1 -1
- ccxt/async_support/bitrue.py +1 -1
- ccxt/async_support/bitstamp.py +1 -1
- ccxt/async_support/bl3p.py +1 -1
- ccxt/async_support/blofin.py +1 -1
- ccxt/async_support/btcalpha.py +1 -1
- ccxt/async_support/bybit.py +1 -1
- ccxt/async_support/coinbase.py +104 -89
- ccxt/async_support/coinex.py +1 -1
- ccxt/async_support/coinlist.py +1 -1
- ccxt/async_support/coinmetro.py +1 -1
- ccxt/async_support/deribit.py +1 -1
- ccxt/async_support/digifinex.py +3 -2
- ccxt/async_support/gate.py +1 -1
- ccxt/async_support/hitbtc.py +1 -1
- ccxt/async_support/htx.py +1 -1
- ccxt/async_support/hyperliquid.py +2 -2
- ccxt/async_support/kraken.py +2 -1
- ccxt/async_support/krakenfutures.py +1 -1
- ccxt/async_support/kucoin.py +1 -1
- ccxt/async_support/kucoinfutures.py +1 -1
- ccxt/async_support/latoken.py +1 -1
- ccxt/async_support/lykke.py +1 -1
- ccxt/async_support/mexc.py +10 -1
- ccxt/async_support/ndax.py +1 -1
- ccxt/async_support/novadax.py +1 -1
- ccxt/async_support/okcoin.py +1 -1
- ccxt/async_support/okx.py +1 -1
- ccxt/async_support/paymium.py +1 -1
- ccxt/async_support/phemex.py +1 -1
- ccxt/async_support/poloniex.py +1 -1
- ccxt/async_support/wazirx.py +1 -1
- ccxt/async_support/whitebit.py +1 -1
- ccxt/async_support/woo.py +1 -1
- ccxt/async_support/zonda.py +1 -1
- ccxt/base/exchange.py +1 -1
- ccxt/bigone.py +1 -1
- ccxt/binance.py +1 -1
- ccxt/bingx.py +1 -1
- ccxt/bitfinex.py +1 -1
- ccxt/bitfinex2.py +1 -1
- ccxt/bitget.py +13 -7
- ccxt/bitmart.py +1 -1
- ccxt/bitmex.py +1 -1
- ccxt/bitrue.py +1 -1
- ccxt/bitstamp.py +1 -1
- ccxt/bl3p.py +1 -1
- ccxt/blofin.py +1 -1
- ccxt/btcalpha.py +1 -1
- ccxt/bybit.py +1 -1
- ccxt/coinbase.py +104 -89
- ccxt/coinex.py +1 -1
- ccxt/coinlist.py +1 -1
- ccxt/coinmetro.py +1 -1
- ccxt/deribit.py +1 -1
- ccxt/digifinex.py +3 -2
- ccxt/gate.py +1 -1
- ccxt/hitbtc.py +1 -1
- ccxt/htx.py +1 -1
- ccxt/hyperliquid.py +2 -2
- ccxt/kraken.py +2 -1
- ccxt/krakenfutures.py +1 -1
- ccxt/kucoin.py +1 -1
- ccxt/kucoinfutures.py +1 -1
- ccxt/latoken.py +1 -1
- ccxt/lykke.py +1 -1
- ccxt/mexc.py +10 -1
- ccxt/ndax.py +1 -1
- ccxt/novadax.py +1 -1
- ccxt/okcoin.py +1 -1
- ccxt/okx.py +1 -1
- ccxt/paymium.py +1 -1
- ccxt/phemex.py +1 -1
- ccxt/poloniex.py +1 -1
- ccxt/pro/__init__.py +3 -1
- ccxt/pro/hyperliquid.py +524 -0
- ccxt/pro/luno.py +1 -1
- ccxt/test/base/test_balance.py +3 -0
- ccxt/test/base/test_market.py +1 -1
- ccxt/test/base/test_order_book.py +1 -0
- ccxt/test/base/test_shared_methods.py +12 -2
- ccxt/test/base/test_trade.py +1 -1
- ccxt/test/test_async.py +78 -39
- ccxt/test/test_sync.py +78 -39
- ccxt/wazirx.py +1 -1
- ccxt/whitebit.py +1 -1
- ccxt/woo.py +1 -1
- ccxt/zonda.py +1 -1
- {ccxt-4.2.70.dist-info → ccxt-4.2.71.dist-info}/METADATA +5 -5
- {ccxt-4.2.70.dist-info → ccxt-4.2.71.dist-info}/RECORD +105 -104
- {ccxt-4.2.70.dist-info → ccxt-4.2.71.dist-info}/WHEEL +0 -0
- {ccxt-4.2.70.dist-info → ccxt-4.2.71.dist-info}/top_level.txt +0 -0
ccxt/async_support/coinbase.py
CHANGED
@@ -237,6 +237,8 @@ class coinbase(Exchange, ImplicitAPI):
|
|
237
237
|
'brokerage/intx/portfolio/{portfolio_uuid}': 1,
|
238
238
|
'brokerage/intx/positions/{portfolio_uuid}': 1,
|
239
239
|
'brokerage/intx/positions/{portfolio_uuid}/{symbol}': 1,
|
240
|
+
'brokerage/payment_methods': 1,
|
241
|
+
'brokerage/payment_methods/{payment_method_id}': 1,
|
240
242
|
},
|
241
243
|
'post': {
|
242
244
|
'brokerage/orders': 1,
|
@@ -387,7 +389,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
387
389
|
# }
|
388
390
|
# }
|
389
391
|
#
|
390
|
-
response = self.
|
392
|
+
response = self.safe_dict(response, 'data', {})
|
391
393
|
else:
|
392
394
|
response = await self.v3PublicGetBrokerageTime(params)
|
393
395
|
#
|
@@ -473,7 +475,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
473
475
|
accounts = self.safe_list(response, 'data', [])
|
474
476
|
length = len(accounts)
|
475
477
|
lastIndex = length - 1
|
476
|
-
last = self.
|
478
|
+
last = self.safe_dict(accounts, lastIndex)
|
477
479
|
if (cursor is not None) and (cursor != ''):
|
478
480
|
last['next_starting_after'] = cursor
|
479
481
|
accounts[lastIndex] = last
|
@@ -522,7 +524,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
522
524
|
accounts = self.safe_list(response, 'accounts', [])
|
523
525
|
length = len(accounts)
|
524
526
|
lastIndex = length - 1
|
525
|
-
last = self.
|
527
|
+
last = self.safe_dict(accounts, lastIndex)
|
526
528
|
cursor = self.safe_string(response, 'cursor')
|
527
529
|
if (cursor is not None) and (cursor != ''):
|
528
530
|
last['cursor'] = cursor
|
@@ -585,9 +587,9 @@ class coinbase(Exchange, ImplicitAPI):
|
|
585
587
|
# }
|
586
588
|
# }
|
587
589
|
#
|
588
|
-
active = self.
|
590
|
+
active = self.safe_bool(account, 'active')
|
589
591
|
currencyIdV3 = self.safe_string(account, 'currency')
|
590
|
-
currency = self.
|
592
|
+
currency = self.safe_dict(account, 'currency', {})
|
591
593
|
currencyId = self.safe_string(currency, 'code', currencyIdV3)
|
592
594
|
typeV3 = self.safe_string(account, 'name')
|
593
595
|
typeV2 = self.safe_string(account, 'type')
|
@@ -658,7 +660,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
658
660
|
# }
|
659
661
|
# }
|
660
662
|
#
|
661
|
-
data = self.
|
663
|
+
data = self.safe_dict(response, 'data', {})
|
662
664
|
tag = self.safe_string(data, 'destination_tag')
|
663
665
|
address = self.safe_string(data, 'address')
|
664
666
|
return {
|
@@ -864,21 +866,21 @@ class coinbase(Exchange, ImplicitAPI):
|
|
864
866
|
amountAndCurrencyObject = None
|
865
867
|
feeObject = None
|
866
868
|
if transactionType == 'send':
|
867
|
-
network = self.
|
868
|
-
amountAndCurrencyObject = self.
|
869
|
-
feeObject = self.
|
869
|
+
network = self.safe_dict(transaction, 'network', {})
|
870
|
+
amountAndCurrencyObject = self.safe_dict(network, 'transaction_amount', {})
|
871
|
+
feeObject = self.safe_dict(network, 'transaction_fee', {})
|
870
872
|
else:
|
871
|
-
amountAndCurrencyObject = self.
|
872
|
-
feeObject = self.
|
873
|
+
amountAndCurrencyObject = self.safe_dict(transaction, 'subtotal', {})
|
874
|
+
feeObject = self.safe_dict(transaction, 'fee', {})
|
873
875
|
status = self.parse_transaction_status(self.safe_string(transaction, 'status'))
|
874
876
|
if status is None:
|
875
|
-
committed = self.
|
877
|
+
committed = self.safe_bool(transaction, 'committed')
|
876
878
|
status = 'ok' if committed else 'pending'
|
877
879
|
id = self.safe_string(transaction, 'id')
|
878
880
|
currencyId = self.safe_string(amountAndCurrencyObject, 'currency')
|
879
881
|
feeCurrencyId = self.safe_string(feeObject, 'currency')
|
880
|
-
datetime = self.
|
881
|
-
toObject = self.
|
882
|
+
datetime = self.safe_string(transaction, 'created_at')
|
883
|
+
toObject = self.safe_dict(transaction, 'to', {})
|
882
884
|
toAddress = self.safe_string(toObject, 'address')
|
883
885
|
return {
|
884
886
|
'info': transaction,
|
@@ -897,7 +899,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
897
899
|
'amount': self.safe_number(amountAndCurrencyObject, 'amount'),
|
898
900
|
'currency': self.safe_currency_code(currencyId, currency),
|
899
901
|
'status': status,
|
900
|
-
'updated': self.parse8601(self.
|
902
|
+
'updated': self.parse8601(self.safe_string(transaction, 'updated_at')),
|
901
903
|
'fee': {
|
902
904
|
'cost': self.safe_number(feeObject, 'amount'),
|
903
905
|
'currency': self.safe_currency_code(feeCurrencyId),
|
@@ -967,10 +969,10 @@ class coinbase(Exchange, ImplicitAPI):
|
|
967
969
|
# }
|
968
970
|
#
|
969
971
|
symbol = None
|
970
|
-
totalObject = self.
|
971
|
-
amountObject = self.
|
972
|
-
subtotalObject = self.
|
973
|
-
feeObject = self.
|
972
|
+
totalObject = self.safe_dict(trade, 'total', {})
|
973
|
+
amountObject = self.safe_dict(trade, 'amount', {})
|
974
|
+
subtotalObject = self.safe_dict(trade, 'subtotal', {})
|
975
|
+
feeObject = self.safe_dict(trade, 'fee', {})
|
974
976
|
marketId = self.safe_string(trade, 'product_id')
|
975
977
|
market = self.safe_market(marketId, market, '-')
|
976
978
|
if market is not None:
|
@@ -982,7 +984,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
982
984
|
base = self.safe_currency_code(baseId)
|
983
985
|
quote = self.safe_currency_code(quoteId)
|
984
986
|
symbol = base + '/' + quote
|
985
|
-
sizeInQuote = self.
|
987
|
+
sizeInQuote = self.safe_bool(trade, 'size_in_quote')
|
986
988
|
v3Price = self.safe_string(trade, 'price')
|
987
989
|
v3Cost = None
|
988
990
|
v3Amount = self.safe_string(trade, 'size')
|
@@ -1043,11 +1045,11 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1043
1045
|
|
1044
1046
|
async def fetch_markets_v2(self, params={}):
|
1045
1047
|
response = await self.fetch_currencies_from_cache(params)
|
1046
|
-
currencies = self.
|
1047
|
-
exchangeRates = self.
|
1048
|
-
data = self.
|
1048
|
+
currencies = self.safe_dict(response, 'currencies', {})
|
1049
|
+
exchangeRates = self.safe_dict(response, 'exchangeRates', {})
|
1050
|
+
data = self.safe_list(currencies, 'data', [])
|
1049
1051
|
dataById = self.index_by(data, 'id')
|
1050
|
-
rates = self.
|
1052
|
+
rates = self.safe_dict(self.safe_dict(exchangeRates, 'data', {}), 'rates', {})
|
1051
1053
|
baseIds = list(rates.keys())
|
1052
1054
|
result = []
|
1053
1055
|
for i in range(0, len(baseIds)):
|
@@ -1166,8 +1168,8 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1166
1168
|
# "coinbase_pro_fees": 0
|
1167
1169
|
# }
|
1168
1170
|
#
|
1169
|
-
feeTier = self.
|
1170
|
-
data = self.
|
1171
|
+
feeTier = self.safe_dict(fees, 'fee_tier', {})
|
1172
|
+
data = self.safe_list(response, 'products', [])
|
1171
1173
|
result = []
|
1172
1174
|
for i in range(0, len(data)):
|
1173
1175
|
market = data[i]
|
@@ -1177,8 +1179,8 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1177
1179
|
base = self.safe_currency_code(baseId)
|
1178
1180
|
quote = self.safe_currency_code(quoteId)
|
1179
1181
|
marketType = self.safe_string_lower(market, 'product_type')
|
1180
|
-
tradingDisabled = self.
|
1181
|
-
stablePairs = self.
|
1182
|
+
tradingDisabled = self.safe_bool(market, 'trading_disabled')
|
1183
|
+
stablePairs = self.safe_list(self.options, 'stablePairs', [])
|
1182
1184
|
result.append({
|
1183
1185
|
'id': id,
|
1184
1186
|
'symbol': base + '/' + quote,
|
@@ -1233,7 +1235,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1233
1235
|
return result
|
1234
1236
|
|
1235
1237
|
async def fetch_currencies_from_cache(self, params={}):
|
1236
|
-
options = self.
|
1238
|
+
options = self.safe_dict(self.options, 'fetchCurrencies', {})
|
1237
1239
|
timestamp = self.safe_integer(options, 'timestamp')
|
1238
1240
|
expires = self.safe_integer(options, 'expires', 1000)
|
1239
1241
|
now = self.milliseconds()
|
@@ -1286,7 +1288,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1286
1288
|
:returns dict: an associative dictionary of currencies
|
1287
1289
|
"""
|
1288
1290
|
response = await self.fetch_currencies_from_cache(params)
|
1289
|
-
currencies = self.
|
1291
|
+
currencies = self.safe_dict(response, 'currencies', {})
|
1290
1292
|
#
|
1291
1293
|
# fiat
|
1292
1294
|
#
|
@@ -1398,8 +1400,8 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1398
1400
|
# }
|
1399
1401
|
# }
|
1400
1402
|
#
|
1401
|
-
data = self.
|
1402
|
-
rates = self.
|
1403
|
+
data = self.safe_dict(response, 'data', {})
|
1404
|
+
rates = self.safe_dict(data, 'rates', {})
|
1403
1405
|
quoteId = self.safe_string(data, 'currency')
|
1404
1406
|
result = {}
|
1405
1407
|
baseIds = list(rates.keys())
|
@@ -1456,7 +1458,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1456
1458
|
# "num_products": 549
|
1457
1459
|
# }
|
1458
1460
|
#
|
1459
|
-
data = self.
|
1461
|
+
data = self.safe_list(response, 'products', [])
|
1460
1462
|
result = {}
|
1461
1463
|
for i in range(0, len(data)):
|
1462
1464
|
entry = data[i]
|
@@ -1500,9 +1502,9 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1500
1502
|
#
|
1501
1503
|
# {"data":{"base":"BTC","currency":"USD","amount":"48691.23"}}
|
1502
1504
|
#
|
1503
|
-
spotData = self.
|
1504
|
-
askData = self.
|
1505
|
-
bidData = self.
|
1505
|
+
spotData = self.safe_dict(spot, 'data', {})
|
1506
|
+
askData = self.safe_dict(ask, 'data', {})
|
1507
|
+
bidData = self.safe_dict(bid, 'data', {})
|
1506
1508
|
bidAskLast = {
|
1507
1509
|
'bid': self.safe_number(bidData, 'amount'),
|
1508
1510
|
'ask': self.safe_number(askData, 'amount'),
|
@@ -1536,7 +1538,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1536
1538
|
# "best_ask": "28208.62"
|
1537
1539
|
# }
|
1538
1540
|
#
|
1539
|
-
data = self.
|
1541
|
+
data = self.safe_list(response, 'trades', [])
|
1540
1542
|
ticker = self.parse_ticker(data[0], market)
|
1541
1543
|
ticker['bid'] = self.safe_number(response, 'best_bid')
|
1542
1544
|
ticker['ask'] = self.safe_number(response, 'best_ask')
|
@@ -1628,8 +1630,8 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1628
1630
|
bidVolume = None
|
1629
1631
|
askVolume = None
|
1630
1632
|
if ('bids' in ticker):
|
1631
|
-
bids = self.
|
1632
|
-
asks = self.
|
1633
|
+
bids = self.safe_list(ticker, 'bids', [])
|
1634
|
+
asks = self.safe_list(ticker, 'asks', [])
|
1633
1635
|
bid = self.safe_number(bids[0], 'price')
|
1634
1636
|
bidVolume = self.safe_number(bids[0], 'size')
|
1635
1637
|
ask = self.safe_number(asks[0], 'price')
|
@@ -1661,21 +1663,21 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1661
1663
|
}, market)
|
1662
1664
|
|
1663
1665
|
def parse_custom_balance(self, response, params={}):
|
1664
|
-
balances = self.
|
1665
|
-
accounts = self.
|
1666
|
-
v3Accounts = self.
|
1666
|
+
balances = self.safe_list_2(response, 'data', 'accounts', [])
|
1667
|
+
accounts = self.safe_list(params, 'type', self.options['accounts'])
|
1668
|
+
v3Accounts = self.safe_list(params, 'type', self.options['v3Accounts'])
|
1667
1669
|
result = {'info': response}
|
1668
1670
|
for b in range(0, len(balances)):
|
1669
1671
|
balance = balances[b]
|
1670
1672
|
type = self.safe_string(balance, 'type')
|
1671
1673
|
if self.in_array(type, accounts):
|
1672
|
-
value = self.
|
1674
|
+
value = self.safe_dict(balance, 'balance')
|
1673
1675
|
if value is not None:
|
1674
1676
|
currencyId = self.safe_string(value, 'currency')
|
1675
1677
|
code = self.safe_currency_code(currencyId)
|
1676
1678
|
total = self.safe_string(value, 'amount')
|
1677
1679
|
free = total
|
1678
|
-
account = self.
|
1680
|
+
account = self.safe_dict(result, code)
|
1679
1681
|
if account is None:
|
1680
1682
|
account = self.account()
|
1681
1683
|
account['free'] = free
|
@@ -1685,15 +1687,15 @@ class coinbase(Exchange, ImplicitAPI):
|
|
1685
1687
|
account['total'] = Precise.string_add(account['total'], total)
|
1686
1688
|
result[code] = account
|
1687
1689
|
elif self.in_array(type, v3Accounts):
|
1688
|
-
available = self.
|
1689
|
-
hold = self.
|
1690
|
+
available = self.safe_dict(balance, 'available_balance')
|
1691
|
+
hold = self.safe_dict(balance, 'hold')
|
1690
1692
|
if available is not None and hold is not None:
|
1691
1693
|
currencyId = self.safe_string(available, 'currency')
|
1692
1694
|
code = self.safe_currency_code(currencyId)
|
1693
1695
|
used = self.safe_string(hold, 'value')
|
1694
1696
|
free = self.safe_string(available, 'value')
|
1695
1697
|
total = Precise.string_add(used, free)
|
1696
|
-
account = self.
|
1698
|
+
account = self.safe_dict(result, code)
|
1697
1699
|
if account is None:
|
1698
1700
|
account = self.account()
|
1699
1701
|
account['free'] = free
|
@@ -2089,7 +2091,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2089
2091
|
# }
|
2090
2092
|
# }
|
2091
2093
|
#
|
2092
|
-
amountInfo = self.
|
2094
|
+
amountInfo = self.safe_dict(item, 'amount', {})
|
2093
2095
|
amount = self.safe_string(amountInfo, 'amount')
|
2094
2096
|
direction = None
|
2095
2097
|
if Precise.string_lt(amount, '0'):
|
@@ -2109,9 +2111,9 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2109
2111
|
# txid = None
|
2110
2112
|
#
|
2111
2113
|
fee = None
|
2112
|
-
networkInfo = self.
|
2114
|
+
networkInfo = self.safe_dict(item, 'network', {})
|
2113
2115
|
# txid = network['hash'] # txid does not belong to the unified ledger structure
|
2114
|
-
feeInfo = self.
|
2116
|
+
feeInfo = self.safe_dict(networkInfo, 'transaction_fee')
|
2115
2117
|
if feeInfo is not None:
|
2116
2118
|
feeCurrencyId = self.safe_string(feeInfo, 'currency')
|
2117
2119
|
feeCurrencyCode = self.safe_currency_code(feeCurrencyId, currency)
|
@@ -2120,7 +2122,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2120
2122
|
'cost': feeAmount,
|
2121
2123
|
'currency': feeCurrencyCode,
|
2122
2124
|
}
|
2123
|
-
timestamp = self.parse8601(self.
|
2125
|
+
timestamp = self.parse8601(self.safe_string(item, 'created_at'))
|
2124
2126
|
id = self.safe_string(item, 'id')
|
2125
2127
|
type = self.parse_ledger_entry_type(self.safe_string(item, 'type'))
|
2126
2128
|
status = self.parse_ledger_entry_status(self.safe_string(item, 'status'))
|
@@ -2237,7 +2239,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2237
2239
|
isStopLoss = stopLossPrice is not None
|
2238
2240
|
isTakeProfit = takeProfitPrice is not None
|
2239
2241
|
timeInForce = self.safe_string(params, 'timeInForce')
|
2240
|
-
postOnly = True if (timeInForce == 'PO') else self.
|
2242
|
+
postOnly = True if (timeInForce == 'PO') else self.safe_bool_2(params, 'postOnly', 'post_only', False)
|
2241
2243
|
endTime = self.safe_string(params, 'end_time')
|
2242
2244
|
stopDirection = self.safe_string(params, 'stop_direction')
|
2243
2245
|
if type == 'limit':
|
@@ -2295,6 +2297,13 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2295
2297
|
'post_only': postOnly,
|
2296
2298
|
},
|
2297
2299
|
}
|
2300
|
+
elif timeInForce == 'IOC':
|
2301
|
+
request['order_configuration'] = {
|
2302
|
+
'sor_limit_ioc': {
|
2303
|
+
'base_size': self.amount_to_precision(symbol, amount),
|
2304
|
+
'limit_price': self.price_to_precision(symbol, price),
|
2305
|
+
},
|
2306
|
+
}
|
2298
2307
|
else:
|
2299
2308
|
request['order_configuration'] = {
|
2300
2309
|
'limit_limit_gtc': {
|
@@ -2336,7 +2345,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2336
2345
|
},
|
2337
2346
|
}
|
2338
2347
|
params = self.omit(params, ['timeInForce', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'stopPrice', 'stop_price', 'stopDirection', 'stop_direction', 'clientOrderId', 'postOnly', 'post_only', 'end_time'])
|
2339
|
-
preview = self.
|
2348
|
+
preview = self.safe_bool_2(params, 'preview', 'test', False)
|
2340
2349
|
response = None
|
2341
2350
|
if preview:
|
2342
2351
|
params = self.omit(params, ['preview', 'test'])
|
@@ -2381,16 +2390,16 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2381
2390
|
# }
|
2382
2391
|
# }
|
2383
2392
|
#
|
2384
|
-
success = self.
|
2393
|
+
success = self.safe_bool(response, 'success')
|
2385
2394
|
if success is not True:
|
2386
|
-
errorResponse = self.
|
2395
|
+
errorResponse = self.safe_dict(response, 'error_response')
|
2387
2396
|
errorTitle = self.safe_string(errorResponse, 'error')
|
2388
2397
|
errorMessage = self.safe_string(errorResponse, 'message')
|
2389
2398
|
if errorResponse is not None:
|
2390
2399
|
self.throw_exactly_matched_exception(self.exceptions['exact'], errorTitle, errorMessage)
|
2391
2400
|
self.throw_broadly_matched_exception(self.exceptions['broad'], errorTitle, errorMessage)
|
2392
2401
|
raise ExchangeError(errorMessage)
|
2393
|
-
data = self.
|
2402
|
+
data = self.safe_dict(response, 'success_response', {})
|
2394
2403
|
return self.parse_order(data, market)
|
2395
2404
|
|
2396
2405
|
def parse_order(self, order, market: Market = None) -> Order:
|
@@ -2460,28 +2469,35 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2460
2469
|
symbol = self.safe_symbol(marketId, market, '-')
|
2461
2470
|
if symbol is not None:
|
2462
2471
|
market = self.market(symbol)
|
2463
|
-
orderConfiguration = self.
|
2464
|
-
limitGTC = self.
|
2465
|
-
limitGTD = self.
|
2466
|
-
|
2467
|
-
|
2468
|
-
|
2469
|
-
|
2472
|
+
orderConfiguration = self.safe_dict(order, 'order_configuration', {})
|
2473
|
+
limitGTC = self.safe_dict(orderConfiguration, 'limit_limit_gtc')
|
2474
|
+
limitGTD = self.safe_dict(orderConfiguration, 'limit_limit_gtd')
|
2475
|
+
limitIOC = self.safe_dict(orderConfiguration, 'sor_limit_ioc')
|
2476
|
+
stopLimitGTC = self.safe_dict(orderConfiguration, 'stop_limit_stop_limit_gtc')
|
2477
|
+
stopLimitGTD = self.safe_dict(orderConfiguration, 'stop_limit_stop_limit_gtd')
|
2478
|
+
marketIOC = self.safe_dict(orderConfiguration, 'market_market_ioc')
|
2479
|
+
isLimit = ((limitGTC is not None) or (limitGTD is not None) or (limitIOC is not None))
|
2470
2480
|
isStop = ((stopLimitGTC is not None) or (stopLimitGTD is not None))
|
2471
2481
|
price = None
|
2472
2482
|
amount = None
|
2473
2483
|
postOnly = None
|
2474
2484
|
triggerPrice = None
|
2475
2485
|
if isLimit:
|
2476
|
-
target =
|
2486
|
+
target = None
|
2487
|
+
if limitGTC is not None:
|
2488
|
+
target = limitGTC
|
2489
|
+
elif limitGTD is not None:
|
2490
|
+
target = limitGTD
|
2491
|
+
else:
|
2492
|
+
target = limitIOC
|
2477
2493
|
price = self.safe_string(target, 'limit_price')
|
2478
2494
|
amount = self.safe_string(target, 'base_size')
|
2479
|
-
postOnly = self.
|
2495
|
+
postOnly = self.safe_bool(target, 'post_only')
|
2480
2496
|
elif isStop:
|
2481
2497
|
stopTarget = stopLimitGTC if (stopLimitGTC is not None) else stopLimitGTD
|
2482
2498
|
price = self.safe_string(stopTarget, 'limit_price')
|
2483
2499
|
amount = self.safe_string(stopTarget, 'base_size')
|
2484
|
-
postOnly = self.
|
2500
|
+
postOnly = self.safe_bool(stopTarget, 'post_only')
|
2485
2501
|
triggerPrice = self.safe_string(stopTarget, 'stop_price')
|
2486
2502
|
else:
|
2487
2503
|
amount = self.safe_string(marketIOC, 'base_size')
|
@@ -2561,7 +2577,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2561
2577
|
"""
|
2562
2578
|
await self.load_markets()
|
2563
2579
|
orders = await self.cancel_orders([id], symbol, params)
|
2564
|
-
return self.
|
2580
|
+
return self.safe_dict(orders, 0, {})
|
2565
2581
|
|
2566
2582
|
async def cancel_orders(self, ids, symbol: Str = None, params={}):
|
2567
2583
|
"""
|
@@ -2591,9 +2607,9 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2591
2607
|
# ]
|
2592
2608
|
# }
|
2593
2609
|
#
|
2594
|
-
orders = self.
|
2610
|
+
orders = self.safe_list(response, 'results', [])
|
2595
2611
|
for i in range(0, len(orders)):
|
2596
|
-
success = self.
|
2612
|
+
success = self.safe_bool(orders[i], 'success')
|
2597
2613
|
if success is not True:
|
2598
2614
|
raise BadRequest(self.id + ' cancelOrders() has failed, check your arguments and parameters')
|
2599
2615
|
return self.parse_orders(orders, market)
|
@@ -2621,7 +2637,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2621
2637
|
request['size'] = self.amount_to_precision(symbol, amount)
|
2622
2638
|
if price is not None:
|
2623
2639
|
request['price'] = self.price_to_precision(symbol, price)
|
2624
|
-
preview = self.
|
2640
|
+
preview = self.safe_bool_2(params, 'preview', 'test', False)
|
2625
2641
|
response = None
|
2626
2642
|
if preview:
|
2627
2643
|
params = self.omit(params, ['preview', 'test'])
|
@@ -2695,7 +2711,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2695
2711
|
# }
|
2696
2712
|
# }
|
2697
2713
|
#
|
2698
|
-
order = self.
|
2714
|
+
order = self.safe_dict(response, 'order', {})
|
2699
2715
|
return self.parse_order(order, market)
|
2700
2716
|
|
2701
2717
|
async def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = 100, params={}) -> List[Order]:
|
@@ -2725,7 +2741,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2725
2741
|
request['limit'] = limit
|
2726
2742
|
if since is not None:
|
2727
2743
|
request['start_date'] = self.iso8601(since)
|
2728
|
-
until = self.
|
2744
|
+
until = self.safe_integer_n(params, ['until', 'till'])
|
2729
2745
|
if until is not None:
|
2730
2746
|
params = self.omit(params, ['until', 'till'])
|
2731
2747
|
request['end_date'] = self.iso8601(until)
|
@@ -2772,8 +2788,8 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2772
2788
|
# "cursor": ""
|
2773
2789
|
# }
|
2774
2790
|
#
|
2775
|
-
orders = self.
|
2776
|
-
first = self.
|
2791
|
+
orders = self.safe_list(response, 'orders', [])
|
2792
|
+
first = self.safe_dict(orders, 0)
|
2777
2793
|
cursor = self.safe_string(response, 'cursor')
|
2778
2794
|
if (cursor is not None) and (cursor != ''):
|
2779
2795
|
first['cursor'] = cursor
|
@@ -2795,7 +2811,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2795
2811
|
request['limit'] = limit
|
2796
2812
|
if since is not None:
|
2797
2813
|
request['start_date'] = self.iso8601(since)
|
2798
|
-
until = self.
|
2814
|
+
until = self.safe_integer_n(params, ['until', 'till'])
|
2799
2815
|
if until is not None:
|
2800
2816
|
params = self.omit(params, ['until', 'till'])
|
2801
2817
|
request['end_date'] = self.iso8601(until)
|
@@ -2842,8 +2858,8 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2842
2858
|
# "cursor": ""
|
2843
2859
|
# }
|
2844
2860
|
#
|
2845
|
-
orders = self.
|
2846
|
-
first = self.
|
2861
|
+
orders = self.safe_list(response, 'orders', [])
|
2862
|
+
first = self.safe_dict(orders, 0)
|
2847
2863
|
cursor = self.safe_string(response, 'cursor')
|
2848
2864
|
if (cursor is not None) and (cursor != ''):
|
2849
2865
|
first['cursor'] = cursor
|
@@ -2925,7 +2941,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2925
2941
|
'product_id': market['id'],
|
2926
2942
|
'granularity': self.safe_string(self.timeframes, timeframe, timeframe),
|
2927
2943
|
}
|
2928
|
-
until = self.
|
2944
|
+
until = self.safe_integer_n(params, ['until', 'till', 'end'])
|
2929
2945
|
params = self.omit(params, ['until', 'till'])
|
2930
2946
|
duration = self.parse_timeframe(timeframe)
|
2931
2947
|
requestedDuration = limit * duration
|
@@ -2956,7 +2972,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2956
2972
|
# ]
|
2957
2973
|
# }
|
2958
2974
|
#
|
2959
|
-
candles = self.
|
2975
|
+
candles = self.safe_list(response, 'candles', [])
|
2960
2976
|
return self.parse_ohlcvs(candles, market, timeframe, since, limit)
|
2961
2977
|
|
2962
2978
|
def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
|
@@ -3023,7 +3039,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
3023
3039
|
# ]
|
3024
3040
|
# }
|
3025
3041
|
#
|
3026
|
-
trades = self.
|
3042
|
+
trades = self.safe_list(response, 'trades', [])
|
3027
3043
|
return self.parse_trades(trades, market, since, limit)
|
3028
3044
|
|
3029
3045
|
async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
@@ -3053,7 +3069,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
3053
3069
|
request['limit'] = limit
|
3054
3070
|
if since is not None:
|
3055
3071
|
request['start_sequence_timestamp'] = self.iso8601(since)
|
3056
|
-
until = self.
|
3072
|
+
until = self.safe_integer_n(params, ['until', 'till'])
|
3057
3073
|
if until is not None:
|
3058
3074
|
params = self.omit(params, ['until', 'till'])
|
3059
3075
|
request['end_sequence_timestamp'] = self.iso8601(until)
|
@@ -3081,8 +3097,8 @@ class coinbase(Exchange, ImplicitAPI):
|
|
3081
3097
|
# "cursor": ""
|
3082
3098
|
# }
|
3083
3099
|
#
|
3084
|
-
trades = self.
|
3085
|
-
first = self.
|
3100
|
+
trades = self.safe_list(response, 'fills', [])
|
3101
|
+
first = self.safe_dict(trades, 0)
|
3086
3102
|
cursor = self.safe_string(response, 'cursor')
|
3087
3103
|
if (cursor is not None) and (cursor != ''):
|
3088
3104
|
first['cursor'] = cursor
|
@@ -3167,7 +3183,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
3167
3183
|
# ]
|
3168
3184
|
# }
|
3169
3185
|
#
|
3170
|
-
tickers = self.
|
3186
|
+
tickers = self.safe_list(response, 'pricebooks', [])
|
3171
3187
|
return self.parse_tickers(tickers, symbols)
|
3172
3188
|
|
3173
3189
|
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
@@ -3255,7 +3271,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
3255
3271
|
# }
|
3256
3272
|
# }
|
3257
3273
|
#
|
3258
|
-
data = self.
|
3274
|
+
data = self.safe_dict(response, 'data', {})
|
3259
3275
|
return self.parse_transaction(data, currency)
|
3260
3276
|
|
3261
3277
|
async def fetch_deposit_addresses_by_network(self, code: str, params={}):
|
@@ -3516,7 +3532,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
3516
3532
|
# }
|
3517
3533
|
# }
|
3518
3534
|
#
|
3519
|
-
data = self.
|
3535
|
+
data = self.safe_dict(response, 'data', {})
|
3520
3536
|
return self.parse_transaction(data)
|
3521
3537
|
|
3522
3538
|
def sign(self, path, api=[], method='GET', params={}, headers=None, body=None):
|
@@ -3599,7 +3615,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
3599
3615
|
self.throw_exactly_matched_exception(self.exceptions['exact'], errorCode, feedback)
|
3600
3616
|
self.throw_broadly_matched_exception(self.exceptions['broad'], errorMessage, feedback)
|
3601
3617
|
raise ExchangeError(feedback)
|
3602
|
-
errors = self.
|
3618
|
+
errors = self.safe_list(response, 'errors')
|
3603
3619
|
if errors is not None:
|
3604
3620
|
if isinstance(errors, list):
|
3605
3621
|
numErrors = len(errors)
|
@@ -3611,7 +3627,6 @@ class coinbase(Exchange, ImplicitAPI):
|
|
3611
3627
|
self.throw_broadly_matched_exception(self.exceptions['broad'], errorMessage, feedback)
|
3612
3628
|
raise ExchangeError(feedback)
|
3613
3629
|
advancedTrade = self.options['advanced']
|
3614
|
-
|
3615
|
-
if (data is None) and (not advancedTrade):
|
3630
|
+
if not ('data' in response) and (not advancedTrade):
|
3616
3631
|
raise ExchangeError(self.id + ' failed due to a malformed response ' + self.json(response))
|
3617
3632
|
return None
|
ccxt/async_support/coinex.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.coinex import ImplicitAPI
|
8
8
|
import asyncio
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages, Market, Order,
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages, Market, Order, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
ccxt/async_support/coinlist.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.coinlist import ImplicitAPI
|
8
8
|
import hashlib
|
9
9
|
import math
|
10
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order,
|
10
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import PermissionDenied
|
ccxt/async_support/coinmetro.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.coinmetro import ImplicitAPI
|
8
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType,
|
8
|
+
from ccxt.base.types import Balances, Currency, IndexType, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade
|
9
9
|
from typing import List
|
10
10
|
from ccxt.base.errors import ExchangeError
|
11
11
|
from ccxt.base.errors import PermissionDenied
|
ccxt/async_support/deribit.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.deribit import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Greeks, Int, Market, Order,
|
9
|
+
from ccxt.base.types import Balances, Currency, Greeks, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
ccxt/async_support/digifinex.py
CHANGED
@@ -8,7 +8,7 @@ from ccxt.abstract.digifinex import ImplicitAPI
|
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
10
|
import json
|
11
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order,
|
11
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
12
12
|
from typing import List
|
13
13
|
from ccxt.base.errors import ExchangeError
|
14
14
|
from ccxt.base.errors import PermissionDenied
|
@@ -1464,7 +1464,8 @@ class digifinex(Exchange, ImplicitAPI):
|
|
1464
1464
|
elif limit is not None:
|
1465
1465
|
endTime = self.seconds()
|
1466
1466
|
duration = self.parse_timeframe(timeframe)
|
1467
|
-
|
1467
|
+
auxLimit = limit # in c# -limit is mutating the arg
|
1468
|
+
request['start_time'] = self.sum(endTime, -auxLimit * duration)
|
1468
1469
|
response = await self.publicSpotGetKline(self.extend(request, params))
|
1469
1470
|
#
|
1470
1471
|
# spot
|
ccxt/async_support/gate.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.gate import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Balances, Currency, Greeks, Int, Leverage, Leverages, Market, Order,
|
10
|
+
from ccxt.base.types import Balances, Currency, FundingHistory, Greeks, Int, Leverage, Leverages, Market, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import PermissionDenied
|
ccxt/async_support/hitbtc.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.hitbtc import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Leverage, MarginMode, MarginModes, Market, Order,
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Leverage, MarginMode, MarginModes, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import PermissionDenied
|
ccxt/async_support/htx.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.htx import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Order,
|
10
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import PermissionDenied
|