ccxt 4.3.89 → 4.3.91
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/alpaca.js +2 -2
- package/dist/cjs/src/ascendex.js +95 -97
- package/dist/cjs/src/binance.js +1 -1
- package/dist/cjs/src/bingx.js +31 -17
- package/dist/cjs/src/bitfinex2.js +21 -22
- package/dist/cjs/src/bitget.js +2 -2
- package/dist/cjs/src/bitmart.js +6 -9
- package/dist/cjs/src/coinbaseinternational.js +2 -1
- package/dist/cjs/src/coinex.js +1 -17
- package/dist/cjs/src/hitbtc.js +2 -0
- package/dist/cjs/src/htx.js +49 -49
- package/dist/cjs/src/huobijp.js +0 -9
- package/dist/cjs/src/kucoin.js +59 -21
- package/dist/cjs/src/kucoinfutures.js +26 -2
- package/dist/cjs/src/latoken.js +1 -0
- package/dist/cjs/src/okx.js +1 -8
- 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/bybit.js +1 -1
- 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/whitebit.js +5 -3
- package/dist/cjs/src/woo.js +1 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/kucoin.d.ts +1 -0
- package/js/src/abstract/kucoinfutures.d.ts +1 -0
- package/js/src/alpaca.js +2 -2
- package/js/src/ascendex.js +95 -97
- package/js/src/binance.js +1 -1
- package/js/src/bingx.js +31 -17
- package/js/src/bitfinex2.d.ts +0 -1
- package/js/src/bitfinex2.js +21 -22
- package/js/src/bitget.js +2 -2
- package/js/src/bitmart.d.ts +0 -1
- package/js/src/bitmart.js +6 -9
- 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/hitbtc.js +2 -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/kucoin.d.ts +3 -1
- package/js/src/kucoin.js +59 -21
- package/js/src/kucoinfutures.d.ts +1 -0
- package/js/src/kucoinfutures.js +26 -2
- package/js/src/latoken.js +1 -0
- package/js/src/okx.d.ts +0 -1
- package/js/src/okx.js +1 -8
- 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/bybit.js +1 -1
- 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/whitebit.js +5 -3
- package/js/src/woo.js +1 -1
- package/package.json +1 -1
package/js/src/ascendex.js
CHANGED
|
@@ -442,9 +442,9 @@ export default class ascendex extends Exchange {
|
|
|
442
442
|
// ]
|
|
443
443
|
// }
|
|
444
444
|
//
|
|
445
|
-
const assetsData = this.
|
|
446
|
-
const marginData = this.
|
|
447
|
-
const cashData = this.
|
|
445
|
+
const assetsData = this.safeList(assets, 'data', []);
|
|
446
|
+
const marginData = this.safeList(margin, 'data', []);
|
|
447
|
+
const cashData = this.safeList(cash, 'data', []);
|
|
448
448
|
const assetsById = this.indexBy(assetsData, 'assetCode');
|
|
449
449
|
const marginById = this.indexBy(marginData, 'assetCode');
|
|
450
450
|
const cashById = this.indexBy(cashData, 'assetCode');
|
|
@@ -585,10 +585,10 @@ export default class ascendex extends Exchange {
|
|
|
585
585
|
// ]
|
|
586
586
|
// }
|
|
587
587
|
//
|
|
588
|
-
const productsData = this.
|
|
588
|
+
const productsData = this.safeList(products, 'data', []);
|
|
589
589
|
const productsById = this.indexBy(productsData, 'symbol');
|
|
590
|
-
const cashData = this.
|
|
591
|
-
const perpetualsData = this.
|
|
590
|
+
const cashData = this.safeList(cash, 'data', []);
|
|
591
|
+
const perpetualsData = this.safeList(perpetuals, 'data', []);
|
|
592
592
|
const cashAndPerpetualsData = this.arrayConcat(cashData, perpetualsData);
|
|
593
593
|
const cashAndPerpetualsById = this.indexBy(cashAndPerpetualsData, 'symbol');
|
|
594
594
|
const dataById = this.deepExtend(productsById, cashAndPerpetualsById);
|
|
@@ -597,7 +597,7 @@ export default class ascendex extends Exchange {
|
|
|
597
597
|
for (let i = 0; i < ids.length; i++) {
|
|
598
598
|
const id = ids[i];
|
|
599
599
|
const market = dataById[id];
|
|
600
|
-
const settleId = this.
|
|
600
|
+
const settleId = this.safeString(market, 'settlementAsset');
|
|
601
601
|
const settle = this.safeCurrencyCode(settleId);
|
|
602
602
|
const status = this.safeString(market, 'status');
|
|
603
603
|
const domain = this.safeString(market, 'domain');
|
|
@@ -620,10 +620,10 @@ export default class ascendex extends Exchange {
|
|
|
620
620
|
const quote = this.safeCurrencyCode(quoteId);
|
|
621
621
|
let symbol = base + '/' + quote;
|
|
622
622
|
if (swap) {
|
|
623
|
-
const lotSizeFilter = this.
|
|
623
|
+
const lotSizeFilter = this.safeDict(market, 'lotSizeFilter');
|
|
624
624
|
minQty = this.safeNumber(lotSizeFilter, 'minQty');
|
|
625
625
|
maxQty = this.safeNumber(lotSizeFilter, 'maxQty');
|
|
626
|
-
const priceFilter = this.
|
|
626
|
+
const priceFilter = this.safeDict(market, 'priceFilter');
|
|
627
627
|
minPrice = this.safeNumber(priceFilter, 'minPrice');
|
|
628
628
|
maxPrice = this.safeNumber(priceFilter, 'maxPrice');
|
|
629
629
|
symbol = base + '/' + quote + ':' + settle;
|
|
@@ -706,7 +706,7 @@ export default class ascendex extends Exchange {
|
|
|
706
706
|
// }
|
|
707
707
|
// }
|
|
708
708
|
//
|
|
709
|
-
const data = this.
|
|
709
|
+
const data = this.safeDict(response, 'data', {});
|
|
710
710
|
return this.safeInteger(data, 'requestReceiveAt');
|
|
711
711
|
}
|
|
712
712
|
async fetchAccounts(params = {}) {
|
|
@@ -737,7 +737,7 @@ export default class ascendex extends Exchange {
|
|
|
737
737
|
// }
|
|
738
738
|
// }
|
|
739
739
|
//
|
|
740
|
-
const data = this.
|
|
740
|
+
const data = this.safeDict(response, 'data', {});
|
|
741
741
|
accountGroup = this.safeString(data, 'accountGroup');
|
|
742
742
|
this.options['account-group'] = accountGroup;
|
|
743
743
|
}
|
|
@@ -756,7 +756,7 @@ export default class ascendex extends Exchange {
|
|
|
756
756
|
'timestamp': undefined,
|
|
757
757
|
'datetime': undefined,
|
|
758
758
|
};
|
|
759
|
-
const balances = this.
|
|
759
|
+
const balances = this.safeList(response, 'data', []);
|
|
760
760
|
for (let i = 0; i < balances.length; i++) {
|
|
761
761
|
const balance = balances[i];
|
|
762
762
|
const code = this.safeCurrencyCode(this.safeString(balance, 'asset'));
|
|
@@ -773,7 +773,7 @@ export default class ascendex extends Exchange {
|
|
|
773
773
|
'timestamp': undefined,
|
|
774
774
|
'datetime': undefined,
|
|
775
775
|
};
|
|
776
|
-
const balances = this.
|
|
776
|
+
const balances = this.safeList(response, 'data', []);
|
|
777
777
|
for (let i = 0; i < balances.length; i++) {
|
|
778
778
|
const balance = balances[i];
|
|
779
779
|
const code = this.safeCurrencyCode(this.safeString(balance, 'asset'));
|
|
@@ -793,8 +793,8 @@ export default class ascendex extends Exchange {
|
|
|
793
793
|
'timestamp': undefined,
|
|
794
794
|
'datetime': undefined,
|
|
795
795
|
};
|
|
796
|
-
const data = this.
|
|
797
|
-
const collaterals = this.
|
|
796
|
+
const data = this.safeDict(response, 'data', {});
|
|
797
|
+
const collaterals = this.safeList(data, 'collaterals', []);
|
|
798
798
|
for (let i = 0; i < collaterals.length; i++) {
|
|
799
799
|
const balance = collaterals[i];
|
|
800
800
|
const code = this.safeCurrencyCode(this.safeString(balance, 'asset'));
|
|
@@ -827,9 +827,9 @@ export default class ascendex extends Exchange {
|
|
|
827
827
|
const isCross = marginMode === 'cross';
|
|
828
828
|
marketType = (isMargin || isCross) ? 'margin' : marketType;
|
|
829
829
|
params = this.omit(params, 'margin');
|
|
830
|
-
const accountsByType = this.
|
|
830
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
831
831
|
const accountCategory = this.safeString(accountsByType, marketType, 'cash');
|
|
832
|
-
const account = this.
|
|
832
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
833
833
|
const accountGroup = this.safeString(account, 'id');
|
|
834
834
|
const request = {
|
|
835
835
|
'account-group': accountGroup,
|
|
@@ -942,8 +942,8 @@ export default class ascendex extends Exchange {
|
|
|
942
942
|
// }
|
|
943
943
|
// }
|
|
944
944
|
//
|
|
945
|
-
const data = this.
|
|
946
|
-
const orderbook = this.
|
|
945
|
+
const data = this.safeDict(response, 'data', {});
|
|
946
|
+
const orderbook = this.safeDict(data, 'data', {});
|
|
947
947
|
const timestamp = this.safeInteger(orderbook, 'ts');
|
|
948
948
|
const result = this.parseOrderBook(orderbook, symbol, timestamp);
|
|
949
949
|
result['nonce'] = this.safeInteger(orderbook, 'seqnum');
|
|
@@ -969,8 +969,8 @@ export default class ascendex extends Exchange {
|
|
|
969
969
|
const delimiter = (type === 'spot') ? '/' : undefined;
|
|
970
970
|
const symbol = this.safeSymbol(marketId, market, delimiter);
|
|
971
971
|
const close = this.safeString(ticker, 'close');
|
|
972
|
-
const bid = this.
|
|
973
|
-
const ask = this.
|
|
972
|
+
const bid = this.safeList(ticker, 'bid', []);
|
|
973
|
+
const ask = this.safeList(ticker, 'ask', []);
|
|
974
974
|
const open = this.safeString(ticker, 'open');
|
|
975
975
|
return this.safeTicker({
|
|
976
976
|
'symbol': symbol,
|
|
@@ -1044,7 +1044,7 @@ export default class ascendex extends Exchange {
|
|
|
1044
1044
|
const request = {};
|
|
1045
1045
|
let market = undefined;
|
|
1046
1046
|
if (symbols !== undefined) {
|
|
1047
|
-
const symbol = this.
|
|
1047
|
+
const symbol = this.safeString(symbols, 0);
|
|
1048
1048
|
market = this.market(symbol);
|
|
1049
1049
|
const marketIds = this.marketIds(symbols);
|
|
1050
1050
|
request['symbol'] = marketIds.join(',');
|
|
@@ -1061,22 +1061,20 @@ export default class ascendex extends Exchange {
|
|
|
1061
1061
|
//
|
|
1062
1062
|
// {
|
|
1063
1063
|
// "code":0,
|
|
1064
|
-
// "data":
|
|
1065
|
-
//
|
|
1066
|
-
//
|
|
1067
|
-
//
|
|
1068
|
-
//
|
|
1069
|
-
//
|
|
1070
|
-
//
|
|
1071
|
-
//
|
|
1072
|
-
//
|
|
1073
|
-
//
|
|
1074
|
-
//
|
|
1075
|
-
// }
|
|
1076
|
-
// ]
|
|
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
|
+
// }
|
|
1077
1075
|
// }
|
|
1078
1076
|
//
|
|
1079
|
-
const data = this.
|
|
1077
|
+
const data = this.safeList(response, 'data', []);
|
|
1080
1078
|
if (!Array.isArray(data)) {
|
|
1081
1079
|
return this.parseTickers([data], symbols);
|
|
1082
1080
|
}
|
|
@@ -1098,7 +1096,7 @@ export default class ascendex extends Exchange {
|
|
|
1098
1096
|
// }
|
|
1099
1097
|
// }
|
|
1100
1098
|
//
|
|
1101
|
-
const data = this.
|
|
1099
|
+
const data = this.safeDict(ohlcv, 'data', {});
|
|
1102
1100
|
return [
|
|
1103
1101
|
this.safeInteger(data, 'ts'),
|
|
1104
1102
|
this.safeNumber(data, 'o'),
|
|
@@ -1129,7 +1127,7 @@ export default class ascendex extends Exchange {
|
|
|
1129
1127
|
// if since and limit are not specified
|
|
1130
1128
|
// the exchange will return just 1 last candle by default
|
|
1131
1129
|
const duration = this.parseTimeframe(timeframe);
|
|
1132
|
-
const options = this.
|
|
1130
|
+
const options = this.safeDict(this.options, 'fetchOHLCV', {});
|
|
1133
1131
|
const defaultLimit = this.safeInteger(options, 'limit', 500);
|
|
1134
1132
|
if (since !== undefined) {
|
|
1135
1133
|
request['from'] = since;
|
|
@@ -1237,7 +1235,7 @@ export default class ascendex extends Exchange {
|
|
|
1237
1235
|
// }
|
|
1238
1236
|
// }
|
|
1239
1237
|
//
|
|
1240
|
-
const records = this.
|
|
1238
|
+
const records = this.safeDict(response, 'data', {});
|
|
1241
1239
|
const trades = this.safeList(records, 'data', []);
|
|
1242
1240
|
return this.parseTrades(trades, market, since, limit);
|
|
1243
1241
|
}
|
|
@@ -1443,7 +1441,7 @@ export default class ascendex extends Exchange {
|
|
|
1443
1441
|
*/
|
|
1444
1442
|
await this.loadMarkets();
|
|
1445
1443
|
await this.loadAccounts();
|
|
1446
|
-
const account = this.
|
|
1444
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
1447
1445
|
const accountGroup = this.safeString(account, 'id');
|
|
1448
1446
|
const request = {
|
|
1449
1447
|
'account-group': accountGroup,
|
|
@@ -1465,14 +1463,14 @@ export default class ascendex extends Exchange {
|
|
|
1465
1463
|
// }
|
|
1466
1464
|
// }
|
|
1467
1465
|
//
|
|
1468
|
-
const data = this.
|
|
1469
|
-
const fees = this.
|
|
1466
|
+
const data = this.safeDict(response, 'data', {});
|
|
1467
|
+
const fees = this.safeList(data, 'fees', []);
|
|
1470
1468
|
const result = {};
|
|
1471
1469
|
for (let i = 0; i < fees.length; i++) {
|
|
1472
1470
|
const fee = fees[i];
|
|
1473
1471
|
const marketId = this.safeString(fee, 'symbol');
|
|
1474
1472
|
const symbol = this.safeSymbol(marketId, undefined, '/');
|
|
1475
|
-
const takerMaker = this.
|
|
1473
|
+
const takerMaker = this.safeDict(fee, 'fee', {});
|
|
1476
1474
|
result[symbol] = {
|
|
1477
1475
|
'info': fee,
|
|
1478
1476
|
'symbol': symbol,
|
|
@@ -1506,13 +1504,13 @@ export default class ascendex extends Exchange {
|
|
|
1506
1504
|
let marketType = undefined;
|
|
1507
1505
|
[marginMode, params] = this.handleMarginModeAndParams('createOrderRequest', params);
|
|
1508
1506
|
[marketType, params] = this.handleMarketTypeAndParams('createOrderRequest', market, params);
|
|
1509
|
-
const accountsByType = this.
|
|
1507
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
1510
1508
|
let accountCategory = this.safeString(accountsByType, marketType, 'cash');
|
|
1511
1509
|
if (marginMode !== undefined) {
|
|
1512
1510
|
accountCategory = 'margin';
|
|
1513
1511
|
}
|
|
1514
|
-
const account = this.
|
|
1515
|
-
const accountGroup = this.
|
|
1512
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
1513
|
+
const accountGroup = this.safeString(account, 'id');
|
|
1516
1514
|
const clientOrderId = this.safeString2(params, 'clientOrderId', 'id');
|
|
1517
1515
|
const request = {
|
|
1518
1516
|
'account-group': accountGroup,
|
|
@@ -1530,7 +1528,7 @@ export default class ascendex extends Exchange {
|
|
|
1530
1528
|
const timeInForce = this.safeString(params, 'timeInForce');
|
|
1531
1529
|
const postOnly = this.isPostOnly(isMarketOrder, false, params);
|
|
1532
1530
|
const reduceOnly = this.safeBool(params, 'reduceOnly', false);
|
|
1533
|
-
const stopPrice = this.
|
|
1531
|
+
const stopPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
|
|
1534
1532
|
if (isLimitOrder) {
|
|
1535
1533
|
request['orderPrice'] = this.priceToPrecision(symbol, price);
|
|
1536
1534
|
}
|
|
@@ -1668,8 +1666,8 @@ export default class ascendex extends Exchange {
|
|
|
1668
1666
|
// }
|
|
1669
1667
|
// }
|
|
1670
1668
|
//
|
|
1671
|
-
const data = this.
|
|
1672
|
-
const order = this.
|
|
1669
|
+
const data = this.safeDict(response, 'data', {});
|
|
1670
|
+
const order = this.safeDict2(data, 'order', 'info', {});
|
|
1673
1671
|
return this.parseOrder(order, market);
|
|
1674
1672
|
}
|
|
1675
1673
|
async createOrders(orders, params = {}) {
|
|
@@ -1704,9 +1702,9 @@ export default class ascendex extends Exchange {
|
|
|
1704
1702
|
}
|
|
1705
1703
|
const type = this.safeString(rawOrder, 'type');
|
|
1706
1704
|
const side = this.safeString(rawOrder, 'side');
|
|
1707
|
-
const amount = this.
|
|
1708
|
-
const price = this.
|
|
1709
|
-
const orderParams = this.
|
|
1705
|
+
const amount = this.safeNumber(rawOrder, 'amount');
|
|
1706
|
+
const price = this.safeNumber(rawOrder, 'price');
|
|
1707
|
+
const orderParams = this.safeDict(rawOrder, 'params', {});
|
|
1710
1708
|
const marginResult = this.handleMarginModeAndParams('createOrders', orderParams);
|
|
1711
1709
|
const currentMarginMode = marginResult[0];
|
|
1712
1710
|
if (currentMarginMode !== undefined) {
|
|
@@ -1723,13 +1721,13 @@ export default class ascendex extends Exchange {
|
|
|
1723
1721
|
ordersRequests.push(orderRequest);
|
|
1724
1722
|
}
|
|
1725
1723
|
const market = this.market(symbol);
|
|
1726
|
-
const accountsByType = this.
|
|
1724
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
1727
1725
|
let accountCategory = this.safeString(accountsByType, market['type'], 'cash');
|
|
1728
1726
|
if (marginMode !== undefined) {
|
|
1729
1727
|
accountCategory = 'margin';
|
|
1730
1728
|
}
|
|
1731
|
-
const account = this.
|
|
1732
|
-
const accountGroup = this.
|
|
1729
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
1730
|
+
const accountGroup = this.safeString(account, 'id');
|
|
1733
1731
|
const request = {};
|
|
1734
1732
|
let response = undefined;
|
|
1735
1733
|
if (market['swap']) {
|
|
@@ -1767,7 +1765,7 @@ export default class ascendex extends Exchange {
|
|
|
1767
1765
|
// }
|
|
1768
1766
|
// }
|
|
1769
1767
|
//
|
|
1770
|
-
const data = this.
|
|
1768
|
+
const data = this.safeDict(response, 'data', {});
|
|
1771
1769
|
const info = this.safeList(data, 'info', []);
|
|
1772
1770
|
return this.parseOrders(info, market);
|
|
1773
1771
|
}
|
|
@@ -1790,10 +1788,10 @@ export default class ascendex extends Exchange {
|
|
|
1790
1788
|
market = this.market(symbol);
|
|
1791
1789
|
}
|
|
1792
1790
|
const [type, query] = this.handleMarketTypeAndParams('fetchOrder', market, params);
|
|
1793
|
-
const accountsByType = this.
|
|
1791
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
1794
1792
|
const accountCategory = this.safeString(accountsByType, type, 'cash');
|
|
1795
|
-
const account = this.
|
|
1796
|
-
const accountGroup = this.
|
|
1793
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
1794
|
+
const accountGroup = this.safeString(account, 'id');
|
|
1797
1795
|
const request = {
|
|
1798
1796
|
'account-group': accountGroup,
|
|
1799
1797
|
'account-category': accountCategory,
|
|
@@ -1900,10 +1898,10 @@ export default class ascendex extends Exchange {
|
|
|
1900
1898
|
market = this.market(symbol);
|
|
1901
1899
|
symbol = market['symbol'];
|
|
1902
1900
|
}
|
|
1903
|
-
const account = this.
|
|
1904
|
-
const accountGroup = this.
|
|
1901
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
1902
|
+
const accountGroup = this.safeString(account, 'id');
|
|
1905
1903
|
const [type, query] = this.handleMarketTypeAndParams('fetchOpenOrders', market, params);
|
|
1906
|
-
const accountsByType = this.
|
|
1904
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
1907
1905
|
const accountCategory = this.safeString(accountsByType, type, 'cash');
|
|
1908
1906
|
const request = {
|
|
1909
1907
|
'account-group': accountGroup,
|
|
@@ -1987,7 +1985,7 @@ export default class ascendex extends Exchange {
|
|
|
1987
1985
|
// ]
|
|
1988
1986
|
// }
|
|
1989
1987
|
//
|
|
1990
|
-
const data = this.
|
|
1988
|
+
const data = this.safeList(response, 'data', []);
|
|
1991
1989
|
if (accountCategory === 'futures') {
|
|
1992
1990
|
return this.parseOrders(data, market, since, limit);
|
|
1993
1991
|
}
|
|
@@ -2015,8 +2013,8 @@ export default class ascendex extends Exchange {
|
|
|
2015
2013
|
*/
|
|
2016
2014
|
await this.loadMarkets();
|
|
2017
2015
|
await this.loadAccounts();
|
|
2018
|
-
const account = this.
|
|
2019
|
-
const accountGroup = this.
|
|
2016
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
2017
|
+
const accountGroup = this.safeString(account, 'id');
|
|
2020
2018
|
const request = {
|
|
2021
2019
|
// 'category': accountCategory,
|
|
2022
2020
|
// 'symbol': market['id'],
|
|
@@ -2034,7 +2032,7 @@ export default class ascendex extends Exchange {
|
|
|
2034
2032
|
request['symbol'] = market['id'];
|
|
2035
2033
|
}
|
|
2036
2034
|
const [type, query] = this.handleMarketTypeAndParams('fetchClosedOrders', market, params);
|
|
2037
|
-
const options = this.
|
|
2035
|
+
const options = this.safeDict(this.options, 'fetchClosedOrders', {});
|
|
2038
2036
|
const defaultMethod = this.safeString(options, 'method', 'v2PrivateDataGetOrderHist');
|
|
2039
2037
|
const method = this.getSupportedMapping(type, {
|
|
2040
2038
|
'spot': defaultMethod,
|
|
@@ -2048,7 +2046,7 @@ export default class ascendex extends Exchange {
|
|
|
2048
2046
|
if (until !== undefined) {
|
|
2049
2047
|
request['endTime'] = until;
|
|
2050
2048
|
}
|
|
2051
|
-
const accountsByType = this.
|
|
2049
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
2052
2050
|
const accountCategory = this.safeString(accountsByType, type, 'cash'); // margin, futures
|
|
2053
2051
|
let response = undefined;
|
|
2054
2052
|
if (method === 'v1PrivateAccountCategoryGetOrderHistCurrent') {
|
|
@@ -2168,10 +2166,10 @@ export default class ascendex extends Exchange {
|
|
|
2168
2166
|
// ]
|
|
2169
2167
|
// }
|
|
2170
2168
|
//
|
|
2171
|
-
let data = this.
|
|
2169
|
+
let data = this.safeList(response, 'data', []);
|
|
2172
2170
|
const isArray = Array.isArray(data);
|
|
2173
2171
|
if (!isArray) {
|
|
2174
|
-
data = this.
|
|
2172
|
+
data = this.safeList(data, 'data', []);
|
|
2175
2173
|
}
|
|
2176
2174
|
return this.parseOrders(data, market, since, limit);
|
|
2177
2175
|
}
|
|
@@ -2194,10 +2192,10 @@ export default class ascendex extends Exchange {
|
|
|
2194
2192
|
await this.loadAccounts();
|
|
2195
2193
|
const market = this.market(symbol);
|
|
2196
2194
|
const [type, query] = this.handleMarketTypeAndParams('cancelOrder', market, params);
|
|
2197
|
-
const accountsByType = this.
|
|
2195
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
2198
2196
|
const accountCategory = this.safeString(accountsByType, type, 'cash');
|
|
2199
|
-
const account = this.
|
|
2200
|
-
const accountGroup = this.
|
|
2197
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
2198
|
+
const accountGroup = this.safeString(account, 'id');
|
|
2201
2199
|
const request = {
|
|
2202
2200
|
'account-group': accountGroup,
|
|
2203
2201
|
'account-category': accountCategory,
|
|
@@ -2287,8 +2285,8 @@ export default class ascendex extends Exchange {
|
|
|
2287
2285
|
// }
|
|
2288
2286
|
// }
|
|
2289
2287
|
//
|
|
2290
|
-
const data = this.
|
|
2291
|
-
const order = this.
|
|
2288
|
+
const data = this.safeDict(response, 'data', {});
|
|
2289
|
+
const order = this.safeDict2(data, 'order', 'info', {});
|
|
2292
2290
|
return this.parseOrder(order, market);
|
|
2293
2291
|
}
|
|
2294
2292
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
@@ -2309,10 +2307,10 @@ export default class ascendex extends Exchange {
|
|
|
2309
2307
|
market = this.market(symbol);
|
|
2310
2308
|
}
|
|
2311
2309
|
const [type, query] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
|
|
2312
|
-
const accountsByType = this.
|
|
2310
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
2313
2311
|
const accountCategory = this.safeString(accountsByType, type, 'cash');
|
|
2314
|
-
const account = this.
|
|
2315
|
-
const accountGroup = this.
|
|
2312
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
2313
|
+
const accountGroup = this.safeString(account, 'id');
|
|
2316
2314
|
const request = {
|
|
2317
2315
|
'account-group': accountGroup,
|
|
2318
2316
|
'account-category': accountCategory,
|
|
@@ -2564,7 +2562,7 @@ export default class ascendex extends Exchange {
|
|
|
2564
2562
|
// }
|
|
2565
2563
|
// }
|
|
2566
2564
|
//
|
|
2567
|
-
const data = this.
|
|
2565
|
+
const data = this.safeDict(response, 'data', {});
|
|
2568
2566
|
const transactions = this.safeList(data, 'data', []);
|
|
2569
2567
|
return this.parseTransactions(transactions, currency, since, limit);
|
|
2570
2568
|
}
|
|
@@ -2596,7 +2594,7 @@ export default class ascendex extends Exchange {
|
|
|
2596
2594
|
// }
|
|
2597
2595
|
// }
|
|
2598
2596
|
//
|
|
2599
|
-
const destAddress = this.
|
|
2597
|
+
const destAddress = this.safeDict(transaction, 'destAddress', {});
|
|
2600
2598
|
const address = this.safeString(destAddress, 'address');
|
|
2601
2599
|
const tag = this.safeString(destAddress, 'destTag');
|
|
2602
2600
|
const timestamp = this.safeInteger(transaction, 'time');
|
|
@@ -2643,7 +2641,7 @@ export default class ascendex extends Exchange {
|
|
|
2643
2641
|
*/
|
|
2644
2642
|
await this.loadMarkets();
|
|
2645
2643
|
await this.loadAccounts();
|
|
2646
|
-
const account = this.
|
|
2644
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
2647
2645
|
const accountGroup = this.safeString(account, 'id');
|
|
2648
2646
|
const request = {
|
|
2649
2647
|
'account-group': accountGroup,
|
|
@@ -2688,8 +2686,8 @@ export default class ascendex extends Exchange {
|
|
|
2688
2686
|
// }
|
|
2689
2687
|
// }
|
|
2690
2688
|
//
|
|
2691
|
-
const data = this.
|
|
2692
|
-
const position = this.
|
|
2689
|
+
const data = this.safeDict(response, 'data', {});
|
|
2690
|
+
const position = this.safeList(data, 'contracts', []);
|
|
2693
2691
|
const result = [];
|
|
2694
2692
|
for (let i = 0; i < position.length; i++) {
|
|
2695
2693
|
result.push(this.parsePosition(position[i]));
|
|
@@ -2835,8 +2833,8 @@ export default class ascendex extends Exchange {
|
|
|
2835
2833
|
// }
|
|
2836
2834
|
// }
|
|
2837
2835
|
//
|
|
2838
|
-
const data = this.
|
|
2839
|
-
const contracts = this.
|
|
2836
|
+
const data = this.safeDict(response, 'data', {});
|
|
2837
|
+
const contracts = this.safeList(data, 'contracts', []);
|
|
2840
2838
|
const result = this.parseFundingRates(contracts);
|
|
2841
2839
|
return this.filterByArray(result, 'symbol', symbols);
|
|
2842
2840
|
}
|
|
@@ -2844,7 +2842,7 @@ export default class ascendex extends Exchange {
|
|
|
2844
2842
|
await this.loadMarkets();
|
|
2845
2843
|
await this.loadAccounts();
|
|
2846
2844
|
const market = this.market(symbol);
|
|
2847
|
-
const account = this.
|
|
2845
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
2848
2846
|
const accountGroup = this.safeString(account, 'id');
|
|
2849
2847
|
amount = this.amountToPrecision(symbol, amount);
|
|
2850
2848
|
const request = {
|
|
@@ -2938,7 +2936,7 @@ export default class ascendex extends Exchange {
|
|
|
2938
2936
|
if (!market['swap']) {
|
|
2939
2937
|
throw new BadSymbol(this.id + ' setLeverage() supports swap contracts only');
|
|
2940
2938
|
}
|
|
2941
|
-
const account = this.
|
|
2939
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
2942
2940
|
const accountGroup = this.safeString(account, 'id');
|
|
2943
2941
|
const request = {
|
|
2944
2942
|
'account-group': accountGroup,
|
|
@@ -2971,7 +2969,7 @@ export default class ascendex extends Exchange {
|
|
|
2971
2969
|
await this.loadMarkets();
|
|
2972
2970
|
await this.loadAccounts();
|
|
2973
2971
|
const market = this.market(symbol);
|
|
2974
|
-
const account = this.
|
|
2972
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
2975
2973
|
const accountGroup = this.safeString(account, 'id');
|
|
2976
2974
|
const request = {
|
|
2977
2975
|
'account-group': accountGroup,
|
|
@@ -3022,7 +3020,7 @@ export default class ascendex extends Exchange {
|
|
|
3022
3020
|
// ]
|
|
3023
3021
|
// }
|
|
3024
3022
|
//
|
|
3025
|
-
const data = this.
|
|
3023
|
+
const data = this.safeList(response, 'data', []);
|
|
3026
3024
|
symbols = this.marketSymbols(symbols);
|
|
3027
3025
|
return this.parseLeverageTiers(data, symbols, 'symbol');
|
|
3028
3026
|
}
|
|
@@ -3054,7 +3052,7 @@ export default class ascendex extends Exchange {
|
|
|
3054
3052
|
// ]
|
|
3055
3053
|
// }
|
|
3056
3054
|
//
|
|
3057
|
-
const marginRequirements = this.
|
|
3055
|
+
const marginRequirements = this.safeList(info, 'marginRequirements', []);
|
|
3058
3056
|
const id = this.safeString(info, 'symbol');
|
|
3059
3057
|
market = this.safeMarket(id, market);
|
|
3060
3058
|
const tiers = [];
|
|
@@ -3093,7 +3091,7 @@ export default class ascendex extends Exchange {
|
|
|
3093
3091
|
// ]
|
|
3094
3092
|
// }
|
|
3095
3093
|
//
|
|
3096
|
-
const blockChains = this.
|
|
3094
|
+
const blockChains = this.safeList(fee, 'blockChain', []);
|
|
3097
3095
|
const blockChainsLength = blockChains.length;
|
|
3098
3096
|
const result = {
|
|
3099
3097
|
'info': fee,
|
|
@@ -3152,10 +3150,10 @@ export default class ascendex extends Exchange {
|
|
|
3152
3150
|
*/
|
|
3153
3151
|
await this.loadMarkets();
|
|
3154
3152
|
await this.loadAccounts();
|
|
3155
|
-
const account = this.
|
|
3153
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
3156
3154
|
const accountGroup = this.safeString(account, 'id');
|
|
3157
3155
|
const currency = this.currency(code);
|
|
3158
|
-
const accountsByType = this.
|
|
3156
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
3159
3157
|
const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
|
|
3160
3158
|
const toId = this.safeString(accountsByType, toAccount, toAccount);
|
|
3161
3159
|
if (fromId !== 'cash' && toId !== 'cash') {
|
|
@@ -3172,7 +3170,7 @@ export default class ascendex extends Exchange {
|
|
|
3172
3170
|
//
|
|
3173
3171
|
// { "code": "0" }
|
|
3174
3172
|
//
|
|
3175
|
-
const transferOptions = this.
|
|
3173
|
+
const transferOptions = this.safeDict(this.options, 'transfer', {});
|
|
3176
3174
|
const fillResponseFromRequest = this.safeBool(transferOptions, 'fillResponseFromRequest', true);
|
|
3177
3175
|
const transfer = this.parseTransfer(response, currency);
|
|
3178
3176
|
if (fillResponseFromRequest) {
|
|
@@ -3227,7 +3225,7 @@ export default class ascendex extends Exchange {
|
|
|
3227
3225
|
if (paginate) {
|
|
3228
3226
|
return await this.fetchPaginatedCallIncremental('fetchFundingHistory', symbol, since, limit, params, 'page', 25);
|
|
3229
3227
|
}
|
|
3230
|
-
const account = this.
|
|
3228
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
3231
3229
|
const accountGroup = this.safeString(account, 'id');
|
|
3232
3230
|
const request = {
|
|
3233
3231
|
'account-group': accountGroup,
|
|
@@ -3259,7 +3257,7 @@ export default class ascendex extends Exchange {
|
|
|
3259
3257
|
// }
|
|
3260
3258
|
// }
|
|
3261
3259
|
//
|
|
3262
|
-
const data = this.
|
|
3260
|
+
const data = this.safeDict(response, 'data', {});
|
|
3263
3261
|
const rows = this.safeList(data, 'data', []);
|
|
3264
3262
|
return this.parseIncomes(rows, market, since, limit);
|
|
3265
3263
|
}
|
|
@@ -3296,7 +3294,7 @@ export default class ascendex extends Exchange {
|
|
|
3296
3294
|
*/
|
|
3297
3295
|
await this.loadMarkets();
|
|
3298
3296
|
await this.loadAccounts();
|
|
3299
|
-
const account = this.
|
|
3297
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
3300
3298
|
const accountGroup = this.safeString(account, 'id');
|
|
3301
3299
|
const request = {
|
|
3302
3300
|
'account-group': accountGroup,
|
|
@@ -3367,7 +3365,7 @@ export default class ascendex extends Exchange {
|
|
|
3367
3365
|
*/
|
|
3368
3366
|
await this.loadMarkets();
|
|
3369
3367
|
await this.loadAccounts();
|
|
3370
|
-
const account = this.
|
|
3368
|
+
const account = this.safeDict(this.accounts, 0, {});
|
|
3371
3369
|
const accountGroup = this.safeString(account, 'id');
|
|
3372
3370
|
const request = {
|
|
3373
3371
|
'account-group': accountGroup,
|
package/js/src/binance.js
CHANGED
|
@@ -333,7 +333,7 @@ export default class binance extends Exchange {
|
|
|
333
333
|
'capital/deposit/hisrec': 0.1,
|
|
334
334
|
'capital/deposit/subAddress': 0.1,
|
|
335
335
|
'capital/deposit/subHisrec': 0.1,
|
|
336
|
-
'capital/withdraw/history':
|
|
336
|
+
'capital/withdraw/history': 2,
|
|
337
337
|
'capital/withdraw/address/list': 10,
|
|
338
338
|
'capital/contract/convertible-coins': 4.0002,
|
|
339
339
|
'convert/tradeFlow': 20.001,
|