ccxt 4.3.88 → 4.3.90
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.
- package/README.md +3 -3
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ace.js +1 -0
- package/dist/cjs/src/alpaca.js +3 -2
- package/dist/cjs/src/ascendex.js +102 -116
- package/dist/cjs/src/bigone.js +1 -0
- package/dist/cjs/src/bingx.js +32 -17
- package/dist/cjs/src/bit2c.js +1 -0
- package/dist/cjs/src/bitbank.js +1 -0
- package/dist/cjs/src/bitfinex.js +1 -0
- package/dist/cjs/src/bitfinex2.js +21 -22
- package/dist/cjs/src/bitflyer.js +1 -0
- package/dist/cjs/src/bitget.js +3 -2
- package/dist/cjs/src/bitmart.js +6 -9
- package/dist/cjs/src/bitmex.js +1 -0
- package/dist/cjs/src/bitopro.js +1 -0
- package/dist/cjs/src/bitrue.js +62 -71
- package/dist/cjs/src/bitso.js +1 -0
- package/dist/cjs/src/bitstamp.js +1 -0
- package/dist/cjs/src/bitvavo.js +1 -0
- package/dist/cjs/src/blockchaincom.js +1 -0
- package/dist/cjs/src/btcalpha.js +1 -0
- package/dist/cjs/src/btcbox.js +1 -0
- package/dist/cjs/src/btcmarkets.js +1 -0
- package/dist/cjs/src/bybit.js +2 -0
- package/dist/cjs/src/cex.js +1 -0
- package/dist/cjs/src/coinbaseexchange.js +1 -0
- package/dist/cjs/src/coinbaseinternational.js +2 -1
- package/dist/cjs/src/coinex.js +1 -17
- package/dist/cjs/src/cryptocom.js +0 -12
- package/dist/cjs/src/hitbtc.js +1 -0
- package/dist/cjs/src/htx.js +49 -49
- package/dist/cjs/src/huobijp.js +0 -9
- package/dist/cjs/src/kraken.js +48 -48
- package/dist/cjs/src/latoken.js +1 -0
- package/dist/cjs/src/mexc.js +1 -61
- package/dist/cjs/src/okcoin.js +4 -9
- package/dist/cjs/src/okx.js +1 -8
- package/dist/cjs/src/onetrading.js +1 -0
- package/dist/cjs/src/phemex.js +1 -0
- package/dist/cjs/src/poloniexfutures.js +1 -0
- package/dist/cjs/src/pro/binance.js +323 -0
- package/dist/cjs/src/pro/bingx.js +263 -91
- package/dist/cjs/src/pro/bithumb.js +5 -1
- package/dist/cjs/src/pro/bitvavo.js +1 -0
- package/dist/cjs/src/pro/bybit.js +291 -2
- package/dist/cjs/src/pro/cex.js +1 -0
- package/dist/cjs/src/pro/coinex.js +994 -679
- package/dist/cjs/src/pro/lbank.js +2 -3
- package/dist/cjs/src/pro/okx.js +159 -3
- package/dist/cjs/src/probit.js +1 -0
- package/dist/cjs/src/vertex.js +1 -0
- package/dist/cjs/src/whitebit.js +5 -3
- package/dist/cjs/src/woo.js +1 -0
- package/dist/cjs/src/woofipro.js +1 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/ace.js +1 -0
- package/js/src/alpaca.js +3 -2
- package/js/src/ascendex.d.ts +0 -1
- package/js/src/ascendex.js +102 -116
- package/js/src/bigone.js +1 -0
- package/js/src/bingx.js +32 -17
- package/js/src/bit2c.js +1 -0
- package/js/src/bitbank.js +1 -0
- package/js/src/bitfinex.js +1 -0
- package/js/src/bitfinex2.d.ts +0 -1
- package/js/src/bitfinex2.js +21 -22
- package/js/src/bitflyer.js +1 -0
- package/js/src/bitget.js +3 -2
- package/js/src/bitmart.d.ts +0 -1
- package/js/src/bitmart.js +6 -9
- package/js/src/bitmex.js +1 -0
- package/js/src/bitopro.js +1 -0
- package/js/src/bitrue.d.ts +0 -1
- package/js/src/bitrue.js +62 -71
- package/js/src/bitso.js +1 -0
- package/js/src/bitstamp.js +1 -0
- package/js/src/bitvavo.js +1 -0
- package/js/src/blockchaincom.js +1 -0
- package/js/src/btcalpha.js +1 -0
- package/js/src/btcbox.js +1 -0
- package/js/src/btcmarkets.js +1 -0
- package/js/src/bybit.js +2 -0
- package/js/src/cex.js +1 -0
- package/js/src/coinbaseexchange.js +1 -0
- package/js/src/coinbaseinternational.js +2 -1
- package/js/src/coinex.d.ts +0 -2
- package/js/src/coinex.js +1 -17
- package/js/src/cryptocom.d.ts +0 -1
- package/js/src/cryptocom.js +0 -12
- package/js/src/hitbtc.js +1 -0
- package/js/src/htx.js +49 -49
- package/js/src/huobijp.d.ts +0 -1
- package/js/src/huobijp.js +0 -9
- package/js/src/kraken.js +48 -48
- package/js/src/latoken.js +1 -0
- package/js/src/mexc.js +1 -61
- package/js/src/okcoin.d.ts +0 -1
- package/js/src/okcoin.js +4 -9
- package/js/src/okx.d.ts +0 -1
- package/js/src/okx.js +1 -8
- package/js/src/onetrading.js +1 -0
- package/js/src/phemex.js +1 -0
- package/js/src/poloniexfutures.js +1 -0
- package/js/src/pro/binance.d.ts +9 -1
- package/js/src/pro/binance.js +327 -1
- package/js/src/pro/bingx.d.ts +2 -2
- package/js/src/pro/bingx.js +263 -91
- package/js/src/pro/bithumb.js +5 -1
- package/js/src/pro/bitvavo.js +1 -0
- package/js/src/pro/bybit.d.ts +12 -1
- package/js/src/pro/bybit.js +292 -3
- package/js/src/pro/cex.js +1 -0
- package/js/src/pro/coinex.d.ts +12 -6
- package/js/src/pro/coinex.js +996 -681
- package/js/src/pro/lbank.js +2 -3
- package/js/src/pro/okx.d.ts +7 -0
- package/js/src/pro/okx.js +162 -4
- package/js/src/probit.js +1 -0
- package/js/src/vertex.js +1 -0
- package/js/src/whitebit.js +5 -3
- package/js/src/woo.js +1 -0
- package/js/src/woofipro.js +1 -0
- package/package.json +1 -1
package/js/src/ascendex.js
CHANGED
|
@@ -285,26 +285,17 @@ export default class ascendex extends Exchange {
|
|
|
285
285
|
'SOL': 'Solana',
|
|
286
286
|
'AVAX': 'avalanche C chain',
|
|
287
287
|
'OMNI': 'Omni',
|
|
288
|
-
'TRC': 'TRC20',
|
|
288
|
+
// 'TRC': 'TRC20',
|
|
289
289
|
'TRX': 'TRC20',
|
|
290
|
-
'ERC': 'ERC20',
|
|
291
|
-
},
|
|
292
|
-
'networksById': {
|
|
293
|
-
'BEP20 (BSC)': 'BSC',
|
|
294
|
-
'arbitrum': 'ARB',
|
|
295
|
-
'Solana': 'SOL',
|
|
296
|
-
'avalanche C chain': 'AVAX',
|
|
297
|
-
'Omni': 'OMNI',
|
|
298
290
|
'TRC20': 'TRC20',
|
|
299
291
|
'ERC20': 'ERC20',
|
|
300
292
|
'GO20': 'GO20',
|
|
301
293
|
'BEP2': 'BEP2',
|
|
302
|
-
'
|
|
303
|
-
'
|
|
304
|
-
'
|
|
305
|
-
'
|
|
306
|
-
'
|
|
307
|
-
'Akash': 'AKT',
|
|
294
|
+
'BTC': 'Bitcoin',
|
|
295
|
+
'BCH': 'Bitcoin ABC',
|
|
296
|
+
'LTC': 'Litecoin',
|
|
297
|
+
'MATIC': 'Matic Network',
|
|
298
|
+
'AKT': 'Akash',
|
|
308
299
|
},
|
|
309
300
|
},
|
|
310
301
|
'exceptions': {
|
|
@@ -451,9 +442,9 @@ export default class ascendex extends Exchange {
|
|
|
451
442
|
// ]
|
|
452
443
|
// }
|
|
453
444
|
//
|
|
454
|
-
const assetsData = this.
|
|
455
|
-
const marginData = this.
|
|
456
|
-
const cashData = this.
|
|
445
|
+
const assetsData = this.safeList(assets, 'data', []);
|
|
446
|
+
const marginData = this.safeList(margin, 'data', []);
|
|
447
|
+
const cashData = this.safeList(cash, 'data', []);
|
|
457
448
|
const assetsById = this.indexBy(assetsData, 'assetCode');
|
|
458
449
|
const marginById = this.indexBy(marginData, 'assetCode');
|
|
459
450
|
const cashById = this.indexBy(cashData, 'assetCode');
|
|
@@ -594,10 +585,10 @@ export default class ascendex extends Exchange {
|
|
|
594
585
|
// ]
|
|
595
586
|
// }
|
|
596
587
|
//
|
|
597
|
-
const productsData = this.
|
|
588
|
+
const productsData = this.safeList(products, 'data', []);
|
|
598
589
|
const productsById = this.indexBy(productsData, 'symbol');
|
|
599
|
-
const cashData = this.
|
|
600
|
-
const perpetualsData = this.
|
|
590
|
+
const cashData = this.safeList(cash, 'data', []);
|
|
591
|
+
const perpetualsData = this.safeList(perpetuals, 'data', []);
|
|
601
592
|
const cashAndPerpetualsData = this.arrayConcat(cashData, perpetualsData);
|
|
602
593
|
const cashAndPerpetualsById = this.indexBy(cashAndPerpetualsData, 'symbol');
|
|
603
594
|
const dataById = this.deepExtend(productsById, cashAndPerpetualsById);
|
|
@@ -606,7 +597,7 @@ export default class ascendex extends Exchange {
|
|
|
606
597
|
for (let i = 0; i < ids.length; i++) {
|
|
607
598
|
const id = ids[i];
|
|
608
599
|
const market = dataById[id];
|
|
609
|
-
const settleId = this.
|
|
600
|
+
const settleId = this.safeString(market, 'settlementAsset');
|
|
610
601
|
const settle = this.safeCurrencyCode(settleId);
|
|
611
602
|
const status = this.safeString(market, 'status');
|
|
612
603
|
const domain = this.safeString(market, 'domain');
|
|
@@ -629,10 +620,10 @@ export default class ascendex extends Exchange {
|
|
|
629
620
|
const quote = this.safeCurrencyCode(quoteId);
|
|
630
621
|
let symbol = base + '/' + quote;
|
|
631
622
|
if (swap) {
|
|
632
|
-
const lotSizeFilter = this.
|
|
623
|
+
const lotSizeFilter = this.safeDict(market, 'lotSizeFilter');
|
|
633
624
|
minQty = this.safeNumber(lotSizeFilter, 'minQty');
|
|
634
625
|
maxQty = this.safeNumber(lotSizeFilter, 'maxQty');
|
|
635
|
-
const priceFilter = this.
|
|
626
|
+
const priceFilter = this.safeDict(market, 'priceFilter');
|
|
636
627
|
minPrice = this.safeNumber(priceFilter, 'minPrice');
|
|
637
628
|
maxPrice = this.safeNumber(priceFilter, 'maxPrice');
|
|
638
629
|
symbol = base + '/' + quote + ':' + settle;
|
|
@@ -715,7 +706,7 @@ export default class ascendex extends Exchange {
|
|
|
715
706
|
// }
|
|
716
707
|
// }
|
|
717
708
|
//
|
|
718
|
-
const data = this.
|
|
709
|
+
const data = this.safeDict(response, 'data', {});
|
|
719
710
|
return this.safeInteger(data, 'requestReceiveAt');
|
|
720
711
|
}
|
|
721
712
|
async fetchAccounts(params = {}) {
|
|
@@ -746,7 +737,7 @@ export default class ascendex extends Exchange {
|
|
|
746
737
|
// }
|
|
747
738
|
// }
|
|
748
739
|
//
|
|
749
|
-
const data = this.
|
|
740
|
+
const data = this.safeDict(response, 'data', {});
|
|
750
741
|
accountGroup = this.safeString(data, 'accountGroup');
|
|
751
742
|
this.options['account-group'] = accountGroup;
|
|
752
743
|
}
|
|
@@ -765,7 +756,7 @@ export default class ascendex extends Exchange {
|
|
|
765
756
|
'timestamp': undefined,
|
|
766
757
|
'datetime': undefined,
|
|
767
758
|
};
|
|
768
|
-
const balances = this.
|
|
759
|
+
const balances = this.safeList(response, 'data', []);
|
|
769
760
|
for (let i = 0; i < balances.length; i++) {
|
|
770
761
|
const balance = balances[i];
|
|
771
762
|
const code = this.safeCurrencyCode(this.safeString(balance, 'asset'));
|
|
@@ -782,7 +773,7 @@ export default class ascendex extends Exchange {
|
|
|
782
773
|
'timestamp': undefined,
|
|
783
774
|
'datetime': undefined,
|
|
784
775
|
};
|
|
785
|
-
const balances = this.
|
|
776
|
+
const balances = this.safeList(response, 'data', []);
|
|
786
777
|
for (let i = 0; i < balances.length; i++) {
|
|
787
778
|
const balance = balances[i];
|
|
788
779
|
const code = this.safeCurrencyCode(this.safeString(balance, 'asset'));
|
|
@@ -802,8 +793,8 @@ export default class ascendex extends Exchange {
|
|
|
802
793
|
'timestamp': undefined,
|
|
803
794
|
'datetime': undefined,
|
|
804
795
|
};
|
|
805
|
-
const data = this.
|
|
806
|
-
const collaterals = this.
|
|
796
|
+
const data = this.safeDict(response, 'data', {});
|
|
797
|
+
const collaterals = this.safeList(data, 'collaterals', []);
|
|
807
798
|
for (let i = 0; i < collaterals.length; i++) {
|
|
808
799
|
const balance = collaterals[i];
|
|
809
800
|
const code = this.safeCurrencyCode(this.safeString(balance, 'asset'));
|
|
@@ -836,9 +827,9 @@ export default class ascendex extends Exchange {
|
|
|
836
827
|
const isCross = marginMode === 'cross';
|
|
837
828
|
marketType = (isMargin || isCross) ? 'margin' : marketType;
|
|
838
829
|
params = this.omit(params, 'margin');
|
|
839
|
-
const accountsByType = this.
|
|
830
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
840
831
|
const accountCategory = this.safeString(accountsByType, marketType, 'cash');
|
|
841
|
-
const account = this.
|
|
832
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
842
833
|
const accountGroup = this.safeString(account, 'id');
|
|
843
834
|
const request = {
|
|
844
835
|
'account-group': accountGroup,
|
|
@@ -951,8 +942,8 @@ export default class ascendex extends Exchange {
|
|
|
951
942
|
// }
|
|
952
943
|
// }
|
|
953
944
|
//
|
|
954
|
-
const data = this.
|
|
955
|
-
const orderbook = this.
|
|
945
|
+
const data = this.safeDict(response, 'data', {});
|
|
946
|
+
const orderbook = this.safeDict(data, 'data', {});
|
|
956
947
|
const timestamp = this.safeInteger(orderbook, 'ts');
|
|
957
948
|
const result = this.parseOrderBook(orderbook, symbol, timestamp);
|
|
958
949
|
result['nonce'] = this.safeInteger(orderbook, 'seqnum');
|
|
@@ -978,8 +969,8 @@ export default class ascendex extends Exchange {
|
|
|
978
969
|
const delimiter = (type === 'spot') ? '/' : undefined;
|
|
979
970
|
const symbol = this.safeSymbol(marketId, market, delimiter);
|
|
980
971
|
const close = this.safeString(ticker, 'close');
|
|
981
|
-
const bid = this.
|
|
982
|
-
const ask = this.
|
|
972
|
+
const bid = this.safeList(ticker, 'bid', []);
|
|
973
|
+
const ask = this.safeList(ticker, 'ask', []);
|
|
983
974
|
const open = this.safeString(ticker, 'open');
|
|
984
975
|
return this.safeTicker({
|
|
985
976
|
'symbol': symbol,
|
|
@@ -1053,7 +1044,7 @@ export default class ascendex extends Exchange {
|
|
|
1053
1044
|
const request = {};
|
|
1054
1045
|
let market = undefined;
|
|
1055
1046
|
if (symbols !== undefined) {
|
|
1056
|
-
const symbol = this.
|
|
1047
|
+
const symbol = this.safeString(symbols, 0);
|
|
1057
1048
|
market = this.market(symbol);
|
|
1058
1049
|
const marketIds = this.marketIds(symbols);
|
|
1059
1050
|
request['symbol'] = marketIds.join(',');
|
|
@@ -1070,22 +1061,20 @@ export default class ascendex extends Exchange {
|
|
|
1070
1061
|
//
|
|
1071
1062
|
// {
|
|
1072
1063
|
// "code":0,
|
|
1073
|
-
// "data":
|
|
1074
|
-
//
|
|
1075
|
-
//
|
|
1076
|
-
//
|
|
1077
|
-
//
|
|
1078
|
-
//
|
|
1079
|
-
//
|
|
1080
|
-
//
|
|
1081
|
-
//
|
|
1082
|
-
//
|
|
1083
|
-
//
|
|
1084
|
-
// }
|
|
1085
|
-
// ]
|
|
1064
|
+
// "data": {
|
|
1065
|
+
// "symbol":"QTUM/BTC",
|
|
1066
|
+
// "open":"0.00016537",
|
|
1067
|
+
// "close":"0.00019077",
|
|
1068
|
+
// "high":"0.000192",
|
|
1069
|
+
// "low":"0.00016537",
|
|
1070
|
+
// "volume":"846.6",
|
|
1071
|
+
// "ask":["0.00018698","26.2"],
|
|
1072
|
+
// "bid":["0.00018408","503.7"],
|
|
1073
|
+
// "type":"spot"
|
|
1074
|
+
// }
|
|
1086
1075
|
// }
|
|
1087
1076
|
//
|
|
1088
|
-
const data = this.
|
|
1077
|
+
const data = this.safeList(response, 'data', []);
|
|
1089
1078
|
if (!Array.isArray(data)) {
|
|
1090
1079
|
return this.parseTickers([data], symbols);
|
|
1091
1080
|
}
|
|
@@ -1107,7 +1096,7 @@ export default class ascendex extends Exchange {
|
|
|
1107
1096
|
// }
|
|
1108
1097
|
// }
|
|
1109
1098
|
//
|
|
1110
|
-
const data = this.
|
|
1099
|
+
const data = this.safeDict(ohlcv, 'data', {});
|
|
1111
1100
|
return [
|
|
1112
1101
|
this.safeInteger(data, 'ts'),
|
|
1113
1102
|
this.safeNumber(data, 'o'),
|
|
@@ -1138,7 +1127,7 @@ export default class ascendex extends Exchange {
|
|
|
1138
1127
|
// if since and limit are not specified
|
|
1139
1128
|
// the exchange will return just 1 last candle by default
|
|
1140
1129
|
const duration = this.parseTimeframe(timeframe);
|
|
1141
|
-
const options = this.
|
|
1130
|
+
const options = this.safeDict(this.options, 'fetchOHLCV', {});
|
|
1142
1131
|
const defaultLimit = this.safeInteger(options, 'limit', 500);
|
|
1143
1132
|
if (since !== undefined) {
|
|
1144
1133
|
request['from'] = since;
|
|
@@ -1246,7 +1235,7 @@ export default class ascendex extends Exchange {
|
|
|
1246
1235
|
// }
|
|
1247
1236
|
// }
|
|
1248
1237
|
//
|
|
1249
|
-
const records = this.
|
|
1238
|
+
const records = this.safeDict(response, 'data', {});
|
|
1250
1239
|
const trades = this.safeList(records, 'data', []);
|
|
1251
1240
|
return this.parseTrades(trades, market, since, limit);
|
|
1252
1241
|
}
|
|
@@ -1452,7 +1441,7 @@ export default class ascendex extends Exchange {
|
|
|
1452
1441
|
*/
|
|
1453
1442
|
await this.loadMarkets();
|
|
1454
1443
|
await this.loadAccounts();
|
|
1455
|
-
const account = this.
|
|
1444
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
1456
1445
|
const accountGroup = this.safeString(account, 'id');
|
|
1457
1446
|
const request = {
|
|
1458
1447
|
'account-group': accountGroup,
|
|
@@ -1474,14 +1463,14 @@ export default class ascendex extends Exchange {
|
|
|
1474
1463
|
// }
|
|
1475
1464
|
// }
|
|
1476
1465
|
//
|
|
1477
|
-
const data = this.
|
|
1478
|
-
const fees = this.
|
|
1466
|
+
const data = this.safeDict(response, 'data', {});
|
|
1467
|
+
const fees = this.safeList(data, 'fees', []);
|
|
1479
1468
|
const result = {};
|
|
1480
1469
|
for (let i = 0; i < fees.length; i++) {
|
|
1481
1470
|
const fee = fees[i];
|
|
1482
1471
|
const marketId = this.safeString(fee, 'symbol');
|
|
1483
1472
|
const symbol = this.safeSymbol(marketId, undefined, '/');
|
|
1484
|
-
const takerMaker = this.
|
|
1473
|
+
const takerMaker = this.safeDict(fee, 'fee', {});
|
|
1485
1474
|
result[symbol] = {
|
|
1486
1475
|
'info': fee,
|
|
1487
1476
|
'symbol': symbol,
|
|
@@ -1515,13 +1504,13 @@ export default class ascendex extends Exchange {
|
|
|
1515
1504
|
let marketType = undefined;
|
|
1516
1505
|
[marginMode, params] = this.handleMarginModeAndParams('createOrderRequest', params);
|
|
1517
1506
|
[marketType, params] = this.handleMarketTypeAndParams('createOrderRequest', market, params);
|
|
1518
|
-
const accountsByType = this.
|
|
1507
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
1519
1508
|
let accountCategory = this.safeString(accountsByType, marketType, 'cash');
|
|
1520
1509
|
if (marginMode !== undefined) {
|
|
1521
1510
|
accountCategory = 'margin';
|
|
1522
1511
|
}
|
|
1523
|
-
const account = this.
|
|
1524
|
-
const accountGroup = this.
|
|
1512
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
1513
|
+
const accountGroup = this.safeString(account, 'id');
|
|
1525
1514
|
const clientOrderId = this.safeString2(params, 'clientOrderId', 'id');
|
|
1526
1515
|
const request = {
|
|
1527
1516
|
'account-group': accountGroup,
|
|
@@ -1539,7 +1528,7 @@ export default class ascendex extends Exchange {
|
|
|
1539
1528
|
const timeInForce = this.safeString(params, 'timeInForce');
|
|
1540
1529
|
const postOnly = this.isPostOnly(isMarketOrder, false, params);
|
|
1541
1530
|
const reduceOnly = this.safeBool(params, 'reduceOnly', false);
|
|
1542
|
-
const stopPrice = this.
|
|
1531
|
+
const stopPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
|
|
1543
1532
|
if (isLimitOrder) {
|
|
1544
1533
|
request['orderPrice'] = this.priceToPrecision(symbol, price);
|
|
1545
1534
|
}
|
|
@@ -1677,8 +1666,8 @@ export default class ascendex extends Exchange {
|
|
|
1677
1666
|
// }
|
|
1678
1667
|
// }
|
|
1679
1668
|
//
|
|
1680
|
-
const data = this.
|
|
1681
|
-
const order = this.
|
|
1669
|
+
const data = this.safeDict(response, 'data', {});
|
|
1670
|
+
const order = this.safeDict2(data, 'order', 'info', {});
|
|
1682
1671
|
return this.parseOrder(order, market);
|
|
1683
1672
|
}
|
|
1684
1673
|
async createOrders(orders, params = {}) {
|
|
@@ -1713,9 +1702,9 @@ export default class ascendex extends Exchange {
|
|
|
1713
1702
|
}
|
|
1714
1703
|
const type = this.safeString(rawOrder, 'type');
|
|
1715
1704
|
const side = this.safeString(rawOrder, 'side');
|
|
1716
|
-
const amount = this.
|
|
1717
|
-
const price = this.
|
|
1718
|
-
const orderParams = this.
|
|
1705
|
+
const amount = this.safeNumber(rawOrder, 'amount');
|
|
1706
|
+
const price = this.safeNumber(rawOrder, 'price');
|
|
1707
|
+
const orderParams = this.safeDict(rawOrder, 'params', {});
|
|
1719
1708
|
const marginResult = this.handleMarginModeAndParams('createOrders', orderParams);
|
|
1720
1709
|
const currentMarginMode = marginResult[0];
|
|
1721
1710
|
if (currentMarginMode !== undefined) {
|
|
@@ -1732,13 +1721,13 @@ export default class ascendex extends Exchange {
|
|
|
1732
1721
|
ordersRequests.push(orderRequest);
|
|
1733
1722
|
}
|
|
1734
1723
|
const market = this.market(symbol);
|
|
1735
|
-
const accountsByType = this.
|
|
1724
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
1736
1725
|
let accountCategory = this.safeString(accountsByType, market['type'], 'cash');
|
|
1737
1726
|
if (marginMode !== undefined) {
|
|
1738
1727
|
accountCategory = 'margin';
|
|
1739
1728
|
}
|
|
1740
|
-
const account = this.
|
|
1741
|
-
const accountGroup = this.
|
|
1729
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
1730
|
+
const accountGroup = this.safeString(account, 'id');
|
|
1742
1731
|
const request = {};
|
|
1743
1732
|
let response = undefined;
|
|
1744
1733
|
if (market['swap']) {
|
|
@@ -1776,7 +1765,7 @@ export default class ascendex extends Exchange {
|
|
|
1776
1765
|
// }
|
|
1777
1766
|
// }
|
|
1778
1767
|
//
|
|
1779
|
-
const data = this.
|
|
1768
|
+
const data = this.safeDict(response, 'data', {});
|
|
1780
1769
|
const info = this.safeList(data, 'info', []);
|
|
1781
1770
|
return this.parseOrders(info, market);
|
|
1782
1771
|
}
|
|
@@ -1787,6 +1776,7 @@ export default class ascendex extends Exchange {
|
|
|
1787
1776
|
* @description fetches information on an order made by the user
|
|
1788
1777
|
* @see https://ascendex.github.io/ascendex-pro-api/#query-order
|
|
1789
1778
|
* @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#query-order-by-id
|
|
1779
|
+
* @param {string} id the order id
|
|
1790
1780
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
1791
1781
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1792
1782
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -1798,10 +1788,10 @@ export default class ascendex extends Exchange {
|
|
|
1798
1788
|
market = this.market(symbol);
|
|
1799
1789
|
}
|
|
1800
1790
|
const [type, query] = this.handleMarketTypeAndParams('fetchOrder', market, params);
|
|
1801
|
-
const accountsByType = this.
|
|
1791
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
1802
1792
|
const accountCategory = this.safeString(accountsByType, type, 'cash');
|
|
1803
|
-
const account = this.
|
|
1804
|
-
const accountGroup = this.
|
|
1793
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
1794
|
+
const accountGroup = this.safeString(account, 'id');
|
|
1805
1795
|
const request = {
|
|
1806
1796
|
'account-group': accountGroup,
|
|
1807
1797
|
'account-category': accountCategory,
|
|
@@ -1908,10 +1898,10 @@ export default class ascendex extends Exchange {
|
|
|
1908
1898
|
market = this.market(symbol);
|
|
1909
1899
|
symbol = market['symbol'];
|
|
1910
1900
|
}
|
|
1911
|
-
const account = this.
|
|
1912
|
-
const accountGroup = this.
|
|
1901
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
1902
|
+
const accountGroup = this.safeString(account, 'id');
|
|
1913
1903
|
const [type, query] = this.handleMarketTypeAndParams('fetchOpenOrders', market, params);
|
|
1914
|
-
const accountsByType = this.
|
|
1904
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
1915
1905
|
const accountCategory = this.safeString(accountsByType, type, 'cash');
|
|
1916
1906
|
const request = {
|
|
1917
1907
|
'account-group': accountGroup,
|
|
@@ -1995,7 +1985,7 @@ export default class ascendex extends Exchange {
|
|
|
1995
1985
|
// ]
|
|
1996
1986
|
// }
|
|
1997
1987
|
//
|
|
1998
|
-
const data = this.
|
|
1988
|
+
const data = this.safeList(response, 'data', []);
|
|
1999
1989
|
if (accountCategory === 'futures') {
|
|
2000
1990
|
return this.parseOrders(data, market, since, limit);
|
|
2001
1991
|
}
|
|
@@ -2023,8 +2013,8 @@ export default class ascendex extends Exchange {
|
|
|
2023
2013
|
*/
|
|
2024
2014
|
await this.loadMarkets();
|
|
2025
2015
|
await this.loadAccounts();
|
|
2026
|
-
const account = this.
|
|
2027
|
-
const accountGroup = this.
|
|
2016
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
2017
|
+
const accountGroup = this.safeString(account, 'id');
|
|
2028
2018
|
const request = {
|
|
2029
2019
|
// 'category': accountCategory,
|
|
2030
2020
|
// 'symbol': market['id'],
|
|
@@ -2042,7 +2032,7 @@ export default class ascendex extends Exchange {
|
|
|
2042
2032
|
request['symbol'] = market['id'];
|
|
2043
2033
|
}
|
|
2044
2034
|
const [type, query] = this.handleMarketTypeAndParams('fetchClosedOrders', market, params);
|
|
2045
|
-
const options = this.
|
|
2035
|
+
const options = this.safeDict(this.options, 'fetchClosedOrders', {});
|
|
2046
2036
|
const defaultMethod = this.safeString(options, 'method', 'v2PrivateDataGetOrderHist');
|
|
2047
2037
|
const method = this.getSupportedMapping(type, {
|
|
2048
2038
|
'spot': defaultMethod,
|
|
@@ -2056,7 +2046,7 @@ export default class ascendex extends Exchange {
|
|
|
2056
2046
|
if (until !== undefined) {
|
|
2057
2047
|
request['endTime'] = until;
|
|
2058
2048
|
}
|
|
2059
|
-
const accountsByType = this.
|
|
2049
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
2060
2050
|
const accountCategory = this.safeString(accountsByType, type, 'cash'); // margin, futures
|
|
2061
2051
|
let response = undefined;
|
|
2062
2052
|
if (method === 'v1PrivateAccountCategoryGetOrderHistCurrent') {
|
|
@@ -2176,10 +2166,10 @@ export default class ascendex extends Exchange {
|
|
|
2176
2166
|
// ]
|
|
2177
2167
|
// }
|
|
2178
2168
|
//
|
|
2179
|
-
let data = this.
|
|
2169
|
+
let data = this.safeList(response, 'data', []);
|
|
2180
2170
|
const isArray = Array.isArray(data);
|
|
2181
2171
|
if (!isArray) {
|
|
2182
|
-
data = this.
|
|
2172
|
+
data = this.safeList(data, 'data', []);
|
|
2183
2173
|
}
|
|
2184
2174
|
return this.parseOrders(data, market, since, limit);
|
|
2185
2175
|
}
|
|
@@ -2202,10 +2192,10 @@ export default class ascendex extends Exchange {
|
|
|
2202
2192
|
await this.loadAccounts();
|
|
2203
2193
|
const market = this.market(symbol);
|
|
2204
2194
|
const [type, query] = this.handleMarketTypeAndParams('cancelOrder', market, params);
|
|
2205
|
-
const accountsByType = this.
|
|
2195
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
2206
2196
|
const accountCategory = this.safeString(accountsByType, type, 'cash');
|
|
2207
|
-
const account = this.
|
|
2208
|
-
const accountGroup = this.
|
|
2197
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
2198
|
+
const accountGroup = this.safeString(account, 'id');
|
|
2209
2199
|
const request = {
|
|
2210
2200
|
'account-group': accountGroup,
|
|
2211
2201
|
'account-category': accountCategory,
|
|
@@ -2295,8 +2285,8 @@ export default class ascendex extends Exchange {
|
|
|
2295
2285
|
// }
|
|
2296
2286
|
// }
|
|
2297
2287
|
//
|
|
2298
|
-
const data = this.
|
|
2299
|
-
const order = this.
|
|
2288
|
+
const data = this.safeDict(response, 'data', {});
|
|
2289
|
+
const order = this.safeDict2(data, 'order', 'info', {});
|
|
2300
2290
|
return this.parseOrder(order, market);
|
|
2301
2291
|
}
|
|
2302
2292
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
@@ -2317,10 +2307,10 @@ export default class ascendex extends Exchange {
|
|
|
2317
2307
|
market = this.market(symbol);
|
|
2318
2308
|
}
|
|
2319
2309
|
const [type, query] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
|
|
2320
|
-
const accountsByType = this.
|
|
2310
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
2321
2311
|
const accountCategory = this.safeString(accountsByType, type, 'cash');
|
|
2322
|
-
const account = this.
|
|
2323
|
-
const accountGroup = this.
|
|
2312
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
2313
|
+
const accountGroup = this.safeString(account, 'id');
|
|
2324
2314
|
const request = {
|
|
2325
2315
|
'account-group': accountGroup,
|
|
2326
2316
|
'account-category': accountCategory,
|
|
@@ -2407,10 +2397,6 @@ export default class ascendex extends Exchange {
|
|
|
2407
2397
|
'info': depositAddress,
|
|
2408
2398
|
};
|
|
2409
2399
|
}
|
|
2410
|
-
safeNetwork(networkId) {
|
|
2411
|
-
const networksById = this.safeDict(this.options, 'networksById');
|
|
2412
|
-
return this.safeString(networksById, networkId, networkId);
|
|
2413
|
-
}
|
|
2414
2400
|
async fetchDepositAddress(code, params = {}) {
|
|
2415
2401
|
/**
|
|
2416
2402
|
* @method
|
|
@@ -2576,7 +2562,7 @@ export default class ascendex extends Exchange {
|
|
|
2576
2562
|
// }
|
|
2577
2563
|
// }
|
|
2578
2564
|
//
|
|
2579
|
-
const data = this.
|
|
2565
|
+
const data = this.safeDict(response, 'data', {});
|
|
2580
2566
|
const transactions = this.safeList(data, 'data', []);
|
|
2581
2567
|
return this.parseTransactions(transactions, currency, since, limit);
|
|
2582
2568
|
}
|
|
@@ -2608,7 +2594,7 @@ export default class ascendex extends Exchange {
|
|
|
2608
2594
|
// }
|
|
2609
2595
|
// }
|
|
2610
2596
|
//
|
|
2611
|
-
const destAddress = this.
|
|
2597
|
+
const destAddress = this.safeDict(transaction, 'destAddress', {});
|
|
2612
2598
|
const address = this.safeString(destAddress, 'address');
|
|
2613
2599
|
const tag = this.safeString(destAddress, 'destTag');
|
|
2614
2600
|
const timestamp = this.safeInteger(transaction, 'time');
|
|
@@ -2655,7 +2641,7 @@ export default class ascendex extends Exchange {
|
|
|
2655
2641
|
*/
|
|
2656
2642
|
await this.loadMarkets();
|
|
2657
2643
|
await this.loadAccounts();
|
|
2658
|
-
const account = this.
|
|
2644
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
2659
2645
|
const accountGroup = this.safeString(account, 'id');
|
|
2660
2646
|
const request = {
|
|
2661
2647
|
'account-group': accountGroup,
|
|
@@ -2700,8 +2686,8 @@ export default class ascendex extends Exchange {
|
|
|
2700
2686
|
// }
|
|
2701
2687
|
// }
|
|
2702
2688
|
//
|
|
2703
|
-
const data = this.
|
|
2704
|
-
const position = this.
|
|
2689
|
+
const data = this.safeDict(response, 'data', {});
|
|
2690
|
+
const position = this.safeList(data, 'contracts', []);
|
|
2705
2691
|
const result = [];
|
|
2706
2692
|
for (let i = 0; i < position.length; i++) {
|
|
2707
2693
|
result.push(this.parsePosition(position[i]));
|
|
@@ -2847,8 +2833,8 @@ export default class ascendex extends Exchange {
|
|
|
2847
2833
|
// }
|
|
2848
2834
|
// }
|
|
2849
2835
|
//
|
|
2850
|
-
const data = this.
|
|
2851
|
-
const contracts = this.
|
|
2836
|
+
const data = this.safeDict(response, 'data', {});
|
|
2837
|
+
const contracts = this.safeList(data, 'contracts', []);
|
|
2852
2838
|
const result = this.parseFundingRates(contracts);
|
|
2853
2839
|
return this.filterByArray(result, 'symbol', symbols);
|
|
2854
2840
|
}
|
|
@@ -2856,7 +2842,7 @@ export default class ascendex extends Exchange {
|
|
|
2856
2842
|
await this.loadMarkets();
|
|
2857
2843
|
await this.loadAccounts();
|
|
2858
2844
|
const market = this.market(symbol);
|
|
2859
|
-
const account = this.
|
|
2845
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
2860
2846
|
const accountGroup = this.safeString(account, 'id');
|
|
2861
2847
|
amount = this.amountToPrecision(symbol, amount);
|
|
2862
2848
|
const request = {
|
|
@@ -2950,7 +2936,7 @@ export default class ascendex extends Exchange {
|
|
|
2950
2936
|
if (!market['swap']) {
|
|
2951
2937
|
throw new BadSymbol(this.id + ' setLeverage() supports swap contracts only');
|
|
2952
2938
|
}
|
|
2953
|
-
const account = this.
|
|
2939
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
2954
2940
|
const accountGroup = this.safeString(account, 'id');
|
|
2955
2941
|
const request = {
|
|
2956
2942
|
'account-group': accountGroup,
|
|
@@ -2983,7 +2969,7 @@ export default class ascendex extends Exchange {
|
|
|
2983
2969
|
await this.loadMarkets();
|
|
2984
2970
|
await this.loadAccounts();
|
|
2985
2971
|
const market = this.market(symbol);
|
|
2986
|
-
const account = this.
|
|
2972
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
2987
2973
|
const accountGroup = this.safeString(account, 'id');
|
|
2988
2974
|
const request = {
|
|
2989
2975
|
'account-group': accountGroup,
|
|
@@ -3034,7 +3020,7 @@ export default class ascendex extends Exchange {
|
|
|
3034
3020
|
// ]
|
|
3035
3021
|
// }
|
|
3036
3022
|
//
|
|
3037
|
-
const data = this.
|
|
3023
|
+
const data = this.safeList(response, 'data', []);
|
|
3038
3024
|
symbols = this.marketSymbols(symbols);
|
|
3039
3025
|
return this.parseLeverageTiers(data, symbols, 'symbol');
|
|
3040
3026
|
}
|
|
@@ -3066,7 +3052,7 @@ export default class ascendex extends Exchange {
|
|
|
3066
3052
|
// ]
|
|
3067
3053
|
// }
|
|
3068
3054
|
//
|
|
3069
|
-
const marginRequirements = this.
|
|
3055
|
+
const marginRequirements = this.safeList(info, 'marginRequirements', []);
|
|
3070
3056
|
const id = this.safeString(info, 'symbol');
|
|
3071
3057
|
market = this.safeMarket(id, market);
|
|
3072
3058
|
const tiers = [];
|
|
@@ -3105,7 +3091,7 @@ export default class ascendex extends Exchange {
|
|
|
3105
3091
|
// ]
|
|
3106
3092
|
// }
|
|
3107
3093
|
//
|
|
3108
|
-
const blockChains = this.
|
|
3094
|
+
const blockChains = this.safeList(fee, 'blockChain', []);
|
|
3109
3095
|
const blockChainsLength = blockChains.length;
|
|
3110
3096
|
const result = {
|
|
3111
3097
|
'info': fee,
|
|
@@ -3164,10 +3150,10 @@ export default class ascendex extends Exchange {
|
|
|
3164
3150
|
*/
|
|
3165
3151
|
await this.loadMarkets();
|
|
3166
3152
|
await this.loadAccounts();
|
|
3167
|
-
const account = this.
|
|
3153
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
3168
3154
|
const accountGroup = this.safeString(account, 'id');
|
|
3169
3155
|
const currency = this.currency(code);
|
|
3170
|
-
const accountsByType = this.
|
|
3156
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
3171
3157
|
const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
|
|
3172
3158
|
const toId = this.safeString(accountsByType, toAccount, toAccount);
|
|
3173
3159
|
if (fromId !== 'cash' && toId !== 'cash') {
|
|
@@ -3184,7 +3170,7 @@ export default class ascendex extends Exchange {
|
|
|
3184
3170
|
//
|
|
3185
3171
|
// { "code": "0" }
|
|
3186
3172
|
//
|
|
3187
|
-
const transferOptions = this.
|
|
3173
|
+
const transferOptions = this.safeDict(this.options, 'transfer', {});
|
|
3188
3174
|
const fillResponseFromRequest = this.safeBool(transferOptions, 'fillResponseFromRequest', true);
|
|
3189
3175
|
const transfer = this.parseTransfer(response, currency);
|
|
3190
3176
|
if (fillResponseFromRequest) {
|
|
@@ -3239,7 +3225,7 @@ export default class ascendex extends Exchange {
|
|
|
3239
3225
|
if (paginate) {
|
|
3240
3226
|
return await this.fetchPaginatedCallIncremental('fetchFundingHistory', symbol, since, limit, params, 'page', 25);
|
|
3241
3227
|
}
|
|
3242
|
-
const account = this.
|
|
3228
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
3243
3229
|
const accountGroup = this.safeString(account, 'id');
|
|
3244
3230
|
const request = {
|
|
3245
3231
|
'account-group': accountGroup,
|
|
@@ -3271,7 +3257,7 @@ export default class ascendex extends Exchange {
|
|
|
3271
3257
|
// }
|
|
3272
3258
|
// }
|
|
3273
3259
|
//
|
|
3274
|
-
const data = this.
|
|
3260
|
+
const data = this.safeDict(response, 'data', {});
|
|
3275
3261
|
const rows = this.safeList(data, 'data', []);
|
|
3276
3262
|
return this.parseIncomes(rows, market, since, limit);
|
|
3277
3263
|
}
|
|
@@ -3308,7 +3294,7 @@ export default class ascendex extends Exchange {
|
|
|
3308
3294
|
*/
|
|
3309
3295
|
await this.loadMarkets();
|
|
3310
3296
|
await this.loadAccounts();
|
|
3311
|
-
const account = this.
|
|
3297
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
3312
3298
|
const accountGroup = this.safeString(account, 'id');
|
|
3313
3299
|
const request = {
|
|
3314
3300
|
'account-group': accountGroup,
|
|
@@ -3379,7 +3365,7 @@ export default class ascendex extends Exchange {
|
|
|
3379
3365
|
*/
|
|
3380
3366
|
await this.loadMarkets();
|
|
3381
3367
|
await this.loadAccounts();
|
|
3382
|
-
const account = this.
|
|
3368
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
3383
3369
|
const accountGroup = this.safeString(account, 'id');
|
|
3384
3370
|
const request = {
|
|
3385
3371
|
'account-group': accountGroup,
|
package/js/src/bigone.js
CHANGED
|
@@ -1652,6 +1652,7 @@ export default class bigone extends Exchange {
|
|
|
1652
1652
|
* @name bigone#fetchOrder
|
|
1653
1653
|
* @description fetches information on an order made by the user
|
|
1654
1654
|
* @see https://open.big.one/docs/spot_orders.html#get-one-order
|
|
1655
|
+
* @param {string} id the order id
|
|
1655
1656
|
* @param {string} symbol not used by bigone fetchOrder
|
|
1656
1657
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1657
1658
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|