ccxt 4.3.88__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/ace.py +1 -0
- ccxt/alpaca.py +3 -2
- ccxt/ascendex.py +102 -116
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ace.py +1 -0
- ccxt/async_support/alpaca.py +3 -2
- ccxt/async_support/ascendex.py +102 -116
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bigone.py +1 -0
- ccxt/async_support/bingx.py +30 -17
- ccxt/async_support/bit2c.py +1 -0
- ccxt/async_support/bitbank.py +1 -0
- ccxt/async_support/bitfinex.py +1 -0
- ccxt/async_support/bitfinex2.py +21 -22
- ccxt/async_support/bitflyer.py +1 -0
- ccxt/async_support/bitget.py +3 -2
- ccxt/async_support/bitmart.py +4 -8
- ccxt/async_support/bitmex.py +1 -0
- ccxt/async_support/bitopro.py +1 -0
- ccxt/async_support/bitrue.py +62 -71
- ccxt/async_support/bitso.py +1 -0
- ccxt/async_support/bitstamp.py +1 -0
- ccxt/async_support/bitvavo.py +1 -0
- ccxt/async_support/blockchaincom.py +1 -0
- ccxt/async_support/btcalpha.py +1 -0
- ccxt/async_support/btcbox.py +1 -0
- ccxt/async_support/btcmarkets.py +1 -0
- ccxt/async_support/bybit.py +2 -0
- ccxt/async_support/cex.py +1 -0
- ccxt/async_support/coinbaseexchange.py +1 -0
- ccxt/async_support/coinbaseinternational.py +2 -1
- ccxt/async_support/coinex.py +1 -16
- ccxt/async_support/cryptocom.py +0 -12
- ccxt/async_support/hitbtc.py +1 -0
- ccxt/async_support/huobijp.py +0 -8
- ccxt/async_support/kraken.py +48 -48
- ccxt/async_support/latoken.py +1 -0
- ccxt/async_support/mexc.py +1 -61
- ccxt/async_support/okcoin.py +4 -9
- ccxt/async_support/okx.py +1 -8
- ccxt/async_support/onetrading.py +1 -0
- ccxt/async_support/phemex.py +1 -0
- ccxt/async_support/poloniexfutures.py +1 -0
- ccxt/async_support/probit.py +1 -0
- ccxt/async_support/vertex.py +1 -0
- ccxt/async_support/whitebit.py +5 -3
- ccxt/async_support/woo.py +1 -0
- ccxt/async_support/woofipro.py +1 -0
- ccxt/base/exchange.py +6 -4
- ccxt/bigone.py +1 -0
- ccxt/bingx.py +30 -17
- ccxt/bit2c.py +1 -0
- ccxt/bitbank.py +1 -0
- ccxt/bitfinex.py +1 -0
- ccxt/bitfinex2.py +21 -22
- ccxt/bitflyer.py +1 -0
- ccxt/bitget.py +3 -2
- ccxt/bitmart.py +4 -8
- ccxt/bitmex.py +1 -0
- ccxt/bitopro.py +1 -0
- ccxt/bitrue.py +62 -71
- ccxt/bitso.py +1 -0
- ccxt/bitstamp.py +1 -0
- ccxt/bitvavo.py +1 -0
- ccxt/blockchaincom.py +1 -0
- ccxt/btcalpha.py +1 -0
- ccxt/btcbox.py +1 -0
- ccxt/btcmarkets.py +1 -0
- ccxt/bybit.py +2 -0
- ccxt/cex.py +1 -0
- ccxt/coinbaseexchange.py +1 -0
- ccxt/coinbaseinternational.py +2 -1
- ccxt/coinex.py +1 -16
- ccxt/cryptocom.py +0 -12
- ccxt/hitbtc.py +1 -0
- ccxt/huobijp.py +0 -8
- ccxt/kraken.py +48 -48
- ccxt/latoken.py +1 -0
- ccxt/mexc.py +1 -61
- ccxt/okcoin.py +4 -9
- ccxt/okx.py +1 -8
- ccxt/onetrading.py +1 -0
- ccxt/phemex.py +1 -0
- ccxt/poloniexfutures.py +1 -0
- 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/bitvavo.py +1 -0
- ccxt/pro/bybit.py +253 -2
- ccxt/pro/cex.py +1 -0
- ccxt/pro/coinex.py +941 -662
- ccxt/pro/lbank.py +1 -2
- ccxt/pro/okx.py +142 -2
- ccxt/probit.py +1 -0
- ccxt/vertex.py +1 -0
- ccxt/whitebit.py +5 -3
- ccxt/woo.py +1 -0
- ccxt/woofipro.py +1 -0
- {ccxt-4.3.88.dist-info → ccxt-4.3.90.dist-info}/METADATA +4 -4
- {ccxt-4.3.88.dist-info → ccxt-4.3.90.dist-info}/RECORD +105 -105
- {ccxt-4.3.88.dist-info → ccxt-4.3.90.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.3.88.dist-info → ccxt-4.3.90.dist-info}/WHEEL +0 -0
- {ccxt-4.3.88.dist-info → ccxt-4.3.90.dist-info}/top_level.txt +0 -0
ccxt/async_support/__init__.py
CHANGED
ccxt/async_support/ace.py
CHANGED
@@ -651,6 +651,7 @@ class ace(Exchange, ImplicitAPI):
|
|
651
651
|
"""
|
652
652
|
fetches information on an order made by the user
|
653
653
|
:see: https://github.com/ace-exchange/ace-official-api-docs/blob/master/api_v2.md#open-api---order-status
|
654
|
+
:param str id: the order id
|
654
655
|
:param str symbol: unified symbol of the market the order was made in
|
655
656
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
656
657
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
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
|
|
@@ -797,6 +797,7 @@ class alpaca(Exchange, ImplicitAPI):
|
|
797
797
|
"""
|
798
798
|
fetches information on an order made by the user
|
799
799
|
:see: https://docs.alpaca.markets/reference/getorderbyorderid
|
800
|
+
:param str id: the order id
|
800
801
|
:param str symbol: unified symbol of the market the order was made in
|
801
802
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
802
803
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
ccxt/async_support/ascendex.py
CHANGED
@@ -293,26 +293,17 @@ class ascendex(Exchange, ImplicitAPI):
|
|
293
293
|
'SOL': 'Solana',
|
294
294
|
'AVAX': 'avalanche C chain',
|
295
295
|
'OMNI': 'Omni',
|
296
|
-
'TRC': 'TRC20',
|
296
|
+
# 'TRC': 'TRC20',
|
297
297
|
'TRX': 'TRC20',
|
298
|
-
'ERC': 'ERC20',
|
299
|
-
},
|
300
|
-
'networksById': {
|
301
|
-
'BEP20(BSC)': 'BSC',
|
302
|
-
'arbitrum': 'ARB',
|
303
|
-
'Solana': 'SOL',
|
304
|
-
'avalanche C chain': 'AVAX',
|
305
|
-
'Omni': 'OMNI',
|
306
298
|
'TRC20': 'TRC20',
|
307
299
|
'ERC20': 'ERC20',
|
308
300
|
'GO20': 'GO20',
|
309
301
|
'BEP2': 'BEP2',
|
310
|
-
'
|
311
|
-
'
|
312
|
-
'
|
313
|
-
'
|
314
|
-
'
|
315
|
-
'Akash': 'AKT',
|
302
|
+
'BTC': 'Bitcoin',
|
303
|
+
'BCH': 'Bitcoin ABC',
|
304
|
+
'LTC': 'Litecoin',
|
305
|
+
'MATIC': 'Matic Network',
|
306
|
+
'AKT': 'Akash',
|
316
307
|
},
|
317
308
|
},
|
318
309
|
'exceptions': {
|
@@ -457,9 +448,9 @@ class ascendex(Exchange, ImplicitAPI):
|
|
457
448
|
# ]
|
458
449
|
# }
|
459
450
|
#
|
460
|
-
assetsData = self.
|
461
|
-
marginData = self.
|
462
|
-
cashData = self.
|
451
|
+
assetsData = self.safe_list(assets, 'data', [])
|
452
|
+
marginData = self.safe_list(margin, 'data', [])
|
453
|
+
cashData = self.safe_list(cash, 'data', [])
|
463
454
|
assetsById = self.index_by(assetsData, 'assetCode')
|
464
455
|
marginById = self.index_by(marginData, 'assetCode')
|
465
456
|
cashById = self.index_by(cashData, 'assetCode')
|
@@ -597,10 +588,10 @@ class ascendex(Exchange, ImplicitAPI):
|
|
597
588
|
# ]
|
598
589
|
# }
|
599
590
|
#
|
600
|
-
productsData = self.
|
591
|
+
productsData = self.safe_list(products, 'data', [])
|
601
592
|
productsById = self.index_by(productsData, 'symbol')
|
602
|
-
cashData = self.
|
603
|
-
perpetualsData = self.
|
593
|
+
cashData = self.safe_list(cash, 'data', [])
|
594
|
+
perpetualsData = self.safe_list(perpetuals, 'data', [])
|
604
595
|
cashAndPerpetualsData = self.array_concat(cashData, perpetualsData)
|
605
596
|
cashAndPerpetualsById = self.index_by(cashAndPerpetualsData, 'symbol')
|
606
597
|
dataById = self.deep_extend(productsById, cashAndPerpetualsById)
|
@@ -609,7 +600,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
609
600
|
for i in range(0, len(ids)):
|
610
601
|
id = ids[i]
|
611
602
|
market = dataById[id]
|
612
|
-
settleId = self.
|
603
|
+
settleId = self.safe_string(market, 'settlementAsset')
|
613
604
|
settle = self.safe_currency_code(settleId)
|
614
605
|
status = self.safe_string(market, 'status')
|
615
606
|
domain = self.safe_string(market, 'domain')
|
@@ -631,10 +622,10 @@ class ascendex(Exchange, ImplicitAPI):
|
|
631
622
|
quote = self.safe_currency_code(quoteId)
|
632
623
|
symbol = base + '/' + quote
|
633
624
|
if swap:
|
634
|
-
lotSizeFilter = self.
|
625
|
+
lotSizeFilter = self.safe_dict(market, 'lotSizeFilter')
|
635
626
|
minQty = self.safe_number(lotSizeFilter, 'minQty')
|
636
627
|
maxQty = self.safe_number(lotSizeFilter, 'maxQty')
|
637
|
-
priceFilter = self.
|
628
|
+
priceFilter = self.safe_dict(market, 'priceFilter')
|
638
629
|
minPrice = self.safe_number(priceFilter, 'minPrice')
|
639
630
|
maxPrice = self.safe_number(priceFilter, 'maxPrice')
|
640
631
|
symbol = base + '/' + quote + ':' + settle
|
@@ -713,7 +704,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
713
704
|
# }
|
714
705
|
# }
|
715
706
|
#
|
716
|
-
data = self.
|
707
|
+
data = self.safe_dict(response, 'data', {})
|
717
708
|
return self.safe_integer(data, 'requestReceiveAt')
|
718
709
|
|
719
710
|
async def fetch_accounts(self, params={}) -> List[Account]:
|
@@ -742,7 +733,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
742
733
|
# }
|
743
734
|
# }
|
744
735
|
#
|
745
|
-
data = self.
|
736
|
+
data = self.safe_dict(response, 'data', {})
|
746
737
|
accountGroup = self.safe_string(data, 'accountGroup')
|
747
738
|
self.options['account-group'] = accountGroup
|
748
739
|
return [
|
@@ -760,7 +751,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
760
751
|
'timestamp': None,
|
761
752
|
'datetime': None,
|
762
753
|
}
|
763
|
-
balances = self.
|
754
|
+
balances = self.safe_list(response, 'data', [])
|
764
755
|
for i in range(0, len(balances)):
|
765
756
|
balance = balances[i]
|
766
757
|
code = self.safe_currency_code(self.safe_string(balance, 'asset'))
|
@@ -776,7 +767,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
776
767
|
'timestamp': None,
|
777
768
|
'datetime': None,
|
778
769
|
}
|
779
|
-
balances = self.
|
770
|
+
balances = self.safe_list(response, 'data', [])
|
780
771
|
for i in range(0, len(balances)):
|
781
772
|
balance = balances[i]
|
782
773
|
code = self.safe_currency_code(self.safe_string(balance, 'asset'))
|
@@ -795,8 +786,8 @@ class ascendex(Exchange, ImplicitAPI):
|
|
795
786
|
'timestamp': None,
|
796
787
|
'datetime': None,
|
797
788
|
}
|
798
|
-
data = self.
|
799
|
-
collaterals = self.
|
789
|
+
data = self.safe_dict(response, 'data', {})
|
790
|
+
collaterals = self.safe_list(data, 'collaterals', [])
|
800
791
|
for i in range(0, len(collaterals)):
|
801
792
|
balance = collaterals[i]
|
802
793
|
code = self.safe_currency_code(self.safe_string(balance, 'asset'))
|
@@ -826,9 +817,9 @@ class ascendex(Exchange, ImplicitAPI):
|
|
826
817
|
isCross = marginMode == 'cross'
|
827
818
|
marketType = 'margin' if (isMargin or isCross) else marketType
|
828
819
|
params = self.omit(params, 'margin')
|
829
|
-
accountsByType = self.
|
820
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
830
821
|
accountCategory = self.safe_string(accountsByType, marketType, 'cash')
|
831
|
-
account = self.
|
822
|
+
account = self.safe_dict(self.accounts, 0, {})
|
832
823
|
accountGroup = self.safe_string(account, 'id')
|
833
824
|
request: dict = {
|
834
825
|
'account-group': accountGroup,
|
@@ -931,8 +922,8 @@ class ascendex(Exchange, ImplicitAPI):
|
|
931
922
|
# }
|
932
923
|
# }
|
933
924
|
#
|
934
|
-
data = self.
|
935
|
-
orderbook = self.
|
925
|
+
data = self.safe_dict(response, 'data', {})
|
926
|
+
orderbook = self.safe_dict(data, 'data', {})
|
936
927
|
timestamp = self.safe_integer(orderbook, 'ts')
|
937
928
|
result = self.parse_order_book(orderbook, symbol, timestamp)
|
938
929
|
result['nonce'] = self.safe_integer(orderbook, 'seqnum')
|
@@ -958,8 +949,8 @@ class ascendex(Exchange, ImplicitAPI):
|
|
958
949
|
delimiter = '/' if (type == 'spot') else None
|
959
950
|
symbol = self.safe_symbol(marketId, market, delimiter)
|
960
951
|
close = self.safe_string(ticker, 'close')
|
961
|
-
bid = self.
|
962
|
-
ask = self.
|
952
|
+
bid = self.safe_list(ticker, 'bid', [])
|
953
|
+
ask = self.safe_list(ticker, 'ask', [])
|
963
954
|
open = self.safe_string(ticker, 'open')
|
964
955
|
return self.safe_ticker({
|
965
956
|
'symbol': symbol,
|
@@ -1029,7 +1020,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1029
1020
|
request: dict = {}
|
1030
1021
|
market = None
|
1031
1022
|
if symbols is not None:
|
1032
|
-
symbol = self.
|
1023
|
+
symbol = self.safe_string(symbols, 0)
|
1033
1024
|
market = self.market(symbol)
|
1034
1025
|
marketIds = self.market_ids(symbols)
|
1035
1026
|
request['symbol'] = ','.join(marketIds)
|
@@ -1043,22 +1034,20 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1043
1034
|
#
|
1044
1035
|
# {
|
1045
1036
|
# "code":0,
|
1046
|
-
# "data":
|
1047
|
-
#
|
1048
|
-
#
|
1049
|
-
#
|
1050
|
-
#
|
1051
|
-
#
|
1052
|
-
#
|
1053
|
-
#
|
1054
|
-
#
|
1055
|
-
#
|
1056
|
-
#
|
1057
|
-
# }
|
1058
|
-
# ]
|
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
|
+
# }
|
1059
1048
|
# }
|
1060
1049
|
#
|
1061
|
-
data = self.
|
1050
|
+
data = self.safe_list(response, 'data', [])
|
1062
1051
|
if not isinstance(data, list):
|
1063
1052
|
return self.parse_tickers([data], symbols)
|
1064
1053
|
return self.parse_tickers(data, symbols)
|
@@ -1079,7 +1068,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1079
1068
|
# }
|
1080
1069
|
# }
|
1081
1070
|
#
|
1082
|
-
data = self.
|
1071
|
+
data = self.safe_dict(ohlcv, 'data', {})
|
1083
1072
|
return [
|
1084
1073
|
self.safe_integer(data, 'ts'),
|
1085
1074
|
self.safe_number(data, 'o'),
|
@@ -1108,7 +1097,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1108
1097
|
# if since and limit are not specified
|
1109
1098
|
# the exchange will return just 1 last candle by default
|
1110
1099
|
duration = self.parse_timeframe(timeframe)
|
1111
|
-
options = self.
|
1100
|
+
options = self.safe_dict(self.options, 'fetchOHLCV', {})
|
1112
1101
|
defaultLimit = self.safe_integer(options, 'limit', 500)
|
1113
1102
|
if since is not None:
|
1114
1103
|
request['from'] = since
|
@@ -1209,7 +1198,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1209
1198
|
# }
|
1210
1199
|
# }
|
1211
1200
|
#
|
1212
|
-
records = self.
|
1201
|
+
records = self.safe_dict(response, 'data', {})
|
1213
1202
|
trades = self.safe_list(records, 'data', [])
|
1214
1203
|
return self.parse_trades(trades, market, since, limit)
|
1215
1204
|
|
@@ -1404,7 +1393,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1404
1393
|
"""
|
1405
1394
|
await self.load_markets()
|
1406
1395
|
await self.load_accounts()
|
1407
|
-
account = self.
|
1396
|
+
account = self.safe_dict(self.accounts, 0, {})
|
1408
1397
|
accountGroup = self.safe_string(account, 'id')
|
1409
1398
|
request: dict = {
|
1410
1399
|
'account-group': accountGroup,
|
@@ -1426,14 +1415,14 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1426
1415
|
# }
|
1427
1416
|
# }
|
1428
1417
|
#
|
1429
|
-
data = self.
|
1430
|
-
fees = self.
|
1418
|
+
data = self.safe_dict(response, 'data', {})
|
1419
|
+
fees = self.safe_list(data, 'fees', [])
|
1431
1420
|
result: dict = {}
|
1432
1421
|
for i in range(0, len(fees)):
|
1433
1422
|
fee = fees[i]
|
1434
1423
|
marketId = self.safe_string(fee, 'symbol')
|
1435
1424
|
symbol = self.safe_symbol(marketId, None, '/')
|
1436
|
-
takerMaker = self.
|
1425
|
+
takerMaker = self.safe_dict(fee, 'fee', {})
|
1437
1426
|
result[symbol] = {
|
1438
1427
|
'info': fee,
|
1439
1428
|
'symbol': symbol,
|
@@ -1464,12 +1453,12 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1464
1453
|
marketType = None
|
1465
1454
|
marginMode, params = self.handle_margin_mode_and_params('createOrderRequest', params)
|
1466
1455
|
marketType, params = self.handle_market_type_and_params('createOrderRequest', market, params)
|
1467
|
-
accountsByType = self.
|
1456
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
1468
1457
|
accountCategory = self.safe_string(accountsByType, marketType, 'cash')
|
1469
1458
|
if marginMode is not None:
|
1470
1459
|
accountCategory = 'margin'
|
1471
|
-
account = self.
|
1472
|
-
accountGroup = self.
|
1460
|
+
account = self.safe_dict(self.accounts, 0, {})
|
1461
|
+
accountGroup = self.safe_string(account, 'id')
|
1473
1462
|
clientOrderId = self.safe_string_2(params, 'clientOrderId', 'id')
|
1474
1463
|
request: dict = {
|
1475
1464
|
'account-group': accountGroup,
|
@@ -1487,7 +1476,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1487
1476
|
timeInForce = self.safe_string(params, 'timeInForce')
|
1488
1477
|
postOnly = self.is_post_only(isMarketOrder, False, params)
|
1489
1478
|
reduceOnly = self.safe_bool(params, 'reduceOnly', False)
|
1490
|
-
stopPrice = self.
|
1479
|
+
stopPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
|
1491
1480
|
if isLimitOrder:
|
1492
1481
|
request['orderPrice'] = self.price_to_precision(symbol, price)
|
1493
1482
|
if timeInForce == 'IOC':
|
@@ -1608,8 +1597,8 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1608
1597
|
# }
|
1609
1598
|
# }
|
1610
1599
|
#
|
1611
|
-
data = self.
|
1612
|
-
order = self.
|
1600
|
+
data = self.safe_dict(response, 'data', {})
|
1601
|
+
order = self.safe_dict_2(data, 'order', 'info', {})
|
1613
1602
|
return self.parse_order(order, market)
|
1614
1603
|
|
1615
1604
|
async def create_orders(self, orders: List[OrderRequest], params={}):
|
@@ -1639,9 +1628,9 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1639
1628
|
raise BadRequest(self.id + ' createOrders() requires all orders to have the same symbol')
|
1640
1629
|
type = self.safe_string(rawOrder, 'type')
|
1641
1630
|
side = self.safe_string(rawOrder, 'side')
|
1642
|
-
amount = self.
|
1643
|
-
price = self.
|
1644
|
-
orderParams = self.
|
1631
|
+
amount = self.safe_number(rawOrder, 'amount')
|
1632
|
+
price = self.safe_number(rawOrder, 'price')
|
1633
|
+
orderParams = self.safe_dict(rawOrder, 'params', {})
|
1645
1634
|
marginResult = self.handle_margin_mode_and_params('createOrders', orderParams)
|
1646
1635
|
currentMarginMode = marginResult[0]
|
1647
1636
|
if currentMarginMode is not None:
|
@@ -1653,12 +1642,12 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1653
1642
|
orderRequest = self.create_order_request(marketId, type, side, amount, price, orderParams)
|
1654
1643
|
ordersRequests.append(orderRequest)
|
1655
1644
|
market = self.market(symbol)
|
1656
|
-
accountsByType = self.
|
1645
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
1657
1646
|
accountCategory = self.safe_string(accountsByType, market['type'], 'cash')
|
1658
1647
|
if marginMode is not None:
|
1659
1648
|
accountCategory = 'margin'
|
1660
|
-
account = self.
|
1661
|
-
accountGroup = self.
|
1649
|
+
account = self.safe_dict(self.accounts, 0, {})
|
1650
|
+
accountGroup = self.safe_string(account, 'id')
|
1662
1651
|
request: dict = {}
|
1663
1652
|
response = None
|
1664
1653
|
if market['swap']:
|
@@ -1694,7 +1683,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1694
1683
|
# }
|
1695
1684
|
# }
|
1696
1685
|
#
|
1697
|
-
data = self.
|
1686
|
+
data = self.safe_dict(response, 'data', {})
|
1698
1687
|
info = self.safe_list(data, 'info', [])
|
1699
1688
|
return self.parse_orders(info, market)
|
1700
1689
|
|
@@ -1703,6 +1692,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1703
1692
|
fetches information on an order made by the user
|
1704
1693
|
:see: https://ascendex.github.io/ascendex-pro-api/#query-order
|
1705
1694
|
:see: https://ascendex.github.io/ascendex-futures-pro-api-v2/#query-order-by-id
|
1695
|
+
:param str id: the order id
|
1706
1696
|
:param str symbol: unified symbol of the market the order was made in
|
1707
1697
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1708
1698
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -1713,10 +1703,10 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1713
1703
|
if symbol is not None:
|
1714
1704
|
market = self.market(symbol)
|
1715
1705
|
type, query = self.handle_market_type_and_params('fetchOrder', market, params)
|
1716
|
-
accountsByType = self.
|
1706
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
1717
1707
|
accountCategory = self.safe_string(accountsByType, type, 'cash')
|
1718
|
-
account = self.
|
1719
|
-
accountGroup = self.
|
1708
|
+
account = self.safe_dict(self.accounts, 0, {})
|
1709
|
+
accountGroup = self.safe_string(account, 'id')
|
1720
1710
|
request: dict = {
|
1721
1711
|
'account-group': accountGroup,
|
1722
1712
|
'account-category': accountCategory,
|
@@ -1817,10 +1807,10 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1817
1807
|
if symbol is not None:
|
1818
1808
|
market = self.market(symbol)
|
1819
1809
|
symbol = market['symbol']
|
1820
|
-
account = self.
|
1821
|
-
accountGroup = self.
|
1810
|
+
account = self.safe_dict(self.accounts, 0, {})
|
1811
|
+
accountGroup = self.safe_string(account, 'id')
|
1822
1812
|
type, query = self.handle_market_type_and_params('fetchOpenOrders', market, params)
|
1823
|
-
accountsByType = self.
|
1813
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
1824
1814
|
accountCategory = self.safe_string(accountsByType, type, 'cash')
|
1825
1815
|
request: dict = {
|
1826
1816
|
'account-group': accountGroup,
|
@@ -1901,7 +1891,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1901
1891
|
# ]
|
1902
1892
|
# }
|
1903
1893
|
#
|
1904
|
-
data = self.
|
1894
|
+
data = self.safe_list(response, 'data', [])
|
1905
1895
|
if accountCategory == 'futures':
|
1906
1896
|
return self.parse_orders(data, market, since, limit)
|
1907
1897
|
# a workaround for https://github.com/ccxt/ccxt/issues/7187
|
@@ -1925,8 +1915,8 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1925
1915
|
"""
|
1926
1916
|
await self.load_markets()
|
1927
1917
|
await self.load_accounts()
|
1928
|
-
account = self.
|
1929
|
-
accountGroup = self.
|
1918
|
+
account = self.safe_dict(self.accounts, 0, {})
|
1919
|
+
accountGroup = self.safe_string(account, 'id')
|
1930
1920
|
request: dict = {
|
1931
1921
|
# 'category': accountCategory,
|
1932
1922
|
# 'symbol': market['id'],
|
@@ -1943,7 +1933,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1943
1933
|
market = self.market(symbol)
|
1944
1934
|
request['symbol'] = market['id']
|
1945
1935
|
type, query = self.handle_market_type_and_params('fetchClosedOrders', market, params)
|
1946
|
-
options = self.
|
1936
|
+
options = self.safe_dict(self.options, 'fetchClosedOrders', {})
|
1947
1937
|
defaultMethod = self.safe_string(options, 'method', 'v2PrivateDataGetOrderHist')
|
1948
1938
|
method = self.get_supported_mapping(type, {
|
1949
1939
|
'spot': defaultMethod,
|
@@ -1955,7 +1945,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
1955
1945
|
until = self.safe_string(params, 'until')
|
1956
1946
|
if until is not None:
|
1957
1947
|
request['endTime'] = until
|
1958
|
-
accountsByType = self.
|
1948
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
1959
1949
|
accountCategory = self.safe_string(accountsByType, type, 'cash') # margin, futures
|
1960
1950
|
response = None
|
1961
1951
|
if method == 'v1PrivateAccountCategoryGetOrderHistCurrent':
|
@@ -2068,10 +2058,10 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2068
2058
|
# ]
|
2069
2059
|
# }
|
2070
2060
|
#
|
2071
|
-
data = self.
|
2061
|
+
data = self.safe_list(response, 'data', [])
|
2072
2062
|
isArray = isinstance(data, list)
|
2073
2063
|
if not isArray:
|
2074
|
-
data = self.
|
2064
|
+
data = self.safe_list(data, 'data', [])
|
2075
2065
|
return self.parse_orders(data, market, since, limit)
|
2076
2066
|
|
2077
2067
|
async def cancel_order(self, id: str, symbol: Str = None, params={}):
|
@@ -2090,10 +2080,10 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2090
2080
|
await self.load_accounts()
|
2091
2081
|
market = self.market(symbol)
|
2092
2082
|
type, query = self.handle_market_type_and_params('cancelOrder', market, params)
|
2093
|
-
accountsByType = self.
|
2083
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
2094
2084
|
accountCategory = self.safe_string(accountsByType, type, 'cash')
|
2095
|
-
account = self.
|
2096
|
-
accountGroup = self.
|
2085
|
+
account = self.safe_dict(self.accounts, 0, {})
|
2086
|
+
accountGroup = self.safe_string(account, 'id')
|
2097
2087
|
request: dict = {
|
2098
2088
|
'account-group': accountGroup,
|
2099
2089
|
'account-category': accountCategory,
|
@@ -2178,8 +2168,8 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2178
2168
|
# }
|
2179
2169
|
# }
|
2180
2170
|
#
|
2181
|
-
data = self.
|
2182
|
-
order = self.
|
2171
|
+
data = self.safe_dict(response, 'data', {})
|
2172
|
+
order = self.safe_dict_2(data, 'order', 'info', {})
|
2183
2173
|
return self.parse_order(order, market)
|
2184
2174
|
|
2185
2175
|
async def cancel_all_orders(self, symbol: Str = None, params={}):
|
@@ -2197,10 +2187,10 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2197
2187
|
if symbol is not None:
|
2198
2188
|
market = self.market(symbol)
|
2199
2189
|
type, query = self.handle_market_type_and_params('cancelAllOrders', market, params)
|
2200
|
-
accountsByType = self.
|
2190
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
2201
2191
|
accountCategory = self.safe_string(accountsByType, type, 'cash')
|
2202
|
-
account = self.
|
2203
|
-
accountGroup = self.
|
2192
|
+
account = self.safe_dict(self.accounts, 0, {})
|
2193
|
+
accountGroup = self.safe_string(account, 'id')
|
2204
2194
|
request: dict = {
|
2205
2195
|
'account-group': accountGroup,
|
2206
2196
|
'account-category': accountCategory,
|
@@ -2283,10 +2273,6 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2283
2273
|
'info': depositAddress,
|
2284
2274
|
}
|
2285
2275
|
|
2286
|
-
def safe_network(self, networkId):
|
2287
|
-
networksById = self.safe_dict(self.options, 'networksById')
|
2288
|
-
return self.safe_string(networksById, networkId, networkId)
|
2289
|
-
|
2290
2276
|
async def fetch_deposit_address(self, code: str, params={}):
|
2291
2277
|
"""
|
2292
2278
|
fetch the deposit address for a currency associated with self account
|
@@ -2438,7 +2424,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2438
2424
|
# }
|
2439
2425
|
# }
|
2440
2426
|
#
|
2441
|
-
data = self.
|
2427
|
+
data = self.safe_dict(response, 'data', {})
|
2442
2428
|
transactions = self.safe_list(data, 'data', [])
|
2443
2429
|
return self.parse_transactions(transactions, currency, since, limit)
|
2444
2430
|
|
@@ -2470,7 +2456,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2470
2456
|
# }
|
2471
2457
|
# }
|
2472
2458
|
#
|
2473
|
-
destAddress = self.
|
2459
|
+
destAddress = self.safe_dict(transaction, 'destAddress', {})
|
2474
2460
|
address = self.safe_string(destAddress, 'address')
|
2475
2461
|
tag = self.safe_string(destAddress, 'destTag')
|
2476
2462
|
timestamp = self.safe_integer(transaction, 'time')
|
@@ -2515,7 +2501,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2515
2501
|
"""
|
2516
2502
|
await self.load_markets()
|
2517
2503
|
await self.load_accounts()
|
2518
|
-
account = self.
|
2504
|
+
account = self.safe_dict(self.accounts, 0, {})
|
2519
2505
|
accountGroup = self.safe_string(account, 'id')
|
2520
2506
|
request: dict = {
|
2521
2507
|
'account-group': accountGroup,
|
@@ -2560,8 +2546,8 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2560
2546
|
# }
|
2561
2547
|
# }
|
2562
2548
|
#
|
2563
|
-
data = self.
|
2564
|
-
position = self.
|
2549
|
+
data = self.safe_dict(response, 'data', {})
|
2550
|
+
position = self.safe_list(data, 'contracts', [])
|
2565
2551
|
result = []
|
2566
2552
|
for i in range(0, len(position)):
|
2567
2553
|
result.append(self.parse_position(position[i]))
|
@@ -2702,8 +2688,8 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2702
2688
|
# }
|
2703
2689
|
# }
|
2704
2690
|
#
|
2705
|
-
data = self.
|
2706
|
-
contracts = self.
|
2691
|
+
data = self.safe_dict(response, 'data', {})
|
2692
|
+
contracts = self.safe_list(data, 'contracts', [])
|
2707
2693
|
result = self.parse_funding_rates(contracts)
|
2708
2694
|
return self.filter_by_array(result, 'symbol', symbols)
|
2709
2695
|
|
@@ -2711,7 +2697,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2711
2697
|
await self.load_markets()
|
2712
2698
|
await self.load_accounts()
|
2713
2699
|
market = self.market(symbol)
|
2714
|
-
account = self.
|
2700
|
+
account = self.safe_dict(self.accounts, 0, {})
|
2715
2701
|
accountGroup = self.safe_string(account, 'id')
|
2716
2702
|
amount = self.amount_to_precision(symbol, amount)
|
2717
2703
|
request: dict = {
|
@@ -2795,7 +2781,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2795
2781
|
market = self.market(symbol)
|
2796
2782
|
if not market['swap']:
|
2797
2783
|
raise BadSymbol(self.id + ' setLeverage() supports swap contracts only')
|
2798
|
-
account = self.
|
2784
|
+
account = self.safe_dict(self.accounts, 0, {})
|
2799
2785
|
accountGroup = self.safe_string(account, 'id')
|
2800
2786
|
request: dict = {
|
2801
2787
|
'account-group': accountGroup,
|
@@ -2823,7 +2809,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2823
2809
|
await self.load_markets()
|
2824
2810
|
await self.load_accounts()
|
2825
2811
|
market = self.market(symbol)
|
2826
|
-
account = self.
|
2812
|
+
account = self.safe_dict(self.accounts, 0, {})
|
2827
2813
|
accountGroup = self.safe_string(account, 'id')
|
2828
2814
|
request: dict = {
|
2829
2815
|
'account-group': accountGroup,
|
@@ -2871,7 +2857,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2871
2857
|
# ]
|
2872
2858
|
# }
|
2873
2859
|
#
|
2874
|
-
data = self.
|
2860
|
+
data = self.safe_list(response, 'data', [])
|
2875
2861
|
symbols = self.market_symbols(symbols)
|
2876
2862
|
return self.parse_leverage_tiers(data, symbols, 'symbol')
|
2877
2863
|
|
@@ -2903,7 +2889,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2903
2889
|
# ]
|
2904
2890
|
# }
|
2905
2891
|
#
|
2906
|
-
marginRequirements = self.
|
2892
|
+
marginRequirements = self.safe_list(info, 'marginRequirements', [])
|
2907
2893
|
id = self.safe_string(info, 'symbol')
|
2908
2894
|
market = self.safe_market(id, market)
|
2909
2895
|
tiers = []
|
@@ -2941,7 +2927,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2941
2927
|
# ]
|
2942
2928
|
# }
|
2943
2929
|
#
|
2944
|
-
blockChains = self.
|
2930
|
+
blockChains = self.safe_list(fee, 'blockChain', [])
|
2945
2931
|
blockChainsLength = len(blockChains)
|
2946
2932
|
result: dict = {
|
2947
2933
|
'info': fee,
|
@@ -2994,10 +2980,10 @@ class ascendex(Exchange, ImplicitAPI):
|
|
2994
2980
|
"""
|
2995
2981
|
await self.load_markets()
|
2996
2982
|
await self.load_accounts()
|
2997
|
-
account = self.
|
2983
|
+
account = self.safe_dict(self.accounts, 0, {})
|
2998
2984
|
accountGroup = self.safe_string(account, 'id')
|
2999
2985
|
currency = self.currency(code)
|
3000
|
-
accountsByType = self.
|
2986
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
3001
2987
|
fromId = self.safe_string(accountsByType, fromAccount, fromAccount)
|
3002
2988
|
toId = self.safe_string(accountsByType, toAccount, toAccount)
|
3003
2989
|
if fromId != 'cash' and toId != 'cash':
|
@@ -3013,7 +2999,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
3013
2999
|
#
|
3014
3000
|
# {"code": "0"}
|
3015
3001
|
#
|
3016
|
-
transferOptions = self.
|
3002
|
+
transferOptions = self.safe_dict(self.options, 'transfer', {})
|
3017
3003
|
fillResponseFromRequest = self.safe_bool(transferOptions, 'fillResponseFromRequest', True)
|
3018
3004
|
transfer = self.parse_transfer(response, currency)
|
3019
3005
|
if fillResponseFromRequest:
|
@@ -3063,7 +3049,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
3063
3049
|
paginate, params = self.handle_option_and_params(params, 'fetchFundingHistory', 'paginate')
|
3064
3050
|
if paginate:
|
3065
3051
|
return await self.fetch_paginated_call_incremental('fetchFundingHistory', symbol, since, limit, params, 'page', 25)
|
3066
|
-
account = self.
|
3052
|
+
account = self.safe_dict(self.accounts, 0, {})
|
3067
3053
|
accountGroup = self.safe_string(account, 'id')
|
3068
3054
|
request: dict = {
|
3069
3055
|
'account-group': accountGroup,
|
@@ -3093,7 +3079,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
3093
3079
|
# }
|
3094
3080
|
# }
|
3095
3081
|
#
|
3096
|
-
data = self.
|
3082
|
+
data = self.safe_dict(response, 'data', {})
|
3097
3083
|
rows = self.safe_list(data, 'data', [])
|
3098
3084
|
return self.parse_incomes(rows, market, since, limit)
|
3099
3085
|
|
@@ -3128,7 +3114,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
3128
3114
|
"""
|
3129
3115
|
await self.load_markets()
|
3130
3116
|
await self.load_accounts()
|
3131
|
-
account = self.
|
3117
|
+
account = self.safe_dict(self.accounts, 0, {})
|
3132
3118
|
accountGroup = self.safe_string(account, 'id')
|
3133
3119
|
request: dict = {
|
3134
3120
|
'account-group': accountGroup,
|
@@ -3197,7 +3183,7 @@ class ascendex(Exchange, ImplicitAPI):
|
|
3197
3183
|
"""
|
3198
3184
|
await self.load_markets()
|
3199
3185
|
await self.load_accounts()
|
3200
|
-
account = self.
|
3186
|
+
account = self.safe_dict(self.accounts, 0, {})
|
3201
3187
|
accountGroup = self.safe_string(account, 'id')
|
3202
3188
|
request: dict = {
|
3203
3189
|
'account-group': accountGroup,
|