ccxt 4.3.29__py2.py3-none-any.whl → 4.3.31__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.
- ccxt/__init__.py +1 -1
- ccxt/abstract/binance.py +2 -0
- ccxt/abstract/binancecoinm.py +2 -0
- ccxt/abstract/binanceus.py +2 -0
- ccxt/abstract/binanceusdm.py +2 -0
- ccxt/ace.py +14 -14
- ccxt/alpaca.py +16 -16
- ccxt/ascendex.py +46 -46
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ace.py +14 -14
- ccxt/async_support/alpaca.py +16 -16
- ccxt/async_support/ascendex.py +46 -46
- ccxt/async_support/base/exchange.py +23 -23
- ccxt/async_support/base/ws/aiohttp_client.py +1 -0
- ccxt/async_support/base/ws/future.py +27 -29
- ccxt/async_support/bigone.py +32 -32
- ccxt/async_support/binance.py +105 -96
- ccxt/async_support/bingx.py +22 -22
- ccxt/async_support/bit2c.py +13 -13
- ccxt/async_support/bitbank.py +19 -19
- ccxt/async_support/bitbns.py +17 -17
- ccxt/async_support/bitfinex.py +24 -24
- ccxt/async_support/bitfinex2.py +142 -109
- ccxt/async_support/bitflyer.py +23 -23
- ccxt/async_support/bitget.py +76 -76
- ccxt/async_support/bithumb.py +20 -20
- ccxt/async_support/bitmart.py +55 -55
- ccxt/async_support/bitmex.py +41 -41
- ccxt/async_support/bitopro.py +30 -30
- ccxt/async_support/bitrue.py +37 -37
- ccxt/async_support/bitso.py +30 -30
- ccxt/async_support/bitstamp.py +31 -31
- ccxt/async_support/bitteam.py +26 -26
- ccxt/async_support/bitvavo.py +27 -27
- ccxt/async_support/bl3p.py +8 -8
- ccxt/async_support/blockchaincom.py +24 -24
- ccxt/async_support/blofin.py +37 -37
- ccxt/async_support/btcalpha.py +19 -19
- ccxt/async_support/btcbox.py +11 -11
- ccxt/async_support/btcmarkets.py +22 -22
- ccxt/async_support/btcturk.py +13 -13
- ccxt/async_support/bybit.py +96 -96
- ccxt/async_support/cex.py +21 -21
- ccxt/async_support/coinbase.py +53 -53
- ccxt/async_support/coinbaseexchange.py +29 -29
- ccxt/async_support/coinbaseinternational.py +32 -32
- ccxt/async_support/coincheck.py +14 -14
- ccxt/async_support/coinex.py +424 -448
- ccxt/async_support/coinlist.py +35 -35
- ccxt/async_support/coinmate.py +22 -22
- ccxt/async_support/coinmetro.py +22 -22
- ccxt/async_support/coinone.py +18 -18
- ccxt/async_support/coinsph.py +32 -32
- ccxt/async_support/coinspot.py +8 -8
- ccxt/async_support/cryptocom.py +43 -43
- ccxt/async_support/currencycom.py +33 -33
- ccxt/async_support/delta.py +35 -35
- ccxt/async_support/deribit.py +54 -54
- ccxt/async_support/digifinex.py +56 -56
- ccxt/async_support/exmo.py +34 -34
- ccxt/async_support/gate.py +60 -60
- ccxt/async_support/gemini.py +24 -24
- ccxt/async_support/hitbtc.py +51 -51
- ccxt/async_support/hollaex.py +29 -29
- ccxt/async_support/htx.py +73 -73
- ccxt/async_support/huobijp.py +30 -30
- ccxt/async_support/hyperliquid.py +58 -58
- ccxt/async_support/idex.py +33 -33
- ccxt/async_support/independentreserve.py +12 -12
- ccxt/async_support/indodax.py +21 -21
- ccxt/async_support/kraken.py +46 -51
- ccxt/async_support/krakenfutures.py +29 -29
- ccxt/async_support/kucoin.py +51 -51
- ccxt/async_support/kucoinfutures.py +33 -33
- ccxt/async_support/kuna.py +27 -27
- ccxt/async_support/latoken.py +27 -27
- ccxt/async_support/lbank.py +35 -35
- ccxt/async_support/luno.py +19 -19
- ccxt/async_support/lykke.py +20 -20
- ccxt/async_support/mercado.py +17 -17
- ccxt/async_support/mexc.py +64 -64
- ccxt/async_support/ndax.py +38 -38
- ccxt/async_support/novadax.py +26 -26
- ccxt/async_support/oceanex.py +21 -21
- ccxt/async_support/okcoin.py +35 -35
- ccxt/async_support/okx.py +85 -85
- ccxt/async_support/onetrading.py +32 -32
- ccxt/async_support/p2b.py +14 -14
- ccxt/async_support/paymium.py +12 -12
- ccxt/async_support/phemex.py +50 -50
- ccxt/async_support/poloniex.py +35 -35
- ccxt/async_support/poloniexfutures.py +25 -21
- ccxt/async_support/probit.py +30 -30
- ccxt/async_support/timex.py +22 -22
- ccxt/async_support/tokocrypto.py +26 -26
- ccxt/async_support/tradeogre.py +12 -12
- ccxt/async_support/upbit.py +28 -28
- ccxt/async_support/wavesexchange.py +33 -33
- ccxt/async_support/wazirx.py +21 -21
- ccxt/async_support/whitebit.py +80 -40
- ccxt/async_support/woo.py +51 -51
- ccxt/async_support/woofipro.py +46 -46
- ccxt/async_support/yobit.py +20 -20
- ccxt/async_support/zaif.py +12 -12
- ccxt/async_support/zonda.py +22 -22
- ccxt/base/exchange.py +39 -35
- ccxt/base/types.py +13 -0
- ccxt/bigone.py +32 -32
- ccxt/binance.py +105 -96
- ccxt/bingx.py +22 -22
- ccxt/bit2c.py +13 -13
- ccxt/bitbank.py +19 -19
- ccxt/bitbns.py +17 -17
- ccxt/bitfinex.py +24 -24
- ccxt/bitfinex2.py +142 -109
- ccxt/bitflyer.py +23 -23
- ccxt/bitget.py +76 -76
- ccxt/bithumb.py +20 -20
- ccxt/bitmart.py +55 -55
- ccxt/bitmex.py +41 -41
- ccxt/bitopro.py +30 -30
- ccxt/bitrue.py +37 -37
- ccxt/bitso.py +30 -30
- ccxt/bitstamp.py +31 -31
- ccxt/bitteam.py +26 -26
- ccxt/bitvavo.py +27 -27
- ccxt/bl3p.py +8 -8
- ccxt/blockchaincom.py +24 -24
- ccxt/blofin.py +37 -37
- ccxt/btcalpha.py +19 -19
- ccxt/btcbox.py +11 -11
- ccxt/btcmarkets.py +22 -22
- ccxt/btcturk.py +13 -13
- ccxt/bybit.py +96 -96
- ccxt/cex.py +21 -21
- ccxt/coinbase.py +53 -53
- ccxt/coinbaseexchange.py +29 -29
- ccxt/coinbaseinternational.py +32 -32
- ccxt/coincheck.py +14 -14
- ccxt/coinex.py +424 -448
- ccxt/coinlist.py +35 -35
- ccxt/coinmate.py +22 -22
- ccxt/coinmetro.py +22 -22
- ccxt/coinone.py +18 -18
- ccxt/coinsph.py +32 -32
- ccxt/coinspot.py +8 -8
- ccxt/cryptocom.py +43 -43
- ccxt/currencycom.py +33 -33
- ccxt/delta.py +35 -35
- ccxt/deribit.py +54 -54
- ccxt/digifinex.py +56 -56
- ccxt/exmo.py +34 -34
- ccxt/gate.py +60 -60
- ccxt/gemini.py +24 -24
- ccxt/hitbtc.py +51 -51
- ccxt/hollaex.py +29 -29
- ccxt/htx.py +73 -73
- ccxt/huobijp.py +30 -30
- ccxt/hyperliquid.py +58 -58
- ccxt/idex.py +33 -33
- ccxt/independentreserve.py +12 -12
- ccxt/indodax.py +21 -21
- ccxt/kraken.py +46 -51
- ccxt/krakenfutures.py +29 -29
- ccxt/kucoin.py +51 -51
- ccxt/kucoinfutures.py +33 -33
- ccxt/kuna.py +27 -27
- ccxt/latoken.py +27 -27
- ccxt/lbank.py +35 -35
- ccxt/luno.py +19 -19
- ccxt/lykke.py +20 -20
- ccxt/mercado.py +17 -17
- ccxt/mexc.py +64 -64
- ccxt/ndax.py +38 -38
- ccxt/novadax.py +26 -26
- ccxt/oceanex.py +21 -21
- ccxt/okcoin.py +35 -35
- ccxt/okx.py +85 -85
- ccxt/onetrading.py +32 -32
- ccxt/p2b.py +14 -14
- ccxt/paymium.py +12 -12
- ccxt/phemex.py +50 -50
- ccxt/poloniex.py +35 -35
- ccxt/poloniexfutures.py +25 -21
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/alpaca.py +8 -8
- ccxt/pro/ascendex.py +4 -4
- ccxt/pro/binance.py +56 -56
- ccxt/pro/bingx.py +5 -5
- ccxt/pro/bitfinex.py +6 -6
- ccxt/pro/bitfinex2.py +10 -10
- ccxt/pro/bitget.py +17 -17
- ccxt/pro/bithumb.py +6 -6
- ccxt/pro/bitmart.py +8 -8
- ccxt/pro/bitmex.py +16 -16
- ccxt/pro/bitopro.py +4 -4
- ccxt/pro/bitrue.py +8 -8
- ccxt/pro/bitstamp.py +5 -5
- ccxt/pro/bitvavo.py +14 -14
- ccxt/pro/blockchaincom.py +7 -7
- ccxt/pro/bybit.py +12 -12
- ccxt/pro/cex.py +19 -19
- ccxt/pro/coinbase.py +2 -2
- ccxt/pro/coinbaseexchange.py +10 -10
- ccxt/pro/coinbaseinternational.py +4 -4
- ccxt/pro/coincheck.py +2 -2
- ccxt/pro/coinex.py +15 -15
- ccxt/pro/coinone.py +4 -4
- ccxt/pro/cryptocom.py +11 -11
- ccxt/pro/currencycom.py +4 -4
- ccxt/pro/deribit.py +9 -9
- ccxt/pro/exmo.py +9 -9
- ccxt/pro/gate.py +12 -12
- ccxt/pro/gemini.py +11 -11
- ccxt/pro/hitbtc.py +13 -13
- ccxt/pro/hollaex.py +6 -6
- ccxt/pro/htx.py +15 -15
- ccxt/pro/huobijp.py +16 -16
- ccxt/pro/hyperliquid.py +9 -9
- ccxt/pro/idex.py +12 -12
- ccxt/pro/independentreserve.py +2 -2
- ccxt/pro/kraken.py +14 -14
- ccxt/pro/krakenfutures.py +12 -12
- ccxt/pro/kucoin.py +12 -12
- ccxt/pro/kucoinfutures.py +16 -16
- ccxt/pro/lbank.py +12 -12
- ccxt/pro/luno.py +4 -4
- ccxt/pro/mexc.py +14 -14
- ccxt/pro/ndax.py +12 -12
- ccxt/pro/okcoin.py +6 -6
- ccxt/pro/okx.py +30 -30
- ccxt/pro/onetrading.py +13 -13
- ccxt/pro/p2b.py +2 -2
- ccxt/pro/phemex.py +9 -9
- ccxt/pro/poloniex.py +9 -9
- ccxt/pro/poloniexfutures.py +10 -10
- ccxt/pro/probit.py +8 -8
- ccxt/pro/upbit.py +1 -1
- ccxt/pro/wazirx.py +10 -10
- ccxt/pro/whitebit.py +8 -8
- ccxt/pro/woo.py +14 -14
- ccxt/pro/woofipro.py +14 -14
- ccxt/probit.py +30 -30
- ccxt/test/base/test_shared_methods.py +1 -0
- ccxt/timex.py +22 -22
- ccxt/tokocrypto.py +26 -26
- ccxt/tradeogre.py +12 -12
- ccxt/upbit.py +28 -28
- ccxt/wavesexchange.py +33 -33
- ccxt/wazirx.py +21 -21
- ccxt/whitebit.py +80 -40
- ccxt/woo.py +51 -51
- ccxt/woofipro.py +46 -46
- ccxt/yobit.py +20 -20
- ccxt/zaif.py +12 -12
- ccxt/zonda.py +22 -22
- {ccxt-4.3.29.dist-info → ccxt-4.3.31.dist-info}/METADATA +4 -4
- {ccxt-4.3.29.dist-info → ccxt-4.3.31.dist-info}/RECORD +260 -260
- {ccxt-4.3.29.dist-info → ccxt-4.3.31.dist-info}/WHEEL +0 -0
- {ccxt-4.3.29.dist-info → ccxt-4.3.31.dist-info}/top_level.txt +0 -0
ccxt/async_support/ascendex.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.ascendex import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Account, Balances, Currencies, Currency, Int, Leverage, Leverages, MarginMode, MarginModes, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Account, Balances, Currencies, Currency, Int, Leverage, Leverages, LeverageTier, LeverageTiers, MarginMode, MarginModes, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -465,7 +465,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
465
465
|
cashById = self.index_by(cashData, 'assetCode')
|
466
466
|
dataById = self.deep_extend(assetsById, marginById, cashById)
|
467
467
|
ids = list(dataById.keys())
|
468
|
-
result = {}
|
468
|
+
result: dict = {}
|
469
469
|
for i in range(0, len(ids)):
|
470
470
|
id = ids[i]
|
471
471
|
currency = dataById[id]
|
@@ -699,7 +699,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
699
699
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
700
700
|
:returns int: the current integer timestamp in milliseconds from the ascendex server
|
701
701
|
"""
|
702
|
-
request = {
|
702
|
+
request: dict = {
|
703
703
|
'requestTime': self.milliseconds(),
|
704
704
|
}
|
705
705
|
response = await self.v1PublicGetExchangeInfo(self.extend(request, params))
|
@@ -755,7 +755,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
755
755
|
]
|
756
756
|
|
757
757
|
def parse_balance(self, response) -> Balances:
|
758
|
-
result = {
|
758
|
+
result: dict = {
|
759
759
|
'info': response,
|
760
760
|
'timestamp': None,
|
761
761
|
'datetime': None,
|
@@ -771,7 +771,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
771
771
|
return self.safe_balance(result)
|
772
772
|
|
773
773
|
def parse_margin_balance(self, response):
|
774
|
-
result = {
|
774
|
+
result: dict = {
|
775
775
|
'info': response,
|
776
776
|
'timestamp': None,
|
777
777
|
'datetime': None,
|
@@ -790,7 +790,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
790
790
|
return self.safe_balance(result)
|
791
791
|
|
792
792
|
def parse_swap_balance(self, response):
|
793
|
-
result = {
|
793
|
+
result: dict = {
|
794
794
|
'info': response,
|
795
795
|
'timestamp': None,
|
796
796
|
'datetime': None,
|
@@ -830,7 +830,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
830
830
|
accountCategory = self.safe_string(accountsByType, marketType, 'cash')
|
831
831
|
account = self.safe_value(self.accounts, 0, {})
|
832
832
|
accountGroup = self.safe_string(account, 'id')
|
833
|
-
request = {
|
833
|
+
request: dict = {
|
834
834
|
'account-group': accountGroup,
|
835
835
|
}
|
836
836
|
if (marginMode == 'isolated') and (marketType != 'swap'):
|
@@ -904,7 +904,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
904
904
|
"""
|
905
905
|
await self.load_markets()
|
906
906
|
market = self.market(symbol)
|
907
|
-
request = {
|
907
|
+
request: dict = {
|
908
908
|
'symbol': market['id'],
|
909
909
|
}
|
910
910
|
response = await self.v1PublicGetDepth(self.extend(request, params))
|
@@ -993,7 +993,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
993
993
|
"""
|
994
994
|
await self.load_markets()
|
995
995
|
market = self.market(symbol)
|
996
|
-
request = {
|
996
|
+
request: dict = {
|
997
997
|
'symbol': market['id'],
|
998
998
|
}
|
999
999
|
response = await self.v1PublicGetTicker(self.extend(request, params))
|
@@ -1026,7 +1026,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1026
1026
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
1027
1027
|
"""
|
1028
1028
|
await self.load_markets()
|
1029
|
-
request = {}
|
1029
|
+
request: dict = {}
|
1030
1030
|
market = None
|
1031
1031
|
if symbols is not None:
|
1032
1032
|
symbol = self.safe_value(symbols, 0)
|
@@ -1101,7 +1101,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1101
1101
|
"""
|
1102
1102
|
await self.load_markets()
|
1103
1103
|
market = self.market(symbol)
|
1104
|
-
request = {
|
1104
|
+
request: dict = {
|
1105
1105
|
'symbol': market['id'],
|
1106
1106
|
'interval': self.safe_string(self.timeframes, timeframe, timeframe),
|
1107
1107
|
}
|
@@ -1143,7 +1143,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1143
1143
|
data = self.safe_list(response, 'data', [])
|
1144
1144
|
return self.parse_ohlcvs(data, market, timeframe, since, limit)
|
1145
1145
|
|
1146
|
-
def parse_trade(self, trade, market: Market = None) -> Trade:
|
1146
|
+
def parse_trade(self, trade: dict, market: Market = None) -> Trade:
|
1147
1147
|
#
|
1148
1148
|
# public fetchTrades
|
1149
1149
|
#
|
@@ -1189,7 +1189,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1189
1189
|
"""
|
1190
1190
|
await self.load_markets()
|
1191
1191
|
market = self.market(symbol)
|
1192
|
-
request = {
|
1192
|
+
request: dict = {
|
1193
1193
|
'symbol': market['id'],
|
1194
1194
|
}
|
1195
1195
|
if limit is not None:
|
@@ -1213,8 +1213,8 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1213
1213
|
trades = self.safe_list(records, 'data', [])
|
1214
1214
|
return self.parse_trades(trades, market, since, limit)
|
1215
1215
|
|
1216
|
-
def parse_order_status(self, status):
|
1217
|
-
statuses = {
|
1216
|
+
def parse_order_status(self, status: Str):
|
1217
|
+
statuses: dict = {
|
1218
1218
|
'PendingNew': 'open',
|
1219
1219
|
'New': 'open',
|
1220
1220
|
'PartiallyFilled': 'open',
|
@@ -1224,7 +1224,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1224
1224
|
}
|
1225
1225
|
return self.safe_string(statuses, status, status)
|
1226
1226
|
|
1227
|
-
def parse_order(self, order, market: Market = None) -> Order:
|
1227
|
+
def parse_order(self, order: dict, market: Market = None) -> Order:
|
1228
1228
|
#
|
1229
1229
|
# createOrder
|
1230
1230
|
#
|
@@ -1406,7 +1406,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1406
1406
|
await self.load_accounts()
|
1407
1407
|
account = self.safe_value(self.accounts, 0, {})
|
1408
1408
|
accountGroup = self.safe_string(account, 'id')
|
1409
|
-
request = {
|
1409
|
+
request: dict = {
|
1410
1410
|
'account-group': accountGroup,
|
1411
1411
|
}
|
1412
1412
|
response = await self.v1PrivateAccountGroupGetSpotFee(self.extend(request, params))
|
@@ -1428,7 +1428,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1428
1428
|
#
|
1429
1429
|
data = self.safe_value(response, 'data', {})
|
1430
1430
|
fees = self.safe_value(data, 'fees', [])
|
1431
|
-
result = {}
|
1431
|
+
result: dict = {}
|
1432
1432
|
for i in range(0, len(fees)):
|
1433
1433
|
fee = fees[i]
|
1434
1434
|
marketId = self.safe_string(fee, 'symbol')
|
@@ -1471,7 +1471,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1471
1471
|
account = self.safe_value(self.accounts, 0, {})
|
1472
1472
|
accountGroup = self.safe_value(account, 'id')
|
1473
1473
|
clientOrderId = self.safe_string_2(params, 'clientOrderId', 'id')
|
1474
|
-
request = {
|
1474
|
+
request: dict = {
|
1475
1475
|
'account-group': accountGroup,
|
1476
1476
|
'account-category': accountCategory,
|
1477
1477
|
'symbol': market['id'],
|
@@ -1659,7 +1659,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1659
1659
|
accountCategory = 'margin'
|
1660
1660
|
account = self.safe_value(self.accounts, 0, {})
|
1661
1661
|
accountGroup = self.safe_value(account, 'id')
|
1662
|
-
request = {}
|
1662
|
+
request: dict = {}
|
1663
1663
|
response = None
|
1664
1664
|
if market['swap']:
|
1665
1665
|
raise NotSupported(self.id + ' createOrders() is not currently supported for swap markets on ascendex')
|
@@ -1717,7 +1717,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1717
1717
|
accountCategory = self.safe_string(accountsByType, type, 'cash')
|
1718
1718
|
account = self.safe_value(self.accounts, 0, {})
|
1719
1719
|
accountGroup = self.safe_value(account, 'id')
|
1720
|
-
request = {
|
1720
|
+
request: dict = {
|
1721
1721
|
'account-group': accountGroup,
|
1722
1722
|
'account-category': accountCategory,
|
1723
1723
|
'orderId': id,
|
@@ -1822,7 +1822,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1822
1822
|
type, query = self.handle_market_type_and_params('fetchOpenOrders', market, params)
|
1823
1823
|
accountsByType = self.safe_value(self.options, 'accountsByType', {})
|
1824
1824
|
accountCategory = self.safe_string(accountsByType, type, 'cash')
|
1825
|
-
request = {
|
1825
|
+
request: dict = {
|
1826
1826
|
'account-group': accountGroup,
|
1827
1827
|
'account-category': accountCategory,
|
1828
1828
|
}
|
@@ -1927,7 +1927,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1927
1927
|
await self.load_accounts()
|
1928
1928
|
account = self.safe_value(self.accounts, 0, {})
|
1929
1929
|
accountGroup = self.safe_value(account, 'id')
|
1930
|
-
request = {
|
1930
|
+
request: dict = {
|
1931
1931
|
# 'category': accountCategory,
|
1932
1932
|
# 'symbol': market['id'],
|
1933
1933
|
# 'orderType': 'market', # optional, string
|
@@ -2094,7 +2094,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2094
2094
|
accountCategory = self.safe_string(accountsByType, type, 'cash')
|
2095
2095
|
account = self.safe_value(self.accounts, 0, {})
|
2096
2096
|
accountGroup = self.safe_value(account, 'id')
|
2097
|
-
request = {
|
2097
|
+
request: dict = {
|
2098
2098
|
'account-group': accountGroup,
|
2099
2099
|
'account-category': accountCategory,
|
2100
2100
|
'symbol': market['id'],
|
@@ -2201,7 +2201,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2201
2201
|
accountCategory = self.safe_string(accountsByType, type, 'cash')
|
2202
2202
|
account = self.safe_value(self.accounts, 0, {})
|
2203
2203
|
accountGroup = self.safe_value(account, 'id')
|
2204
|
-
request = {
|
2204
|
+
request: dict = {
|
2205
2205
|
'account-group': accountGroup,
|
2206
2206
|
'account-category': accountCategory,
|
2207
2207
|
'time': self.milliseconds(),
|
@@ -2299,7 +2299,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2299
2299
|
networkCode = self.safe_string_2(params, 'network', 'chainName')
|
2300
2300
|
networkId = self.network_code_to_id(networkCode)
|
2301
2301
|
params = self.omit(params, ['chainName'])
|
2302
|
-
request = {
|
2302
|
+
request: dict = {
|
2303
2303
|
'asset': currency['id'],
|
2304
2304
|
'blockchain': networkId,
|
2305
2305
|
}
|
@@ -2365,7 +2365,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2365
2365
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2366
2366
|
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
2367
2367
|
"""
|
2368
|
-
request = {
|
2368
|
+
request: dict = {
|
2369
2369
|
'txType': 'deposit',
|
2370
2370
|
}
|
2371
2371
|
return await self.fetch_transactions(code, since, limit, self.extend(request, params))
|
@@ -2379,7 +2379,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2379
2379
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2380
2380
|
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
2381
2381
|
"""
|
2382
|
-
request = {
|
2382
|
+
request: dict = {
|
2383
2383
|
'txType': 'withdrawal',
|
2384
2384
|
}
|
2385
2385
|
return await self.fetch_transactions(code, since, limit, self.extend(request, params))
|
@@ -2394,7 +2394,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2394
2394
|
:returns dict: a list of `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
|
2395
2395
|
"""
|
2396
2396
|
await self.load_markets()
|
2397
|
-
request = {
|
2397
|
+
request: dict = {
|
2398
2398
|
# 'asset': currency['id'],
|
2399
2399
|
# 'page': 1,
|
2400
2400
|
# 'pageSize': 20,
|
@@ -2441,7 +2441,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2441
2441
|
return self.parse_transactions(transactions, currency, since, limit)
|
2442
2442
|
|
2443
2443
|
def parse_transaction_status(self, status):
|
2444
|
-
statuses = {
|
2444
|
+
statuses: dict = {
|
2445
2445
|
'reviewing': 'pending',
|
2446
2446
|
'pending': 'pending',
|
2447
2447
|
'confirmed': 'ok',
|
@@ -2449,7 +2449,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2449
2449
|
}
|
2450
2450
|
return self.safe_string(statuses, status, status)
|
2451
2451
|
|
2452
|
-
def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
|
2452
|
+
def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
|
2453
2453
|
#
|
2454
2454
|
# {
|
2455
2455
|
# "requestId": "wuzd1Ojsqtz4bCA3UXwtUnnJDmU8PiyB",
|
@@ -2515,7 +2515,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2515
2515
|
await self.load_accounts()
|
2516
2516
|
account = self.safe_value(self.accounts, 0, {})
|
2517
2517
|
accountGroup = self.safe_string(account, 'id')
|
2518
|
-
request = {
|
2518
|
+
request: dict = {
|
2519
2519
|
'account-group': accountGroup,
|
2520
2520
|
}
|
2521
2521
|
response = await self.v2PrivateAccountGroupGetFuturesPosition(self.extend(request, params))
|
@@ -2566,7 +2566,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2566
2566
|
symbols = self.market_symbols(symbols)
|
2567
2567
|
return self.filter_by_array_positions(result, 'symbol', symbols, False)
|
2568
2568
|
|
2569
|
-
def parse_position(self, position, market: Market = None):
|
2569
|
+
def parse_position(self, position: dict, market: Market = None):
|
2570
2570
|
#
|
2571
2571
|
# {
|
2572
2572
|
# "symbol": "BTC-PERP",
|
@@ -2712,7 +2712,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2712
2712
|
account = self.safe_value(self.accounts, 0, {})
|
2713
2713
|
accountGroup = self.safe_string(account, 'id')
|
2714
2714
|
amount = self.amount_to_precision(symbol, amount)
|
2715
|
-
request = {
|
2715
|
+
request: dict = {
|
2716
2716
|
'account-group': accountGroup,
|
2717
2717
|
'symbol': market['id'],
|
2718
2718
|
'amount': amount, # positive value for adding margin, negative for reducing
|
@@ -2795,7 +2795,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2795
2795
|
raise BadSymbol(self.id + ' setLeverage() supports swap contracts only')
|
2796
2796
|
account = self.safe_value(self.accounts, 0, {})
|
2797
2797
|
accountGroup = self.safe_string(account, 'id')
|
2798
|
-
request = {
|
2798
|
+
request: dict = {
|
2799
2799
|
'account-group': accountGroup,
|
2800
2800
|
'symbol': market['id'],
|
2801
2801
|
'leverage': leverage,
|
@@ -2823,7 +2823,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2823
2823
|
market = self.market(symbol)
|
2824
2824
|
account = self.safe_value(self.accounts, 0, {})
|
2825
2825
|
accountGroup = self.safe_string(account, 'id')
|
2826
|
-
request = {
|
2826
|
+
request: dict = {
|
2827
2827
|
'account-group': accountGroup,
|
2828
2828
|
'symbol': market['id'],
|
2829
2829
|
'marginType': marginMode,
|
@@ -2832,7 +2832,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2832
2832
|
raise BadSymbol(self.id + ' setMarginMode() supports swap contracts only')
|
2833
2833
|
return await self.v2PrivateAccountGroupPostFuturesMarginType(self.extend(request, params))
|
2834
2834
|
|
2835
|
-
async def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
|
2835
|
+
async def fetch_leverage_tiers(self, symbols: Strings = None, params={}) -> LeverageTiers:
|
2836
2836
|
"""
|
2837
2837
|
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
2838
2838
|
:param str[]|None symbols: list of unified market symbols
|
@@ -2873,7 +2873,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2873
2873
|
symbols = self.market_symbols(symbols)
|
2874
2874
|
return self.parse_leverage_tiers(data, symbols, 'symbol')
|
2875
2875
|
|
2876
|
-
def parse_market_leverage_tiers(self, info, market: Market = None):
|
2876
|
+
def parse_market_leverage_tiers(self, info, market: Market = None) -> List[LeverageTier]:
|
2877
2877
|
"""
|
2878
2878
|
:param dict info: Exchange market response for 1 market
|
2879
2879
|
:param dict market: CCXT market
|
@@ -2941,7 +2941,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2941
2941
|
#
|
2942
2942
|
blockChains = self.safe_value(fee, 'blockChain', [])
|
2943
2943
|
blockChainsLength = len(blockChains)
|
2944
|
-
result = {
|
2944
|
+
result: dict = {
|
2945
2945
|
'info': fee,
|
2946
2946
|
'withdraw': {
|
2947
2947
|
'fee': None,
|
@@ -3000,7 +3000,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
3000
3000
|
toId = self.safe_string(accountsByType, toAccount, toAccount)
|
3001
3001
|
if fromId != 'cash' and toId != 'cash':
|
3002
3002
|
raise ExchangeError(self.id + ' transfer() only supports direct balance transfer between spot and swap, spot and margin')
|
3003
|
-
request = {
|
3003
|
+
request: dict = {
|
3004
3004
|
'account-group': accountGroup,
|
3005
3005
|
'amount': self.currency_to_precision(code, amount),
|
3006
3006
|
'asset': currency['id'],
|
@@ -3063,7 +3063,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
3063
3063
|
return await self.fetch_paginated_call_incremental('fetchFundingHistory', symbol, since, limit, params, 'page', 25)
|
3064
3064
|
account = self.safe_value(self.accounts, 0, {})
|
3065
3065
|
accountGroup = self.safe_string(account, 'id')
|
3066
|
-
request = {
|
3066
|
+
request: dict = {
|
3067
3067
|
'account-group': accountGroup,
|
3068
3068
|
}
|
3069
3069
|
market = None
|
@@ -3116,7 +3116,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
3116
3116
|
'amount': self.safe_number(income, 'paymentInUSDT'),
|
3117
3117
|
}
|
3118
3118
|
|
3119
|
-
async def fetch_margin_modes(self, symbols:
|
3119
|
+
async def fetch_margin_modes(self, symbols: Strings = None, params={}) -> MarginModes:
|
3120
3120
|
"""
|
3121
3121
|
fetches the set margin mode of the user
|
3122
3122
|
:see: https://ascendex.github.io/ascendex-futures-pro-api-v2/#position
|
@@ -3128,7 +3128,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
3128
3128
|
await self.load_accounts()
|
3129
3129
|
account = self.safe_value(self.accounts, 0, {})
|
3130
3130
|
accountGroup = self.safe_string(account, 'id')
|
3131
|
-
request = {
|
3131
|
+
request: dict = {
|
3132
3132
|
'account-group': accountGroup,
|
3133
3133
|
}
|
3134
3134
|
response = await self.v2PrivateAccountGroupGetFuturesPosition(self.extend(request, params))
|
@@ -3175,7 +3175,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
3175
3175
|
marginModes = self.safe_list(data, 'contracts', [])
|
3176
3176
|
return self.parse_margin_modes(marginModes, symbols, 'symbol')
|
3177
3177
|
|
3178
|
-
def parse_margin_mode(self, marginMode, market=None) -> MarginMode:
|
3178
|
+
def parse_margin_mode(self, marginMode: dict, market=None) -> MarginMode:
|
3179
3179
|
marketId = self.safe_string(marginMode, 'symbol')
|
3180
3180
|
marginType = self.safe_string(marginMode, 'marginType')
|
3181
3181
|
margin = 'cross' if (marginType == 'crossed') else 'isolated'
|
@@ -3185,7 +3185,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
3185
3185
|
'marginMode': margin,
|
3186
3186
|
}
|
3187
3187
|
|
3188
|
-
async def fetch_leverages(self, symbols:
|
3188
|
+
async def fetch_leverages(self, symbols: Strings = None, params={}) -> Leverages:
|
3189
3189
|
"""
|
3190
3190
|
fetch the set leverage for all contract markets
|
3191
3191
|
:see: https://ascendex.github.io/ascendex-futures-pro-api-v2/#position
|
@@ -3197,7 +3197,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
3197
3197
|
await self.load_accounts()
|
3198
3198
|
account = self.safe_value(self.accounts, 0, {})
|
3199
3199
|
accountGroup = self.safe_string(account, 'id')
|
3200
|
-
request = {
|
3200
|
+
request: dict = {
|
3201
3201
|
'account-group': accountGroup,
|
3202
3202
|
}
|
3203
3203
|
response = await self.v2PrivateAccountGroupGetFuturesPosition(self.extend(request, params))
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# -----------------------------------------------------------------------------
|
4
4
|
|
5
|
-
__version__ = '4.3.
|
5
|
+
__version__ = '4.3.31'
|
6
6
|
|
7
7
|
# -----------------------------------------------------------------------------
|
8
8
|
|
@@ -586,7 +586,7 @@ class Exchange(BaseExchange):
|
|
586
586
|
async def watch_order_book_for_symbols(self, symbols: List[str], limit: Int = None, params={}):
|
587
587
|
raise NotSupported(self.id + ' watchOrderBookForSymbols() is not supported yet')
|
588
588
|
|
589
|
-
async def fetch_deposit_addresses(self, codes:
|
589
|
+
async def fetch_deposit_addresses(self, codes: Strings = None, params={}):
|
590
590
|
raise NotSupported(self.id + ' fetchDepositAddresses() is not supported yet')
|
591
591
|
|
592
592
|
async def fetch_order_book(self, symbol: str, limit: Int = None, params={}):
|
@@ -599,7 +599,7 @@ class Exchange(BaseExchange):
|
|
599
599
|
else:
|
600
600
|
raise NotSupported(self.id + ' fetchMarginMode() is not supported yet')
|
601
601
|
|
602
|
-
async def fetch_margin_modes(self, symbols:
|
602
|
+
async def fetch_margin_modes(self, symbols: Strings = None, params={}):
|
603
603
|
raise NotSupported(self.id + ' fetchMarginModes() is not supported yet')
|
604
604
|
|
605
605
|
async def fetch_rest_order_book_safe(self, symbol, limit=None, params={}):
|
@@ -619,7 +619,7 @@ class Exchange(BaseExchange):
|
|
619
619
|
async def fetch_time(self, params={}):
|
620
620
|
raise NotSupported(self.id + ' fetchTime() is not supported yet')
|
621
621
|
|
622
|
-
async def fetch_trading_limits(self, symbols:
|
622
|
+
async def fetch_trading_limits(self, symbols: Strings = None, params={}):
|
623
623
|
raise NotSupported(self.id + ' fetchTradingLimits() is not supported yet')
|
624
624
|
|
625
625
|
async def fetch_cross_borrow_rates(self, params={}):
|
@@ -628,10 +628,10 @@ class Exchange(BaseExchange):
|
|
628
628
|
async def fetch_isolated_borrow_rates(self, params={}):
|
629
629
|
raise NotSupported(self.id + ' fetchIsolatedBorrowRates() is not supported yet')
|
630
630
|
|
631
|
-
async def fetch_leverage_tiers(self, symbols:
|
631
|
+
async def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
|
632
632
|
raise NotSupported(self.id + ' fetchLeverageTiers() is not supported yet')
|
633
633
|
|
634
|
-
async def fetch_funding_rates(self, symbols:
|
634
|
+
async def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
635
635
|
raise NotSupported(self.id + ' fetchFundingRates() is not supported yet')
|
636
636
|
|
637
637
|
async def watch_funding_rate(self, symbol: str, params={}):
|
@@ -662,7 +662,7 @@ class Exchange(BaseExchange):
|
|
662
662
|
else:
|
663
663
|
raise NotSupported(self.id + ' fetchLeverage() is not supported yet')
|
664
664
|
|
665
|
-
async def fetch_leverages(self, symbols:
|
665
|
+
async def fetch_leverages(self, symbols: Strings = None, params={}):
|
666
666
|
raise NotSupported(self.id + ' fetchLeverages() is not supported yet')
|
667
667
|
|
668
668
|
async def set_position_mode(self, hedged: bool, symbol: Str = None, params={}):
|
@@ -791,7 +791,7 @@ class Exchange(BaseExchange):
|
|
791
791
|
'bids': self.sort_by(self.aggregate(orderbook['bids']), 0, True),
|
792
792
|
})
|
793
793
|
|
794
|
-
async def load_trading_limits(self, symbols:
|
794
|
+
async def load_trading_limits(self, symbols: Strings = None, reload=False, params={}):
|
795
795
|
if self.has['fetchTradingLimits']:
|
796
796
|
if reload or not ('limitsLoaded' in self.options):
|
797
797
|
response = await self.fetch_trading_limits(symbols)
|
@@ -855,10 +855,10 @@ class Exchange(BaseExchange):
|
|
855
855
|
async def watch_position(self, symbol: Str = None, params={}):
|
856
856
|
raise NotSupported(self.id + ' watchPosition() is not supported yet')
|
857
857
|
|
858
|
-
async def watch_positions(self, symbols:
|
858
|
+
async def watch_positions(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}):
|
859
859
|
raise NotSupported(self.id + ' watchPositions() is not supported yet')
|
860
860
|
|
861
|
-
async def watch_position_for_symbols(self, symbols:
|
861
|
+
async def watch_position_for_symbols(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}):
|
862
862
|
return await self.watchPositions(symbols, since, limit, params)
|
863
863
|
|
864
864
|
async def fetch_positions_for_symbol(self, symbol: str, params={}):
|
@@ -879,13 +879,13 @@ class Exchange(BaseExchange):
|
|
879
879
|
"""
|
880
880
|
raise NotSupported(self.id + ' fetchPositionsForSymbol() is not supported yet')
|
881
881
|
|
882
|
-
async def fetch_positions(self, symbols:
|
882
|
+
async def fetch_positions(self, symbols: Strings = None, params={}):
|
883
883
|
raise NotSupported(self.id + ' fetchPositions() is not supported yet')
|
884
884
|
|
885
|
-
async def fetch_positions_ws(self, symbols:
|
885
|
+
async def fetch_positions_ws(self, symbols: Strings = None, params={}):
|
886
886
|
raise NotSupported(self.id + ' fetchPositions() is not supported yet')
|
887
887
|
|
888
|
-
async def fetch_positions_risk(self, symbols:
|
888
|
+
async def fetch_positions_risk(self, symbols: Strings = None, params={}):
|
889
889
|
raise NotSupported(self.id + ' fetchPositionsRisk() is not supported yet')
|
890
890
|
|
891
891
|
async def fetch_bids_asks(self, symbols: Strings = None, params={}):
|
@@ -930,10 +930,10 @@ class Exchange(BaseExchange):
|
|
930
930
|
raise NotSupported(self.id + ' fetchTransactionFee() is not supported yet')
|
931
931
|
return await self.fetch_transaction_fees([code], params)
|
932
932
|
|
933
|
-
async def fetch_transaction_fees(self, codes:
|
933
|
+
async def fetch_transaction_fees(self, codes: Strings = None, params={}):
|
934
934
|
raise NotSupported(self.id + ' fetchTransactionFees() is not supported yet')
|
935
935
|
|
936
|
-
async def fetch_deposit_withdraw_fees(self, codes:
|
936
|
+
async def fetch_deposit_withdraw_fees(self, codes: Strings = None, params={}):
|
937
937
|
raise NotSupported(self.id + ' fetchDepositWithdrawFees() is not supported yet')
|
938
938
|
|
939
939
|
async def fetch_deposit_withdraw_fee(self, code: str, params={}):
|
@@ -993,19 +993,19 @@ class Exchange(BaseExchange):
|
|
993
993
|
async def watch_ticker(self, symbol: str, params={}):
|
994
994
|
raise NotSupported(self.id + ' watchTicker() is not supported yet')
|
995
995
|
|
996
|
-
async def fetch_tickers(self, symbols:
|
996
|
+
async def fetch_tickers(self, symbols: Strings = None, params={}):
|
997
997
|
raise NotSupported(self.id + ' fetchTickers() is not supported yet')
|
998
998
|
|
999
|
-
async def fetch_tickers_ws(self, symbols:
|
999
|
+
async def fetch_tickers_ws(self, symbols: Strings = None, params={}):
|
1000
1000
|
raise NotSupported(self.id + ' fetchTickers() is not supported yet')
|
1001
1001
|
|
1002
|
-
async def fetch_order_books(self, symbols:
|
1002
|
+
async def fetch_order_books(self, symbols: Strings = None, limit: Int = None, params={}):
|
1003
1003
|
raise NotSupported(self.id + ' fetchOrderBooks() is not supported yet')
|
1004
1004
|
|
1005
1005
|
async def watch_bids_asks(self, symbols: Strings = None, params={}):
|
1006
1006
|
raise NotSupported(self.id + ' watchBidsAsks() is not supported yet')
|
1007
1007
|
|
1008
|
-
async def watch_tickers(self, symbols:
|
1008
|
+
async def watch_tickers(self, symbols: Strings = None, params={}):
|
1009
1009
|
raise NotSupported(self.id + ' watchTickers() is not supported yet')
|
1010
1010
|
|
1011
1011
|
async def fetch_order(self, id: str, symbol: Str = None, params={}):
|
@@ -1603,7 +1603,7 @@ class Exchange(BaseExchange):
|
|
1603
1603
|
query = self.extend(params, {'stopPrice': stopPrice})
|
1604
1604
|
return await self.createOrderWs(symbol, 'market', side, amount, None, query)
|
1605
1605
|
|
1606
|
-
async def fetch_last_prices(self, symbols:
|
1606
|
+
async def fetch_last_prices(self, symbols: Strings = None, params={}):
|
1607
1607
|
raise NotSupported(self.id + ' fetchLastPrices() is not supported yet')
|
1608
1608
|
|
1609
1609
|
async def fetch_trading_fees(self, params={}):
|
@@ -1648,7 +1648,7 @@ class Exchange(BaseExchange):
|
|
1648
1648
|
:returns float[][]: A list of candles ordered, open, high, low, close, None
|
1649
1649
|
"""
|
1650
1650
|
if self.has['fetchMarkOHLCV']:
|
1651
|
-
request = {
|
1651
|
+
request: dict = {
|
1652
1652
|
'price': 'mark',
|
1653
1653
|
}
|
1654
1654
|
return await self.fetch_ohlcv(symbol, timeframe, since, limit, self.extend(request, params))
|
@@ -1666,7 +1666,7 @@ class Exchange(BaseExchange):
|
|
1666
1666
|
* @returns {} A list of candles ordered, open, high, low, close, None
|
1667
1667
|
"""
|
1668
1668
|
if self.has['fetchIndexOHLCV']:
|
1669
|
-
request = {
|
1669
|
+
request: dict = {
|
1670
1670
|
'price': 'index',
|
1671
1671
|
}
|
1672
1672
|
return await self.fetch_ohlcv(symbol, timeframe, since, limit, self.extend(request, params))
|
@@ -1684,7 +1684,7 @@ class Exchange(BaseExchange):
|
|
1684
1684
|
:returns float[][]: A list of candles ordered, open, high, low, close, None
|
1685
1685
|
"""
|
1686
1686
|
if self.has['fetchPremiumIndexOHLCV']:
|
1687
|
-
request = {
|
1687
|
+
request: dict = {
|
1688
1688
|
'price': 'premiumIndex',
|
1689
1689
|
}
|
1690
1690
|
return await self.fetch_ohlcv(symbol, timeframe, since, limit, self.extend(request, params))
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import asyncio
|
2
2
|
from ccxt import ExchangeClosedByUser
|
3
3
|
|
4
|
-
|
5
4
|
class Future(asyncio.Future):
|
6
5
|
|
7
6
|
is_race_future = False
|
@@ -23,38 +22,37 @@ class Future(asyncio.Future):
|
|
23
22
|
task = asyncio.create_task(coro)
|
24
23
|
|
25
24
|
def callback(done):
|
26
|
-
|
27
|
-
|
28
|
-
complete, _ = done.result()
|
25
|
+
try:
|
26
|
+
complete, pending = done.result()
|
29
27
|
# check for exceptions
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
else:
|
43
|
-
futures_list = list(complete)
|
44
|
-
are_all_canceled = all(f._state == 'CANCELLED' for f in futures_list)
|
45
|
-
if are_all_canceled and future._state == 'PENDING':
|
46
|
-
future.set_exception(ExchangeClosedByUser('Connection closed by the user'))
|
28
|
+
for i, f in enumerate(complete):
|
29
|
+
try:
|
30
|
+
f.result()
|
31
|
+
except ExchangeClosedByUser as e:
|
32
|
+
if len(pending) == 0 and i == len(complete) - 1:
|
33
|
+
future.reject(e)
|
34
|
+
# wait for all the sub promises to be reject before rejecting future
|
35
|
+
continue
|
36
|
+
except asyncio.CancelledError as e:
|
37
|
+
continue
|
38
|
+
except Exception as e:
|
39
|
+
future.reject(e)
|
47
40
|
return
|
41
|
+
# no exceptions return first result
|
42
|
+
futures_list = list(complete)
|
48
43
|
|
49
|
-
|
50
|
-
|
51
|
-
|
44
|
+
are_all_canceled = all([f.cancelled() for f in futures_list])
|
45
|
+
if are_all_canceled:
|
46
|
+
future.reject(ExchangeClosedByUser('Connection closed by the user'))
|
47
|
+
return
|
52
48
|
|
53
|
-
|
49
|
+
first = futures_list[0]
|
54
50
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
future.
|
51
|
+
first_result = first.result()
|
52
|
+
future.resolve(first_result)
|
53
|
+
except asyncio.CancelledError as e:
|
54
|
+
future.reject(e)
|
55
|
+
except Exception as e:
|
56
|
+
future.reject(e)
|
59
57
|
task.add_done_callback(callback)
|
60
58
|
return future
|