ccxt 4.3.89__py2.py3-none-any.whl → 4.3.90__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/alpaca.py +2 -2
- ccxt/ascendex.py +95 -97
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/alpaca.py +2 -2
- ccxt/async_support/ascendex.py +95 -97
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bingx.py +29 -17
- ccxt/async_support/bitfinex2.py +21 -22
- ccxt/async_support/bitget.py +2 -2
- ccxt/async_support/bitmart.py +4 -8
- ccxt/async_support/coinbaseinternational.py +2 -1
- ccxt/async_support/coinex.py +1 -16
- ccxt/async_support/hitbtc.py +1 -0
- ccxt/async_support/huobijp.py +0 -8
- ccxt/async_support/latoken.py +1 -0
- ccxt/async_support/okx.py +1 -8
- ccxt/async_support/whitebit.py +5 -3
- ccxt/base/exchange.py +1 -1
- ccxt/bingx.py +29 -17
- ccxt/bitfinex2.py +21 -22
- ccxt/bitget.py +2 -2
- ccxt/bitmart.py +4 -8
- ccxt/coinbaseinternational.py +2 -1
- ccxt/coinex.py +1 -16
- ccxt/hitbtc.py +1 -0
- ccxt/huobijp.py +0 -8
- ccxt/latoken.py +1 -0
- ccxt/okx.py +1 -8
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +280 -0
- ccxt/pro/bingx.py +235 -85
- ccxt/pro/bithumb.py +4 -0
- ccxt/pro/bybit.py +1 -1
- ccxt/pro/coinex.py +941 -662
- ccxt/pro/lbank.py +1 -2
- ccxt/pro/okx.py +142 -2
- ccxt/whitebit.py +5 -3
- {ccxt-4.3.89.dist-info → ccxt-4.3.90.dist-info}/METADATA +4 -4
- {ccxt-4.3.89.dist-info → ccxt-4.3.90.dist-info}/RECORD +43 -43
- {ccxt-4.3.89.dist-info → ccxt-4.3.90.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.3.89.dist-info → ccxt-4.3.90.dist-info}/WHEEL +0 -0
- {ccxt-4.3.89.dist-info → ccxt-4.3.90.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/alpaca.py
CHANGED
@@ -553,8 +553,8 @@ class alpaca(Exchange, ImplicitAPI):
|
|
553
553
|
# }
|
554
554
|
# }
|
555
555
|
#
|
556
|
-
orderbooks = self.
|
557
|
-
rawOrderbook = self.
|
556
|
+
orderbooks = self.safe_dict(response, 'orderbooks', {})
|
557
|
+
rawOrderbook = self.safe_dict(orderbooks, id, {})
|
558
558
|
timestamp = self.parse8601(self.safe_string(rawOrderbook, 't'))
|
559
559
|
return self.parse_order_book(rawOrderbook, market['symbol'], timestamp, 'b', 'a', 'p', 's')
|
560
560
|
|
ccxt/ascendex.py
CHANGED
@@ -448,9 +448,9 @@ class ascendex(Exchange, ImplicitAPI):
|
|
448
448
|
# ]
|
449
449
|
# }
|
450
450
|
#
|
451
|
-
assetsData = self.
|
452
|
-
marginData = self.
|
453
|
-
cashData = self.
|
451
|
+
assetsData = self.safe_list(assets, 'data', [])
|
452
|
+
marginData = self.safe_list(margin, 'data', [])
|
453
|
+
cashData = self.safe_list(cash, 'data', [])
|
454
454
|
assetsById = self.index_by(assetsData, 'assetCode')
|
455
455
|
marginById = self.index_by(marginData, 'assetCode')
|
456
456
|
cashById = self.index_by(cashData, 'assetCode')
|
@@ -588,10 +588,10 @@ class ascendex(Exchange, ImplicitAPI):
|
|
588
588
|
# ]
|
589
589
|
# }
|
590
590
|
#
|
591
|
-
productsData = self.
|
591
|
+
productsData = self.safe_list(products, 'data', [])
|
592
592
|
productsById = self.index_by(productsData, 'symbol')
|
593
|
-
cashData = self.
|
594
|
-
perpetualsData = self.
|
593
|
+
cashData = self.safe_list(cash, 'data', [])
|
594
|
+
perpetualsData = self.safe_list(perpetuals, 'data', [])
|
595
595
|
cashAndPerpetualsData = self.array_concat(cashData, perpetualsData)
|
596
596
|
cashAndPerpetualsById = self.index_by(cashAndPerpetualsData, 'symbol')
|
597
597
|
dataById = self.deep_extend(productsById, cashAndPerpetualsById)
|
@@ -600,7 +600,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
600
600
|
for i in range(0, len(ids)):
|
601
601
|
id = ids[i]
|
602
602
|
market = dataById[id]
|
603
|
-
settleId = self.
|
603
|
+
settleId = self.safe_string(market, 'settlementAsset')
|
604
604
|
settle = self.safe_currency_code(settleId)
|
605
605
|
status = self.safe_string(market, 'status')
|
606
606
|
domain = self.safe_string(market, 'domain')
|
@@ -622,10 +622,10 @@ class ascendex(Exchange, ImplicitAPI):
|
|
622
622
|
quote = self.safe_currency_code(quoteId)
|
623
623
|
symbol = base + '/' + quote
|
624
624
|
if swap:
|
625
|
-
lotSizeFilter = self.
|
625
|
+
lotSizeFilter = self.safe_dict(market, 'lotSizeFilter')
|
626
626
|
minQty = self.safe_number(lotSizeFilter, 'minQty')
|
627
627
|
maxQty = self.safe_number(lotSizeFilter, 'maxQty')
|
628
|
-
priceFilter = self.
|
628
|
+
priceFilter = self.safe_dict(market, 'priceFilter')
|
629
629
|
minPrice = self.safe_number(priceFilter, 'minPrice')
|
630
630
|
maxPrice = self.safe_number(priceFilter, 'maxPrice')
|
631
631
|
symbol = base + '/' + quote + ':' + settle
|
@@ -704,7 +704,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
704
704
|
# }
|
705
705
|
# }
|
706
706
|
#
|
707
|
-
data = self.
|
707
|
+
data = self.safe_dict(response, 'data', {})
|
708
708
|
return self.safe_integer(data, 'requestReceiveAt')
|
709
709
|
|
710
710
|
def fetch_accounts(self, params={}) -> List[Account]:
|
@@ -733,7 +733,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
733
733
|
# }
|
734
734
|
# }
|
735
735
|
#
|
736
|
-
data = self.
|
736
|
+
data = self.safe_dict(response, 'data', {})
|
737
737
|
accountGroup = self.safe_string(data, 'accountGroup')
|
738
738
|
self.options['account-group'] = accountGroup
|
739
739
|
return [
|
@@ -751,7 +751,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
751
751
|
'timestamp': None,
|
752
752
|
'datetime': None,
|
753
753
|
}
|
754
|
-
balances = self.
|
754
|
+
balances = self.safe_list(response, 'data', [])
|
755
755
|
for i in range(0, len(balances)):
|
756
756
|
balance = balances[i]
|
757
757
|
code = self.safe_currency_code(self.safe_string(balance, 'asset'))
|
@@ -767,7 +767,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
767
767
|
'timestamp': None,
|
768
768
|
'datetime': None,
|
769
769
|
}
|
770
|
-
balances = self.
|
770
|
+
balances = self.safe_list(response, 'data', [])
|
771
771
|
for i in range(0, len(balances)):
|
772
772
|
balance = balances[i]
|
773
773
|
code = self.safe_currency_code(self.safe_string(balance, 'asset'))
|
@@ -786,8 +786,8 @@ class ascendex(Exchange, ImplicitAPI):
|
|
786
786
|
'timestamp': None,
|
787
787
|
'datetime': None,
|
788
788
|
}
|
789
|
-
data = self.
|
790
|
-
collaterals = self.
|
789
|
+
data = self.safe_dict(response, 'data', {})
|
790
|
+
collaterals = self.safe_list(data, 'collaterals', [])
|
791
791
|
for i in range(0, len(collaterals)):
|
792
792
|
balance = collaterals[i]
|
793
793
|
code = self.safe_currency_code(self.safe_string(balance, 'asset'))
|
@@ -817,9 +817,9 @@ class ascendex(Exchange, ImplicitAPI):
|
|
817
817
|
isCross = marginMode == 'cross'
|
818
818
|
marketType = 'margin' if (isMargin or isCross) else marketType
|
819
819
|
params = self.omit(params, 'margin')
|
820
|
-
accountsByType = self.
|
820
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
821
821
|
accountCategory = self.safe_string(accountsByType, marketType, 'cash')
|
822
|
-
account = self.
|
822
|
+
account = self.safe_dict(self.accounts, 0, {})
|
823
823
|
accountGroup = self.safe_string(account, 'id')
|
824
824
|
request: dict = {
|
825
825
|
'account-group': accountGroup,
|
@@ -922,8 +922,8 @@ class ascendex(Exchange, ImplicitAPI):
|
|
922
922
|
# }
|
923
923
|
# }
|
924
924
|
#
|
925
|
-
data = self.
|
926
|
-
orderbook = self.
|
925
|
+
data = self.safe_dict(response, 'data', {})
|
926
|
+
orderbook = self.safe_dict(data, 'data', {})
|
927
927
|
timestamp = self.safe_integer(orderbook, 'ts')
|
928
928
|
result = self.parse_order_book(orderbook, symbol, timestamp)
|
929
929
|
result['nonce'] = self.safe_integer(orderbook, 'seqnum')
|
@@ -949,8 +949,8 @@ class ascendex(Exchange, ImplicitAPI):
|
|
949
949
|
delimiter = '/' if (type == 'spot') else None
|
950
950
|
symbol = self.safe_symbol(marketId, market, delimiter)
|
951
951
|
close = self.safe_string(ticker, 'close')
|
952
|
-
bid = self.
|
953
|
-
ask = self.
|
952
|
+
bid = self.safe_list(ticker, 'bid', [])
|
953
|
+
ask = self.safe_list(ticker, 'ask', [])
|
954
954
|
open = self.safe_string(ticker, 'open')
|
955
955
|
return self.safe_ticker({
|
956
956
|
'symbol': symbol,
|
@@ -1020,7 +1020,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1020
1020
|
request: dict = {}
|
1021
1021
|
market = None
|
1022
1022
|
if symbols is not None:
|
1023
|
-
symbol = self.
|
1023
|
+
symbol = self.safe_string(symbols, 0)
|
1024
1024
|
market = self.market(symbol)
|
1025
1025
|
marketIds = self.market_ids(symbols)
|
1026
1026
|
request['symbol'] = ','.join(marketIds)
|
@@ -1034,22 +1034,20 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1034
1034
|
#
|
1035
1035
|
# {
|
1036
1036
|
# "code":0,
|
1037
|
-
# "data":
|
1038
|
-
#
|
1039
|
-
#
|
1040
|
-
#
|
1041
|
-
#
|
1042
|
-
#
|
1043
|
-
#
|
1044
|
-
#
|
1045
|
-
#
|
1046
|
-
#
|
1047
|
-
#
|
1048
|
-
# }
|
1049
|
-
# ]
|
1037
|
+
# "data": {
|
1038
|
+
# "symbol":"QTUM/BTC",
|
1039
|
+
# "open":"0.00016537",
|
1040
|
+
# "close":"0.00019077",
|
1041
|
+
# "high":"0.000192",
|
1042
|
+
# "low":"0.00016537",
|
1043
|
+
# "volume":"846.6",
|
1044
|
+
# "ask":["0.00018698","26.2"],
|
1045
|
+
# "bid":["0.00018408","503.7"],
|
1046
|
+
# "type":"spot"
|
1047
|
+
# }
|
1050
1048
|
# }
|
1051
1049
|
#
|
1052
|
-
data = self.
|
1050
|
+
data = self.safe_list(response, 'data', [])
|
1053
1051
|
if not isinstance(data, list):
|
1054
1052
|
return self.parse_tickers([data], symbols)
|
1055
1053
|
return self.parse_tickers(data, symbols)
|
@@ -1070,7 +1068,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1070
1068
|
# }
|
1071
1069
|
# }
|
1072
1070
|
#
|
1073
|
-
data = self.
|
1071
|
+
data = self.safe_dict(ohlcv, 'data', {})
|
1074
1072
|
return [
|
1075
1073
|
self.safe_integer(data, 'ts'),
|
1076
1074
|
self.safe_number(data, 'o'),
|
@@ -1099,7 +1097,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1099
1097
|
# if since and limit are not specified
|
1100
1098
|
# the exchange will return just 1 last candle by default
|
1101
1099
|
duration = self.parse_timeframe(timeframe)
|
1102
|
-
options = self.
|
1100
|
+
options = self.safe_dict(self.options, 'fetchOHLCV', {})
|
1103
1101
|
defaultLimit = self.safe_integer(options, 'limit', 500)
|
1104
1102
|
if since is not None:
|
1105
1103
|
request['from'] = since
|
@@ -1200,7 +1198,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1200
1198
|
# }
|
1201
1199
|
# }
|
1202
1200
|
#
|
1203
|
-
records = self.
|
1201
|
+
records = self.safe_dict(response, 'data', {})
|
1204
1202
|
trades = self.safe_list(records, 'data', [])
|
1205
1203
|
return self.parse_trades(trades, market, since, limit)
|
1206
1204
|
|
@@ -1395,7 +1393,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1395
1393
|
"""
|
1396
1394
|
self.load_markets()
|
1397
1395
|
self.load_accounts()
|
1398
|
-
account = self.
|
1396
|
+
account = self.safe_dict(self.accounts, 0, {})
|
1399
1397
|
accountGroup = self.safe_string(account, 'id')
|
1400
1398
|
request: dict = {
|
1401
1399
|
'account-group': accountGroup,
|
@@ -1417,14 +1415,14 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1417
1415
|
# }
|
1418
1416
|
# }
|
1419
1417
|
#
|
1420
|
-
data = self.
|
1421
|
-
fees = self.
|
1418
|
+
data = self.safe_dict(response, 'data', {})
|
1419
|
+
fees = self.safe_list(data, 'fees', [])
|
1422
1420
|
result: dict = {}
|
1423
1421
|
for i in range(0, len(fees)):
|
1424
1422
|
fee = fees[i]
|
1425
1423
|
marketId = self.safe_string(fee, 'symbol')
|
1426
1424
|
symbol = self.safe_symbol(marketId, None, '/')
|
1427
|
-
takerMaker = self.
|
1425
|
+
takerMaker = self.safe_dict(fee, 'fee', {})
|
1428
1426
|
result[symbol] = {
|
1429
1427
|
'info': fee,
|
1430
1428
|
'symbol': symbol,
|
@@ -1455,12 +1453,12 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1455
1453
|
marketType = None
|
1456
1454
|
marginMode, params = self.handle_margin_mode_and_params('createOrderRequest', params)
|
1457
1455
|
marketType, params = self.handle_market_type_and_params('createOrderRequest', market, params)
|
1458
|
-
accountsByType = self.
|
1456
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
1459
1457
|
accountCategory = self.safe_string(accountsByType, marketType, 'cash')
|
1460
1458
|
if marginMode is not None:
|
1461
1459
|
accountCategory = 'margin'
|
1462
|
-
account = self.
|
1463
|
-
accountGroup = self.
|
1460
|
+
account = self.safe_dict(self.accounts, 0, {})
|
1461
|
+
accountGroup = self.safe_string(account, 'id')
|
1464
1462
|
clientOrderId = self.safe_string_2(params, 'clientOrderId', 'id')
|
1465
1463
|
request: dict = {
|
1466
1464
|
'account-group': accountGroup,
|
@@ -1478,7 +1476,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1478
1476
|
timeInForce = self.safe_string(params, 'timeInForce')
|
1479
1477
|
postOnly = self.is_post_only(isMarketOrder, False, params)
|
1480
1478
|
reduceOnly = self.safe_bool(params, 'reduceOnly', False)
|
1481
|
-
stopPrice = self.
|
1479
|
+
stopPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
|
1482
1480
|
if isLimitOrder:
|
1483
1481
|
request['orderPrice'] = self.price_to_precision(symbol, price)
|
1484
1482
|
if timeInForce == 'IOC':
|
@@ -1599,8 +1597,8 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1599
1597
|
# }
|
1600
1598
|
# }
|
1601
1599
|
#
|
1602
|
-
data = self.
|
1603
|
-
order = self.
|
1600
|
+
data = self.safe_dict(response, 'data', {})
|
1601
|
+
order = self.safe_dict_2(data, 'order', 'info', {})
|
1604
1602
|
return self.parse_order(order, market)
|
1605
1603
|
|
1606
1604
|
def create_orders(self, orders: List[OrderRequest], params={}):
|
@@ -1630,9 +1628,9 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1630
1628
|
raise BadRequest(self.id + ' createOrders() requires all orders to have the same symbol')
|
1631
1629
|
type = self.safe_string(rawOrder, 'type')
|
1632
1630
|
side = self.safe_string(rawOrder, 'side')
|
1633
|
-
amount = self.
|
1634
|
-
price = self.
|
1635
|
-
orderParams = self.
|
1631
|
+
amount = self.safe_number(rawOrder, 'amount')
|
1632
|
+
price = self.safe_number(rawOrder, 'price')
|
1633
|
+
orderParams = self.safe_dict(rawOrder, 'params', {})
|
1636
1634
|
marginResult = self.handle_margin_mode_and_params('createOrders', orderParams)
|
1637
1635
|
currentMarginMode = marginResult[0]
|
1638
1636
|
if currentMarginMode is not None:
|
@@ -1644,12 +1642,12 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1644
1642
|
orderRequest = self.create_order_request(marketId, type, side, amount, price, orderParams)
|
1645
1643
|
ordersRequests.append(orderRequest)
|
1646
1644
|
market = self.market(symbol)
|
1647
|
-
accountsByType = self.
|
1645
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
1648
1646
|
accountCategory = self.safe_string(accountsByType, market['type'], 'cash')
|
1649
1647
|
if marginMode is not None:
|
1650
1648
|
accountCategory = 'margin'
|
1651
|
-
account = self.
|
1652
|
-
accountGroup = self.
|
1649
|
+
account = self.safe_dict(self.accounts, 0, {})
|
1650
|
+
accountGroup = self.safe_string(account, 'id')
|
1653
1651
|
request: dict = {}
|
1654
1652
|
response = None
|
1655
1653
|
if market['swap']:
|
@@ -1685,7 +1683,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1685
1683
|
# }
|
1686
1684
|
# }
|
1687
1685
|
#
|
1688
|
-
data = self.
|
1686
|
+
data = self.safe_dict(response, 'data', {})
|
1689
1687
|
info = self.safe_list(data, 'info', [])
|
1690
1688
|
return self.parse_orders(info, market)
|
1691
1689
|
|
@@ -1705,10 +1703,10 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1705
1703
|
if symbol is not None:
|
1706
1704
|
market = self.market(symbol)
|
1707
1705
|
type, query = self.handle_market_type_and_params('fetchOrder', market, params)
|
1708
|
-
accountsByType = self.
|
1706
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
1709
1707
|
accountCategory = self.safe_string(accountsByType, type, 'cash')
|
1710
|
-
account = self.
|
1711
|
-
accountGroup = self.
|
1708
|
+
account = self.safe_dict(self.accounts, 0, {})
|
1709
|
+
accountGroup = self.safe_string(account, 'id')
|
1712
1710
|
request: dict = {
|
1713
1711
|
'account-group': accountGroup,
|
1714
1712
|
'account-category': accountCategory,
|
@@ -1809,10 +1807,10 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1809
1807
|
if symbol is not None:
|
1810
1808
|
market = self.market(symbol)
|
1811
1809
|
symbol = market['symbol']
|
1812
|
-
account = self.
|
1813
|
-
accountGroup = self.
|
1810
|
+
account = self.safe_dict(self.accounts, 0, {})
|
1811
|
+
accountGroup = self.safe_string(account, 'id')
|
1814
1812
|
type, query = self.handle_market_type_and_params('fetchOpenOrders', market, params)
|
1815
|
-
accountsByType = self.
|
1813
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
1816
1814
|
accountCategory = self.safe_string(accountsByType, type, 'cash')
|
1817
1815
|
request: dict = {
|
1818
1816
|
'account-group': accountGroup,
|
@@ -1893,7 +1891,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1893
1891
|
# ]
|
1894
1892
|
# }
|
1895
1893
|
#
|
1896
|
-
data = self.
|
1894
|
+
data = self.safe_list(response, 'data', [])
|
1897
1895
|
if accountCategory == 'futures':
|
1898
1896
|
return self.parse_orders(data, market, since, limit)
|
1899
1897
|
# a workaround for https://github.com/ccxt/ccxt/issues/7187
|
@@ -1917,8 +1915,8 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1917
1915
|
"""
|
1918
1916
|
self.load_markets()
|
1919
1917
|
self.load_accounts()
|
1920
|
-
account = self.
|
1921
|
-
accountGroup = self.
|
1918
|
+
account = self.safe_dict(self.accounts, 0, {})
|
1919
|
+
accountGroup = self.safe_string(account, 'id')
|
1922
1920
|
request: dict = {
|
1923
1921
|
# 'category': accountCategory,
|
1924
1922
|
# 'symbol': market['id'],
|
@@ -1935,7 +1933,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1935
1933
|
market = self.market(symbol)
|
1936
1934
|
request['symbol'] = market['id']
|
1937
1935
|
type, query = self.handle_market_type_and_params('fetchClosedOrders', market, params)
|
1938
|
-
options = self.
|
1936
|
+
options = self.safe_dict(self.options, 'fetchClosedOrders', {})
|
1939
1937
|
defaultMethod = self.safe_string(options, 'method', 'v2PrivateDataGetOrderHist')
|
1940
1938
|
method = self.get_supported_mapping(type, {
|
1941
1939
|
'spot': defaultMethod,
|
@@ -1947,7 +1945,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1947
1945
|
until = self.safe_string(params, 'until')
|
1948
1946
|
if until is not None:
|
1949
1947
|
request['endTime'] = until
|
1950
|
-
accountsByType = self.
|
1948
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
1951
1949
|
accountCategory = self.safe_string(accountsByType, type, 'cash') # margin, futures
|
1952
1950
|
response = None
|
1953
1951
|
if method == 'v1PrivateAccountCategoryGetOrderHistCurrent':
|
@@ -2060,10 +2058,10 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2060
2058
|
# ]
|
2061
2059
|
# }
|
2062
2060
|
#
|
2063
|
-
data = self.
|
2061
|
+
data = self.safe_list(response, 'data', [])
|
2064
2062
|
isArray = isinstance(data, list)
|
2065
2063
|
if not isArray:
|
2066
|
-
data = self.
|
2064
|
+
data = self.safe_list(data, 'data', [])
|
2067
2065
|
return self.parse_orders(data, market, since, limit)
|
2068
2066
|
|
2069
2067
|
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
@@ -2082,10 +2080,10 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2082
2080
|
self.load_accounts()
|
2083
2081
|
market = self.market(symbol)
|
2084
2082
|
type, query = self.handle_market_type_and_params('cancelOrder', market, params)
|
2085
|
-
accountsByType = self.
|
2083
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
2086
2084
|
accountCategory = self.safe_string(accountsByType, type, 'cash')
|
2087
|
-
account = self.
|
2088
|
-
accountGroup = self.
|
2085
|
+
account = self.safe_dict(self.accounts, 0, {})
|
2086
|
+
accountGroup = self.safe_string(account, 'id')
|
2089
2087
|
request: dict = {
|
2090
2088
|
'account-group': accountGroup,
|
2091
2089
|
'account-category': accountCategory,
|
@@ -2170,8 +2168,8 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2170
2168
|
# }
|
2171
2169
|
# }
|
2172
2170
|
#
|
2173
|
-
data = self.
|
2174
|
-
order = self.
|
2171
|
+
data = self.safe_dict(response, 'data', {})
|
2172
|
+
order = self.safe_dict_2(data, 'order', 'info', {})
|
2175
2173
|
return self.parse_order(order, market)
|
2176
2174
|
|
2177
2175
|
def cancel_all_orders(self, symbol: Str = None, params={}):
|
@@ -2189,10 +2187,10 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2189
2187
|
if symbol is not None:
|
2190
2188
|
market = self.market(symbol)
|
2191
2189
|
type, query = self.handle_market_type_and_params('cancelAllOrders', market, params)
|
2192
|
-
accountsByType = self.
|
2190
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
2193
2191
|
accountCategory = self.safe_string(accountsByType, type, 'cash')
|
2194
|
-
account = self.
|
2195
|
-
accountGroup = self.
|
2192
|
+
account = self.safe_dict(self.accounts, 0, {})
|
2193
|
+
accountGroup = self.safe_string(account, 'id')
|
2196
2194
|
request: dict = {
|
2197
2195
|
'account-group': accountGroup,
|
2198
2196
|
'account-category': accountCategory,
|
@@ -2426,7 +2424,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2426
2424
|
# }
|
2427
2425
|
# }
|
2428
2426
|
#
|
2429
|
-
data = self.
|
2427
|
+
data = self.safe_dict(response, 'data', {})
|
2430
2428
|
transactions = self.safe_list(data, 'data', [])
|
2431
2429
|
return self.parse_transactions(transactions, currency, since, limit)
|
2432
2430
|
|
@@ -2458,7 +2456,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2458
2456
|
# }
|
2459
2457
|
# }
|
2460
2458
|
#
|
2461
|
-
destAddress = self.
|
2459
|
+
destAddress = self.safe_dict(transaction, 'destAddress', {})
|
2462
2460
|
address = self.safe_string(destAddress, 'address')
|
2463
2461
|
tag = self.safe_string(destAddress, 'destTag')
|
2464
2462
|
timestamp = self.safe_integer(transaction, 'time')
|
@@ -2503,7 +2501,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2503
2501
|
"""
|
2504
2502
|
self.load_markets()
|
2505
2503
|
self.load_accounts()
|
2506
|
-
account = self.
|
2504
|
+
account = self.safe_dict(self.accounts, 0, {})
|
2507
2505
|
accountGroup = self.safe_string(account, 'id')
|
2508
2506
|
request: dict = {
|
2509
2507
|
'account-group': accountGroup,
|
@@ -2548,8 +2546,8 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2548
2546
|
# }
|
2549
2547
|
# }
|
2550
2548
|
#
|
2551
|
-
data = self.
|
2552
|
-
position = self.
|
2549
|
+
data = self.safe_dict(response, 'data', {})
|
2550
|
+
position = self.safe_list(data, 'contracts', [])
|
2553
2551
|
result = []
|
2554
2552
|
for i in range(0, len(position)):
|
2555
2553
|
result.append(self.parse_position(position[i]))
|
@@ -2690,8 +2688,8 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2690
2688
|
# }
|
2691
2689
|
# }
|
2692
2690
|
#
|
2693
|
-
data = self.
|
2694
|
-
contracts = self.
|
2691
|
+
data = self.safe_dict(response, 'data', {})
|
2692
|
+
contracts = self.safe_list(data, 'contracts', [])
|
2695
2693
|
result = self.parse_funding_rates(contracts)
|
2696
2694
|
return self.filter_by_array(result, 'symbol', symbols)
|
2697
2695
|
|
@@ -2699,7 +2697,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2699
2697
|
self.load_markets()
|
2700
2698
|
self.load_accounts()
|
2701
2699
|
market = self.market(symbol)
|
2702
|
-
account = self.
|
2700
|
+
account = self.safe_dict(self.accounts, 0, {})
|
2703
2701
|
accountGroup = self.safe_string(account, 'id')
|
2704
2702
|
amount = self.amount_to_precision(symbol, amount)
|
2705
2703
|
request: dict = {
|
@@ -2783,7 +2781,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2783
2781
|
market = self.market(symbol)
|
2784
2782
|
if not market['swap']:
|
2785
2783
|
raise BadSymbol(self.id + ' setLeverage() supports swap contracts only')
|
2786
|
-
account = self.
|
2784
|
+
account = self.safe_dict(self.accounts, 0, {})
|
2787
2785
|
accountGroup = self.safe_string(account, 'id')
|
2788
2786
|
request: dict = {
|
2789
2787
|
'account-group': accountGroup,
|
@@ -2811,7 +2809,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2811
2809
|
self.load_markets()
|
2812
2810
|
self.load_accounts()
|
2813
2811
|
market = self.market(symbol)
|
2814
|
-
account = self.
|
2812
|
+
account = self.safe_dict(self.accounts, 0, {})
|
2815
2813
|
accountGroup = self.safe_string(account, 'id')
|
2816
2814
|
request: dict = {
|
2817
2815
|
'account-group': accountGroup,
|
@@ -2859,7 +2857,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2859
2857
|
# ]
|
2860
2858
|
# }
|
2861
2859
|
#
|
2862
|
-
data = self.
|
2860
|
+
data = self.safe_list(response, 'data', [])
|
2863
2861
|
symbols = self.market_symbols(symbols)
|
2864
2862
|
return self.parse_leverage_tiers(data, symbols, 'symbol')
|
2865
2863
|
|
@@ -2891,7 +2889,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2891
2889
|
# ]
|
2892
2890
|
# }
|
2893
2891
|
#
|
2894
|
-
marginRequirements = self.
|
2892
|
+
marginRequirements = self.safe_list(info, 'marginRequirements', [])
|
2895
2893
|
id = self.safe_string(info, 'symbol')
|
2896
2894
|
market = self.safe_market(id, market)
|
2897
2895
|
tiers = []
|
@@ -2929,7 +2927,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2929
2927
|
# ]
|
2930
2928
|
# }
|
2931
2929
|
#
|
2932
|
-
blockChains = self.
|
2930
|
+
blockChains = self.safe_list(fee, 'blockChain', [])
|
2933
2931
|
blockChainsLength = len(blockChains)
|
2934
2932
|
result: dict = {
|
2935
2933
|
'info': fee,
|
@@ -2982,10 +2980,10 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2982
2980
|
"""
|
2983
2981
|
self.load_markets()
|
2984
2982
|
self.load_accounts()
|
2985
|
-
account = self.
|
2983
|
+
account = self.safe_dict(self.accounts, 0, {})
|
2986
2984
|
accountGroup = self.safe_string(account, 'id')
|
2987
2985
|
currency = self.currency(code)
|
2988
|
-
accountsByType = self.
|
2986
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
2989
2987
|
fromId = self.safe_string(accountsByType, fromAccount, fromAccount)
|
2990
2988
|
toId = self.safe_string(accountsByType, toAccount, toAccount)
|
2991
2989
|
if fromId != 'cash' and toId != 'cash':
|
@@ -3001,7 +2999,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
3001
2999
|
#
|
3002
3000
|
# {"code": "0"}
|
3003
3001
|
#
|
3004
|
-
transferOptions = self.
|
3002
|
+
transferOptions = self.safe_dict(self.options, 'transfer', {})
|
3005
3003
|
fillResponseFromRequest = self.safe_bool(transferOptions, 'fillResponseFromRequest', True)
|
3006
3004
|
transfer = self.parse_transfer(response, currency)
|
3007
3005
|
if fillResponseFromRequest:
|
@@ -3051,7 +3049,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
3051
3049
|
paginate, params = self.handle_option_and_params(params, 'fetchFundingHistory', 'paginate')
|
3052
3050
|
if paginate:
|
3053
3051
|
return self.fetch_paginated_call_incremental('fetchFundingHistory', symbol, since, limit, params, 'page', 25)
|
3054
|
-
account = self.
|
3052
|
+
account = self.safe_dict(self.accounts, 0, {})
|
3055
3053
|
accountGroup = self.safe_string(account, 'id')
|
3056
3054
|
request: dict = {
|
3057
3055
|
'account-group': accountGroup,
|
@@ -3081,7 +3079,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
3081
3079
|
# }
|
3082
3080
|
# }
|
3083
3081
|
#
|
3084
|
-
data = self.
|
3082
|
+
data = self.safe_dict(response, 'data', {})
|
3085
3083
|
rows = self.safe_list(data, 'data', [])
|
3086
3084
|
return self.parse_incomes(rows, market, since, limit)
|
3087
3085
|
|
@@ -3116,7 +3114,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
3116
3114
|
"""
|
3117
3115
|
self.load_markets()
|
3118
3116
|
self.load_accounts()
|
3119
|
-
account = self.
|
3117
|
+
account = self.safe_dict(self.accounts, 0, {})
|
3120
3118
|
accountGroup = self.safe_string(account, 'id')
|
3121
3119
|
request: dict = {
|
3122
3120
|
'account-group': accountGroup,
|
@@ -3185,7 +3183,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
3185
3183
|
"""
|
3186
3184
|
self.load_markets()
|
3187
3185
|
self.load_accounts()
|
3188
|
-
account = self.
|
3186
|
+
account = self.safe_dict(self.accounts, 0, {})
|
3189
3187
|
accountGroup = self.safe_string(account, 'id')
|
3190
3188
|
request: dict = {
|
3191
3189
|
'account-group': accountGroup,
|
ccxt/async_support/__init__.py
CHANGED
ccxt/async_support/alpaca.py
CHANGED
@@ -553,8 +553,8 @@ class alpaca(Exchange, ImplicitAPI):
|
|
553
553
|
# }
|
554
554
|
# }
|
555
555
|
#
|
556
|
-
orderbooks = self.
|
557
|
-
rawOrderbook = self.
|
556
|
+
orderbooks = self.safe_dict(response, 'orderbooks', {})
|
557
|
+
rawOrderbook = self.safe_dict(orderbooks, id, {})
|
558
558
|
timestamp = self.parse8601(self.safe_string(rawOrderbook, 't'))
|
559
559
|
return self.parse_order_book(rawOrderbook, market['symbol'], timestamp, 'b', 'a', 'p', 's')
|
560
560
|
|