ccxt 4.2.64 → 4.2.66
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.js +358 -96
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +12 -0
- package/dist/cjs/src/bigone.js +6 -2
- package/dist/cjs/src/binance.js +26 -3
- package/dist/cjs/src/bingx.js +13 -4
- package/dist/cjs/src/bitfinex2.js +4 -4
- package/dist/cjs/src/bitget.js +16 -2
- package/dist/cjs/src/bitmex.js +3 -1
- package/dist/cjs/src/blofin.js +35 -0
- package/dist/cjs/src/btcmarkets.js +12 -0
- package/dist/cjs/src/coinbase.js +12 -2
- package/dist/cjs/src/delta.js +95 -1
- package/dist/cjs/src/hitbtc.js +1 -1
- package/dist/cjs/src/kucoin.js +85 -61
- package/dist/cjs/src/pro/bitfinex2.js +5 -4
- package/dist/cjs/src/pro/bitget.js +3 -3
- package/dist/cjs/src/pro/bitmart.js +28 -6
- package/dist/cjs/src/pro/currencycom.js +1 -1
- package/doc/manual.rst +1 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bitget.d.ts +5 -0
- package/js/src/abstract/blofin.d.ts +1 -0
- package/js/src/abstract/kucoin.d.ts +9 -0
- package/js/src/abstract/kucoinfutures.d.ts +9 -0
- package/js/src/base/Exchange.js +12 -0
- package/js/src/bigone.js +6 -2
- package/js/src/binance.d.ts +1 -1
- package/js/src/binance.js +26 -3
- package/js/src/bingx.js +13 -4
- package/js/src/bitfinex2.js +4 -4
- package/js/src/bitget.js +16 -2
- package/js/src/bitmex.js +3 -1
- package/js/src/blofin.d.ts +3 -1
- package/js/src/blofin.js +35 -0
- package/js/src/btcmarkets.js +12 -0
- package/js/src/coinbase.js +12 -2
- package/js/src/delta.d.ts +3 -1
- package/js/src/delta.js +95 -1
- package/js/src/gate.d.ts +1 -1
- package/js/src/hitbtc.js +1 -1
- package/js/src/kucoin.js +85 -61
- package/js/src/okx.d.ts +1 -1
- package/js/src/pro/bitfinex2.js +5 -4
- package/js/src/pro/bitget.js +3 -3
- package/js/src/pro/bitmart.js +28 -6
- package/js/src/pro/currencycom.d.ts +1 -1
- package/js/src/pro/currencycom.js +1 -1
- package/js/src/woo.d.ts +1 -1
- package/package.json +2 -2
- package/skip-tests.json +35 -13
package/dist/cjs/src/kucoin.js
CHANGED
|
@@ -117,6 +117,7 @@ class kucoin extends kucoin$1 {
|
|
|
117
117
|
'futuresPrivate': 'https://api-futures.kucoin.com',
|
|
118
118
|
'futuresPublic': 'https://api-futures.kucoin.com',
|
|
119
119
|
'webExchange': 'https://kucoin.com/_api',
|
|
120
|
+
'broker': 'https://api-broker.kucoin.com',
|
|
120
121
|
},
|
|
121
122
|
'www': 'https://www.kucoin.com',
|
|
122
123
|
'doc': [
|
|
@@ -230,6 +231,7 @@ class kucoin extends kucoin$1 {
|
|
|
230
231
|
'project/marketInterestRate': 7.5,
|
|
231
232
|
'redeem/orders': 10,
|
|
232
233
|
'purchase/orders': 10,
|
|
234
|
+
// broker
|
|
233
235
|
'broker/api/rebase/download': 3,
|
|
234
236
|
},
|
|
235
237
|
'post': {
|
|
@@ -376,6 +378,23 @@ class kucoin extends kucoin$1 {
|
|
|
376
378
|
'currency/currency/chain-info': 1, // this is temporary from webApi
|
|
377
379
|
},
|
|
378
380
|
},
|
|
381
|
+
'broker': {
|
|
382
|
+
'get': {
|
|
383
|
+
'broker/nd/info': 2,
|
|
384
|
+
'broker/nd/account': 2,
|
|
385
|
+
'broker/nd/account/apikey': 2,
|
|
386
|
+
'broker/nd/rebase/download': 3,
|
|
387
|
+
},
|
|
388
|
+
'post': {
|
|
389
|
+
'broker/nd/transfer': 1,
|
|
390
|
+
'broker/nd/account': 3,
|
|
391
|
+
'broker/nd/account/apikey': 3,
|
|
392
|
+
'broker/nd/account/update-apikey': 3,
|
|
393
|
+
},
|
|
394
|
+
'delete': {
|
|
395
|
+
'broker/nd/account/apikey': 3,
|
|
396
|
+
},
|
|
397
|
+
},
|
|
379
398
|
},
|
|
380
399
|
'timeframes': {
|
|
381
400
|
'1m': '1min',
|
|
@@ -893,7 +912,7 @@ class kucoin extends kucoin$1 {
|
|
|
893
912
|
// }
|
|
894
913
|
// }
|
|
895
914
|
//
|
|
896
|
-
const data = this.
|
|
915
|
+
const data = this.safeDict(response, 'data', {});
|
|
897
916
|
const status = this.safeString(data, 'status');
|
|
898
917
|
return {
|
|
899
918
|
'status': (status === 'open') ? 'ok' : 'maintenance',
|
|
@@ -939,8 +958,8 @@ class kucoin extends kucoin$1 {
|
|
|
939
958
|
// ]
|
|
940
959
|
// }
|
|
941
960
|
//
|
|
942
|
-
const data = this.
|
|
943
|
-
const options = this.
|
|
961
|
+
const data = this.safeList(response, 'data');
|
|
962
|
+
const options = this.safeDict(this.options, 'fetchMarkets', {});
|
|
944
963
|
const fetchTickersFees = this.safeBool(options, 'fetchTickersFees', true);
|
|
945
964
|
let tickersResponse = {};
|
|
946
965
|
if (fetchTickersFees) {
|
|
@@ -974,8 +993,8 @@ class kucoin extends kucoin$1 {
|
|
|
974
993
|
// }
|
|
975
994
|
// }
|
|
976
995
|
//
|
|
977
|
-
const tickersData = this.
|
|
978
|
-
const tickers = this.
|
|
996
|
+
const tickersData = this.safeDict(tickersResponse, 'data', {});
|
|
997
|
+
const tickers = this.safeList(tickersData, 'ticker', []);
|
|
979
998
|
const tickersByMarketId = this.indexBy(tickers, 'symbol');
|
|
980
999
|
const result = [];
|
|
981
1000
|
for (let i = 0; i < data.length; i++) {
|
|
@@ -985,7 +1004,7 @@ class kucoin extends kucoin$1 {
|
|
|
985
1004
|
const base = this.safeCurrencyCode(baseId);
|
|
986
1005
|
const quote = this.safeCurrencyCode(quoteId);
|
|
987
1006
|
// const quoteIncrement = this.safeNumber (market, 'quoteIncrement');
|
|
988
|
-
const ticker = this.
|
|
1007
|
+
const ticker = this.safeDict(tickersByMarketId, id, {});
|
|
989
1008
|
const makerFeeRate = this.safeString(ticker, 'makerFeeRate');
|
|
990
1009
|
const takerFeeRate = this.safeString(ticker, 'takerFeeRate');
|
|
991
1010
|
const makerCoefficient = this.safeString(ticker, 'makerCoefficient');
|
|
@@ -1001,11 +1020,11 @@ class kucoin extends kucoin$1 {
|
|
|
1001
1020
|
'settleId': undefined,
|
|
1002
1021
|
'type': 'spot',
|
|
1003
1022
|
'spot': true,
|
|
1004
|
-
'margin': this.
|
|
1023
|
+
'margin': this.safeBool(market, 'isMarginEnabled'),
|
|
1005
1024
|
'swap': false,
|
|
1006
1025
|
'future': false,
|
|
1007
1026
|
'option': false,
|
|
1008
|
-
'active': this.
|
|
1027
|
+
'active': this.safeBool(market, 'enableTrading'),
|
|
1009
1028
|
'contract': false,
|
|
1010
1029
|
'linear': undefined,
|
|
1011
1030
|
'inverse': undefined,
|
|
@@ -1135,7 +1154,7 @@ class kucoin extends kucoin$1 {
|
|
|
1135
1154
|
let isWithdrawEnabled = undefined;
|
|
1136
1155
|
let isDepositEnabled = undefined;
|
|
1137
1156
|
const networks = {};
|
|
1138
|
-
const chains = this.
|
|
1157
|
+
const chains = this.safeList(entry, 'chains', []);
|
|
1139
1158
|
const extraChainsData = this.indexBy(this.safeValue(additionalDataGrouped, id, []), 'chain');
|
|
1140
1159
|
const rawPrecision = this.safeString(entry, 'precision');
|
|
1141
1160
|
const precision = this.parseNumber(this.parsePrecision(rawPrecision));
|
|
@@ -1163,7 +1182,7 @@ class kucoin extends kucoin$1 {
|
|
|
1163
1182
|
else {
|
|
1164
1183
|
isDepositEnabled = isDepositEnabled || chainDepositEnabled;
|
|
1165
1184
|
}
|
|
1166
|
-
const chainExtraData = this.
|
|
1185
|
+
const chainExtraData = this.safeDict(extraChainsData, chainId, {});
|
|
1167
1186
|
networks[networkCode] = {
|
|
1168
1187
|
'info': chain,
|
|
1169
1188
|
'id': chainId,
|
|
@@ -1238,7 +1257,7 @@ class kucoin extends kucoin$1 {
|
|
|
1238
1257
|
// ]
|
|
1239
1258
|
// }
|
|
1240
1259
|
//
|
|
1241
|
-
const data = this.
|
|
1260
|
+
const data = this.safeList(response, 'data', []);
|
|
1242
1261
|
const result = [];
|
|
1243
1262
|
for (let i = 0; i < data.length; i++) {
|
|
1244
1263
|
const account = data[i];
|
|
@@ -1326,7 +1345,7 @@ class kucoin extends kucoin$1 {
|
|
|
1326
1345
|
// }
|
|
1327
1346
|
// }
|
|
1328
1347
|
//
|
|
1329
|
-
const data = this.
|
|
1348
|
+
const data = this.safeDict(response, 'data');
|
|
1330
1349
|
return this.parseDepositWithdrawFee(data, currency);
|
|
1331
1350
|
}
|
|
1332
1351
|
parseDepositWithdrawFee(fee, currency = undefined) {
|
|
@@ -1357,7 +1376,7 @@ class kucoin extends kucoin$1 {
|
|
|
1357
1376
|
},
|
|
1358
1377
|
'networks': {},
|
|
1359
1378
|
};
|
|
1360
|
-
const isWithdrawEnabled = this.
|
|
1379
|
+
const isWithdrawEnabled = this.safeBool(fee, 'isWithdrawEnabled');
|
|
1361
1380
|
if (isWithdrawEnabled) {
|
|
1362
1381
|
result['withdraw']['fee'] = this.safeNumber2(fee, 'withdrawalMinFee', 'withdrawMinFee');
|
|
1363
1382
|
result['withdraw']['percentage'] = false;
|
|
@@ -1384,7 +1403,7 @@ class kucoin extends kucoin$1 {
|
|
|
1384
1403
|
//
|
|
1385
1404
|
const defaultType = this.safeString2(this.options, methodName, 'defaultType', 'trade');
|
|
1386
1405
|
const requestedType = this.safeString(params, 'type', defaultType);
|
|
1387
|
-
const accountsByType = this.
|
|
1406
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType');
|
|
1388
1407
|
const type = this.safeString(accountsByType, requestedType);
|
|
1389
1408
|
if (type === undefined) {
|
|
1390
1409
|
const keys = Object.keys(accountsByType);
|
|
@@ -1525,8 +1544,8 @@ class kucoin extends kucoin$1 {
|
|
|
1525
1544
|
// }
|
|
1526
1545
|
// }
|
|
1527
1546
|
//
|
|
1528
|
-
const data = this.
|
|
1529
|
-
const tickers = this.
|
|
1547
|
+
const data = this.safeDict(response, 'data', {});
|
|
1548
|
+
const tickers = this.safeList(data, 'ticker', []);
|
|
1530
1549
|
const time = this.safeInteger(data, 'time');
|
|
1531
1550
|
const result = {};
|
|
1532
1551
|
for (let i = 0; i < tickers.length; i++) {
|
|
@@ -1656,7 +1675,7 @@ class kucoin extends kucoin$1 {
|
|
|
1656
1675
|
// ]
|
|
1657
1676
|
// }
|
|
1658
1677
|
//
|
|
1659
|
-
const data = this.
|
|
1678
|
+
const data = this.safeList(response, 'data', []);
|
|
1660
1679
|
return this.parseOHLCVs(data, market, timeframe, since, limit);
|
|
1661
1680
|
}
|
|
1662
1681
|
async createDepositAddress(code, params = {}) {
|
|
@@ -1684,7 +1703,7 @@ class kucoin extends kucoin$1 {
|
|
|
1684
1703
|
// {"code":"260000","msg":"Deposit address already exists."}
|
|
1685
1704
|
// BCH {"code":"200000","data":{"address":"bitcoincash:qza3m4nj9rx7l9r0cdadfqxts6f92shvhvr5ls4q7z","memo":""}}
|
|
1686
1705
|
// BTC {"code":"200000","data":{"address":"36SjucKqQpQSvsak9A7h6qzFjrVXpRNZhE","memo":""}}
|
|
1687
|
-
const data = this.
|
|
1706
|
+
const data = this.safeDict(response, 'data', {});
|
|
1688
1707
|
return this.parseDepositAddress(data, currency);
|
|
1689
1708
|
}
|
|
1690
1709
|
async fetchDepositAddress(code, params = {}) {
|
|
@@ -1779,7 +1798,7 @@ class kucoin extends kucoin$1 {
|
|
|
1779
1798
|
// }
|
|
1780
1799
|
//
|
|
1781
1800
|
this.options['versions']['private']['GET']['deposit-addresses'] = version;
|
|
1782
|
-
const chains = this.
|
|
1801
|
+
const chains = this.safeList(response, 'data', []);
|
|
1783
1802
|
const parsed = this.parseDepositAddresses(chains, [currency['code']], false, {
|
|
1784
1803
|
'currency': currency['id'],
|
|
1785
1804
|
});
|
|
@@ -1852,7 +1871,7 @@ class kucoin extends kucoin$1 {
|
|
|
1852
1871
|
// ]
|
|
1853
1872
|
// }
|
|
1854
1873
|
//
|
|
1855
|
-
const data = this.
|
|
1874
|
+
const data = this.safeDict(response, 'data', {});
|
|
1856
1875
|
const timestamp = this.safeInteger(data, 'time');
|
|
1857
1876
|
const orderbook = this.parseOrderBook(data, market['symbol'], timestamp, 'bids', 'asks', level - 2, level - 1);
|
|
1858
1877
|
orderbook['nonce'] = this.safeInteger(data, 'sequence');
|
|
@@ -1954,7 +1973,7 @@ class kucoin extends kucoin$1 {
|
|
|
1954
1973
|
// }
|
|
1955
1974
|
// }
|
|
1956
1975
|
//
|
|
1957
|
-
const data = this.
|
|
1976
|
+
const data = this.safeDict(response, 'data', {});
|
|
1958
1977
|
return this.parseOrder(data, market);
|
|
1959
1978
|
}
|
|
1960
1979
|
async createMarketOrderWithCost(symbol, side, cost, params = {}) {
|
|
@@ -2082,8 +2101,8 @@ class kucoin extends kucoin$1 {
|
|
|
2082
2101
|
// },
|
|
2083
2102
|
// }
|
|
2084
2103
|
//
|
|
2085
|
-
let data = this.
|
|
2086
|
-
data = this.
|
|
2104
|
+
let data = this.safeDict(response, 'data', {});
|
|
2105
|
+
data = this.safeList(data, 'data', []);
|
|
2087
2106
|
return this.parseOrders(data);
|
|
2088
2107
|
}
|
|
2089
2108
|
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
@@ -2200,7 +2219,7 @@ class kucoin extends kucoin$1 {
|
|
|
2200
2219
|
// }
|
|
2201
2220
|
// }
|
|
2202
2221
|
//
|
|
2203
|
-
const data = this.
|
|
2222
|
+
const data = this.safeDict(response, 'data', {});
|
|
2204
2223
|
return this.parseOrder(data, market);
|
|
2205
2224
|
}
|
|
2206
2225
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
@@ -2224,7 +2243,7 @@ class kucoin extends kucoin$1 {
|
|
|
2224
2243
|
await this.loadMarkets();
|
|
2225
2244
|
const request = {};
|
|
2226
2245
|
const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
|
|
2227
|
-
const stop = this.
|
|
2246
|
+
const stop = this.safeBool2(params, 'stop', 'trigger', false);
|
|
2228
2247
|
const hf = this.safeBool(params, 'hf', false);
|
|
2229
2248
|
if (hf) {
|
|
2230
2249
|
if (symbol === undefined) {
|
|
@@ -2424,7 +2443,7 @@ class kucoin extends kucoin$1 {
|
|
|
2424
2443
|
// ]
|
|
2425
2444
|
// }
|
|
2426
2445
|
// }
|
|
2427
|
-
const responseData = this.
|
|
2446
|
+
const responseData = this.safeDict(response, 'data', {});
|
|
2428
2447
|
const orders = this.safeValue(responseData, 'items', responseData);
|
|
2429
2448
|
return this.parseOrders(orders, market, since, limit);
|
|
2430
2449
|
}
|
|
@@ -2560,7 +2579,7 @@ class kucoin extends kucoin$1 {
|
|
|
2560
2579
|
response = await this.privateGetOrdersOrderId(this.extend(request, params));
|
|
2561
2580
|
}
|
|
2562
2581
|
}
|
|
2563
|
-
let responseData = this.
|
|
2582
|
+
let responseData = this.safeDict(response, 'data', {});
|
|
2564
2583
|
if (Array.isArray(responseData)) {
|
|
2565
2584
|
responseData = this.safeValue(responseData, 0);
|
|
2566
2585
|
}
|
|
@@ -2695,7 +2714,7 @@ class kucoin extends kucoin$1 {
|
|
|
2695
2714
|
const responseStop = this.safeString(order, 'stop');
|
|
2696
2715
|
const stop = responseStop !== undefined;
|
|
2697
2716
|
const stopTriggered = this.safeBool(order, 'stopTriggered', false);
|
|
2698
|
-
const isActive = this.
|
|
2717
|
+
const isActive = this.safeBool2(order, 'isActive', 'active');
|
|
2699
2718
|
const responseStatus = this.safeString(order, 'status');
|
|
2700
2719
|
let status = undefined;
|
|
2701
2720
|
if (isActive !== undefined) {
|
|
@@ -2728,7 +2747,7 @@ class kucoin extends kucoin$1 {
|
|
|
2728
2747
|
'symbol': this.safeSymbol(marketId, market, '-'),
|
|
2729
2748
|
'type': this.safeString(order, 'type'),
|
|
2730
2749
|
'timeInForce': this.safeString(order, 'timeInForce'),
|
|
2731
|
-
'postOnly': this.
|
|
2750
|
+
'postOnly': this.safeBool(order, 'postOnly'),
|
|
2732
2751
|
'side': this.safeString(order, 'side'),
|
|
2733
2752
|
'amount': this.safeString(order, 'size'),
|
|
2734
2753
|
'price': this.safeString(order, 'price'),
|
|
@@ -2868,13 +2887,13 @@ class kucoin extends kucoin$1 {
|
|
|
2868
2887
|
// ]
|
|
2869
2888
|
// }
|
|
2870
2889
|
//
|
|
2871
|
-
const data = this.
|
|
2890
|
+
const data = this.safeDict(response, 'data', {});
|
|
2872
2891
|
let trades = undefined;
|
|
2873
2892
|
if (parseResponseData) {
|
|
2874
2893
|
trades = data;
|
|
2875
2894
|
}
|
|
2876
2895
|
else {
|
|
2877
|
-
trades = this.
|
|
2896
|
+
trades = this.safeList(data, 'items', []);
|
|
2878
2897
|
}
|
|
2879
2898
|
return this.parseTrades(trades, market, since, limit);
|
|
2880
2899
|
}
|
|
@@ -2917,7 +2936,7 @@ class kucoin extends kucoin$1 {
|
|
|
2917
2936
|
// ]
|
|
2918
2937
|
// }
|
|
2919
2938
|
//
|
|
2920
|
-
const trades = this.
|
|
2939
|
+
const trades = this.safeList(response, 'data', []);
|
|
2921
2940
|
return this.parseTrades(trades, market, since, limit);
|
|
2922
2941
|
}
|
|
2923
2942
|
parseTrade(trade, market = undefined) {
|
|
@@ -3079,8 +3098,8 @@ class kucoin extends kucoin$1 {
|
|
|
3079
3098
|
// ]
|
|
3080
3099
|
// }
|
|
3081
3100
|
//
|
|
3082
|
-
const data = this.
|
|
3083
|
-
const first = this.
|
|
3101
|
+
const data = this.safeList(response, 'data', []);
|
|
3102
|
+
const first = this.safeDict(data, 0);
|
|
3084
3103
|
const marketId = this.safeString(first, 'symbol');
|
|
3085
3104
|
return {
|
|
3086
3105
|
'info': response,
|
|
@@ -3141,7 +3160,7 @@ class kucoin extends kucoin$1 {
|
|
|
3141
3160
|
// }
|
|
3142
3161
|
// }
|
|
3143
3162
|
//
|
|
3144
|
-
const data = this.
|
|
3163
|
+
const data = this.safeDict(response, 'data', {});
|
|
3145
3164
|
return this.parseTransaction(data, currency);
|
|
3146
3165
|
}
|
|
3147
3166
|
parseTransactionStatus(status) {
|
|
@@ -3241,7 +3260,7 @@ class kucoin extends kucoin$1 {
|
|
|
3241
3260
|
updated = updated * 1000;
|
|
3242
3261
|
}
|
|
3243
3262
|
}
|
|
3244
|
-
const internal = this.
|
|
3263
|
+
const internal = this.safeBool(transaction, 'isInner');
|
|
3245
3264
|
const tag = this.safeString(transaction, 'memo');
|
|
3246
3265
|
return {
|
|
3247
3266
|
'info': transaction,
|
|
@@ -3467,7 +3486,7 @@ class kucoin extends kucoin$1 {
|
|
|
3467
3486
|
}
|
|
3468
3487
|
const defaultType = this.safeString2(this.options, 'fetchBalance', 'defaultType', 'spot');
|
|
3469
3488
|
const requestedType = this.safeString(params, 'type', defaultType);
|
|
3470
|
-
const accountsByType = this.
|
|
3489
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType');
|
|
3471
3490
|
let type = this.safeString(accountsByType, requestedType, requestedType);
|
|
3472
3491
|
params = this.omit(params, 'type');
|
|
3473
3492
|
const isHf = this.safeBool(params, 'hf', false);
|
|
@@ -3549,7 +3568,7 @@ class kucoin extends kucoin$1 {
|
|
|
3549
3568
|
// }
|
|
3550
3569
|
// }
|
|
3551
3570
|
//
|
|
3552
|
-
const data = this.
|
|
3571
|
+
const data = this.safeList(response, 'data', []);
|
|
3553
3572
|
const result = {
|
|
3554
3573
|
'info': response,
|
|
3555
3574
|
'timestamp': undefined,
|
|
@@ -3561,8 +3580,8 @@ class kucoin extends kucoin$1 {
|
|
|
3561
3580
|
const entry = assets[i];
|
|
3562
3581
|
const marketId = this.safeString(entry, 'symbol');
|
|
3563
3582
|
const symbol = this.safeSymbol(marketId, undefined, '_');
|
|
3564
|
-
const base = this.
|
|
3565
|
-
const quote = this.
|
|
3583
|
+
const base = this.safeDict(entry, 'baseAsset', {});
|
|
3584
|
+
const quote = this.safeDict(entry, 'quoteAsset', {});
|
|
3566
3585
|
const baseCode = this.safeCurrencyCode(this.safeString(base, 'currency'));
|
|
3567
3586
|
const quoteCode = this.safeCurrencyCode(this.safeString(quote, 'currency'));
|
|
3568
3587
|
const subResult = {};
|
|
@@ -3572,7 +3591,7 @@ class kucoin extends kucoin$1 {
|
|
|
3572
3591
|
}
|
|
3573
3592
|
}
|
|
3574
3593
|
else if (cross) {
|
|
3575
|
-
const accounts = this.
|
|
3594
|
+
const accounts = this.safeList(data, 'accounts', []);
|
|
3576
3595
|
for (let i = 0; i < accounts.length; i++) {
|
|
3577
3596
|
const balance = accounts[i];
|
|
3578
3597
|
const currencyId = this.safeString(balance, 'currency');
|
|
@@ -3657,7 +3676,7 @@ class kucoin extends kucoin$1 {
|
|
|
3657
3676
|
// }
|
|
3658
3677
|
// }
|
|
3659
3678
|
//
|
|
3660
|
-
const data = this.
|
|
3679
|
+
const data = this.safeDict(response, 'data');
|
|
3661
3680
|
return this.parseTransfer(data, currency);
|
|
3662
3681
|
}
|
|
3663
3682
|
else {
|
|
@@ -3689,7 +3708,7 @@ class kucoin extends kucoin$1 {
|
|
|
3689
3708
|
// }
|
|
3690
3709
|
// }
|
|
3691
3710
|
//
|
|
3692
|
-
const data = this.
|
|
3711
|
+
const data = this.safeDict(response, 'data');
|
|
3693
3712
|
return this.parseTransfer(data, currency);
|
|
3694
3713
|
}
|
|
3695
3714
|
}
|
|
@@ -3733,7 +3752,7 @@ class kucoin extends kucoin$1 {
|
|
|
3733
3752
|
const rawStatus = this.safeString(transfer, 'status');
|
|
3734
3753
|
const accountFromRaw = this.safeStringLower(transfer, 'payAccountType');
|
|
3735
3754
|
const accountToRaw = this.safeStringLower(transfer, 'recAccountType');
|
|
3736
|
-
const accountsByType = this.
|
|
3755
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType');
|
|
3737
3756
|
const accountFrom = this.safeString(accountsByType, accountFromRaw, accountFromRaw);
|
|
3738
3757
|
const accountTo = this.safeString(accountsByType, accountToRaw, accountToRaw);
|
|
3739
3758
|
return {
|
|
@@ -3903,7 +3922,7 @@ class kucoin extends kucoin$1 {
|
|
|
3903
3922
|
await this.loadAccounts();
|
|
3904
3923
|
let paginate = false;
|
|
3905
3924
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
3906
|
-
const isHf = this.
|
|
3925
|
+
const isHf = this.safeBool(params, 'hf');
|
|
3907
3926
|
params = this.omit(params, 'hf');
|
|
3908
3927
|
if (paginate) {
|
|
3909
3928
|
return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
|
|
@@ -3985,9 +4004,9 @@ class kucoin extends kucoin$1 {
|
|
|
3985
4004
|
return this.parseLedger(items, currency, since, limit);
|
|
3986
4005
|
}
|
|
3987
4006
|
calculateRateLimiterCost(api, method, path, params, config = {}) {
|
|
3988
|
-
const versions = this.
|
|
3989
|
-
const apiVersions = this.
|
|
3990
|
-
const methodVersions = this.
|
|
4007
|
+
const versions = this.safeDict(this.options, 'versions', {});
|
|
4008
|
+
const apiVersions = this.safeDict(versions, api, {});
|
|
4009
|
+
const methodVersions = this.safeDict(apiVersions, method, {});
|
|
3991
4010
|
const defaultVersion = this.safeString(methodVersions, path, this.options['version']);
|
|
3992
4011
|
const version = this.safeString(params, 'version', defaultVersion);
|
|
3993
4012
|
if (version === 'v3' && ('v3' in config)) {
|
|
@@ -4131,8 +4150,8 @@ class kucoin extends kucoin$1 {
|
|
|
4131
4150
|
// }
|
|
4132
4151
|
// }
|
|
4133
4152
|
//
|
|
4134
|
-
const data = this.
|
|
4135
|
-
const assets = (marginMode === 'isolated') ? this.
|
|
4153
|
+
const data = this.safeDict(response, 'data', {});
|
|
4154
|
+
const assets = (marginMode === 'isolated') ? this.safeList(data, 'assets', []) : this.safeList(data, 'accounts', []);
|
|
4136
4155
|
return this.parseBorrowInterests(assets, undefined);
|
|
4137
4156
|
}
|
|
4138
4157
|
parseBorrowInterest(info, market = undefined) {
|
|
@@ -4185,7 +4204,7 @@ class kucoin extends kucoin$1 {
|
|
|
4185
4204
|
market = this.safeMarket(marketId, market);
|
|
4186
4205
|
const symbol = this.safeString(market, 'symbol');
|
|
4187
4206
|
const timestamp = this.safeInteger(info, 'createdAt');
|
|
4188
|
-
const isolatedBase = this.
|
|
4207
|
+
const isolatedBase = this.safeDict(info, 'baseAsset', {});
|
|
4189
4208
|
let amountBorrowed = undefined;
|
|
4190
4209
|
let interest = undefined;
|
|
4191
4210
|
let currencyId = undefined;
|
|
@@ -4243,7 +4262,7 @@ class kucoin extends kucoin$1 {
|
|
|
4243
4262
|
// }
|
|
4244
4263
|
// }
|
|
4245
4264
|
//
|
|
4246
|
-
const data = this.
|
|
4265
|
+
const data = this.safeDict(response, 'data', {});
|
|
4247
4266
|
return this.parseMarginLoan(data, currency);
|
|
4248
4267
|
}
|
|
4249
4268
|
async borrowIsolatedMargin(symbol, code, amount, params = {}) {
|
|
@@ -4282,7 +4301,7 @@ class kucoin extends kucoin$1 {
|
|
|
4282
4301
|
// }
|
|
4283
4302
|
// }
|
|
4284
4303
|
//
|
|
4285
|
-
const data = this.
|
|
4304
|
+
const data = this.safeDict(response, 'data', {});
|
|
4286
4305
|
return this.parseMarginLoan(data, currency);
|
|
4287
4306
|
}
|
|
4288
4307
|
async repayCrossMargin(code, amount, params = {}) {
|
|
@@ -4315,7 +4334,7 @@ class kucoin extends kucoin$1 {
|
|
|
4315
4334
|
// }
|
|
4316
4335
|
// }
|
|
4317
4336
|
//
|
|
4318
|
-
const data = this.
|
|
4337
|
+
const data = this.safeDict(response, 'data', {});
|
|
4319
4338
|
return this.parseMarginLoan(data, currency);
|
|
4320
4339
|
}
|
|
4321
4340
|
async repayIsolatedMargin(symbol, code, amount, params = {}) {
|
|
@@ -4352,7 +4371,7 @@ class kucoin extends kucoin$1 {
|
|
|
4352
4371
|
// }
|
|
4353
4372
|
// }
|
|
4354
4373
|
//
|
|
4355
|
-
const data = this.
|
|
4374
|
+
const data = this.safeDict(response, 'data', {});
|
|
4356
4375
|
return this.parseMarginLoan(data, currency);
|
|
4357
4376
|
}
|
|
4358
4377
|
parseMarginLoan(info, currency = undefined) {
|
|
@@ -4404,7 +4423,7 @@ class kucoin extends kucoin$1 {
|
|
|
4404
4423
|
// },
|
|
4405
4424
|
// ]
|
|
4406
4425
|
//
|
|
4407
|
-
const data = this.
|
|
4426
|
+
const data = this.safeList(response, 'data', []);
|
|
4408
4427
|
return this.parseDepositWithdrawFees(data, codes, 'currency');
|
|
4409
4428
|
}
|
|
4410
4429
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
@@ -4413,9 +4432,9 @@ class kucoin extends kucoin$1 {
|
|
|
4413
4432
|
// ↑ ↑
|
|
4414
4433
|
// ↑ ↑
|
|
4415
4434
|
//
|
|
4416
|
-
const versions = this.
|
|
4417
|
-
const apiVersions = this.
|
|
4418
|
-
const methodVersions = this.
|
|
4435
|
+
const versions = this.safeDict(this.options, 'versions', {});
|
|
4436
|
+
const apiVersions = this.safeDict(versions, api, {});
|
|
4437
|
+
const methodVersions = this.safeDict(apiVersions, method, {});
|
|
4419
4438
|
const defaultVersion = this.safeString(methodVersions, path, this.options['version']);
|
|
4420
4439
|
const version = this.safeString(params, 'version', defaultVersion);
|
|
4421
4440
|
params = this.omit(params, 'version');
|
|
@@ -4440,7 +4459,8 @@ class kucoin extends kucoin$1 {
|
|
|
4440
4459
|
url = url + endpoint;
|
|
4441
4460
|
const isFuturePrivate = (api === 'futuresPrivate');
|
|
4442
4461
|
const isPrivate = (api === 'private');
|
|
4443
|
-
|
|
4462
|
+
const isBroker = (api === 'private');
|
|
4463
|
+
if (isPrivate || isFuturePrivate || isBroker) {
|
|
4444
4464
|
this.checkRequiredCredentials();
|
|
4445
4465
|
const timestamp = this.nonce().toString();
|
|
4446
4466
|
headers = this.extend({
|
|
@@ -4459,7 +4479,7 @@ class kucoin extends kucoin$1 {
|
|
|
4459
4479
|
const payload = timestamp + method + endpoint + endpart;
|
|
4460
4480
|
const signature = this.hmac(this.encode(payload), this.encode(this.secret), sha256.sha256, 'base64');
|
|
4461
4481
|
headers['KC-API-SIGN'] = signature;
|
|
4462
|
-
let partner = this.
|
|
4482
|
+
let partner = this.safeDict(this.options, 'partner', {});
|
|
4463
4483
|
partner = isFuturePrivate ? this.safeValue(partner, 'future', partner) : this.safeValue(partner, 'spot', partner);
|
|
4464
4484
|
const partnerId = this.safeString(partner, 'id');
|
|
4465
4485
|
const partnerSecret = this.safeString2(partner, 'secret', 'key');
|
|
@@ -4469,6 +4489,10 @@ class kucoin extends kucoin$1 {
|
|
|
4469
4489
|
headers['KC-API-PARTNER-SIGN'] = partnerSignature;
|
|
4470
4490
|
headers['KC-API-PARTNER'] = partnerId;
|
|
4471
4491
|
}
|
|
4492
|
+
if (isBroker) {
|
|
4493
|
+
const brokerName = this.safeString(partner, 'name');
|
|
4494
|
+
headers['KC-BROKER-NAME'] = brokerName;
|
|
4495
|
+
}
|
|
4472
4496
|
}
|
|
4473
4497
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
4474
4498
|
}
|
|
@@ -320,11 +320,12 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
320
320
|
const messageLength = message.length;
|
|
321
321
|
if (messageLength === 2) {
|
|
322
322
|
// initial snapshot
|
|
323
|
-
|
|
323
|
+
const trades = this.safeList(message, 1, []);
|
|
324
324
|
// needs to be reversed to make chronological order
|
|
325
|
-
|
|
326
|
-
for (let i = 0; i <
|
|
327
|
-
const
|
|
325
|
+
const length = trades.length;
|
|
326
|
+
for (let i = 0; i < length; i++) {
|
|
327
|
+
const index = length - i - 1;
|
|
328
|
+
const parsed = this.parseWsTrade(trades[index], market);
|
|
328
329
|
stored.append(parsed);
|
|
329
330
|
}
|
|
330
331
|
}
|
|
@@ -671,10 +671,10 @@ class bitget extends bitget$1 {
|
|
|
671
671
|
}
|
|
672
672
|
const data = this.safeList(message, 'data', []);
|
|
673
673
|
const length = data.length;
|
|
674
|
-
const maxLength = Math.max(length - 1, 0);
|
|
675
674
|
// fix chronological order by reversing
|
|
676
|
-
for (let i =
|
|
677
|
-
const
|
|
675
|
+
for (let i = 0; i < length; i++) {
|
|
676
|
+
const index = length - i - 1;
|
|
677
|
+
const rawTrade = data[index];
|
|
678
678
|
const parsed = this.parseWsTrade(rawTrade, market);
|
|
679
679
|
stored.append(parsed);
|
|
680
680
|
}
|
|
@@ -827,9 +827,9 @@ class bitmart extends bitmart$1 {
|
|
|
827
827
|
const isSwap = ('group' in message);
|
|
828
828
|
if (isSwap) {
|
|
829
829
|
// in swap, chronologically decreasing: 1709536849322, 1709536848954,
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
symbol = this.handleTradeLoop(data[
|
|
830
|
+
for (let i = 0; i < length; i++) {
|
|
831
|
+
const index = length - i - 1;
|
|
832
|
+
symbol = this.handleTradeLoop(data[index]);
|
|
833
833
|
}
|
|
834
834
|
}
|
|
835
835
|
else {
|
|
@@ -1471,7 +1471,17 @@ class bitmart extends bitmart$1 {
|
|
|
1471
1471
|
}
|
|
1472
1472
|
//
|
|
1473
1473
|
// {"event":"error","message":"Unrecognized request: {\"event\":\"subscribe\",\"channel\":\"spot/depth:BTC-USDT\"}","errorCode":30039}
|
|
1474
|
-
//
|
|
1474
|
+
//
|
|
1475
|
+
// subscribe events on spot:
|
|
1476
|
+
//
|
|
1477
|
+
// {"event":"subscribe", "topic":"spot/kline1m:BTC_USDT" }
|
|
1478
|
+
//
|
|
1479
|
+
// subscribe on contracts:
|
|
1480
|
+
//
|
|
1481
|
+
// {"action":"subscribe", "group":"futures/klineBin1m:BTCUSDT", "success":true, "request":{"action":"subscribe", "args":[ "futures/klineBin1m:BTCUSDT" ] } }
|
|
1482
|
+
//
|
|
1483
|
+
// regular updates - spot
|
|
1484
|
+
//
|
|
1475
1485
|
// {
|
|
1476
1486
|
// "table": "spot/depth",
|
|
1477
1487
|
// "action": "partial",
|
|
@@ -1492,10 +1502,21 @@ class bitmart extends bitmart$1 {
|
|
|
1492
1502
|
// ]
|
|
1493
1503
|
// }
|
|
1494
1504
|
//
|
|
1505
|
+
// regular updates - contracts
|
|
1506
|
+
//
|
|
1507
|
+
// {
|
|
1508
|
+
// group: "futures/klineBin1m:BTCUSDT",
|
|
1509
|
+
// data: {
|
|
1510
|
+
// symbol: "BTCUSDT",
|
|
1511
|
+
// items: [ { o: "67944.7", "h": .... } ],
|
|
1512
|
+
// },
|
|
1513
|
+
// }
|
|
1514
|
+
//
|
|
1495
1515
|
// { data: '', table: "spot/user/order" }
|
|
1496
1516
|
//
|
|
1497
|
-
|
|
1498
|
-
|
|
1517
|
+
// the only realiable way (for both spot & swap) is to check 'data' key
|
|
1518
|
+
const isDataUpdate = ('data' in message);
|
|
1519
|
+
if (!isDataUpdate) {
|
|
1499
1520
|
const event = this.safeString2(message, 'event', 'action');
|
|
1500
1521
|
if (event !== undefined) {
|
|
1501
1522
|
const methods = {
|
|
@@ -1511,6 +1532,7 @@ class bitmart extends bitmart$1 {
|
|
|
1511
1532
|
}
|
|
1512
1533
|
}
|
|
1513
1534
|
else {
|
|
1535
|
+
const channel = this.safeString2(message, 'table', 'group');
|
|
1514
1536
|
const methods = {
|
|
1515
1537
|
'depth': this.handleOrderBook,
|
|
1516
1538
|
'ticker': this.handleTicker,
|
package/doc/manual.rst
CHANGED
|
@@ -4038,6 +4038,7 @@ The ``fetchStatus()`` method will return a status structure like shown below:
|
|
|
4038
4038
|
'updated': undefined, // integer, last updated timestamp in milliseconds if updated via the API
|
|
4039
4039
|
'eta': undefined, // when the maintenance or outage is expected to end
|
|
4040
4040
|
'url': undefined, // a link to a GitHub issue or to an exchange post on the subject
|
|
4041
|
+
'info': { ... }
|
|
4041
4042
|
}
|
|
4042
4043
|
|
|
4043
4044
|
The possible values in the ``status`` field are:
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.2.
|
|
7
|
+
declare const version = "4.2.65";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.2.
|
|
41
|
+
const version = '4.2.66';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|