ccxt 4.2.76 → 4.2.77
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/build.sh +1 -1
- package/dist/ccxt.browser.js +966 -597
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +6 -0
- package/dist/cjs/src/binance.js +502 -443
- package/dist/cjs/src/bingx.js +1 -1
- package/dist/cjs/src/blofin.js +14 -2
- package/dist/cjs/src/bybit.js +100 -58
- package/dist/cjs/src/coinbase.js +1 -1
- package/dist/cjs/src/delta.js +66 -49
- package/dist/cjs/src/hyperliquid.js +1 -1
- package/dist/cjs/src/kraken.js +8 -8
- package/dist/cjs/src/kucoin.js +152 -5
- package/dist/cjs/src/pro/ascendex.js +1 -1
- package/dist/cjs/src/pro/bitvavo.js +1 -1
- package/dist/cjs/src/pro/coinex.js +20 -14
- package/dist/cjs/src/pro/deribit.js +1 -1
- package/dist/cjs/src/pro/exmo.js +1 -1
- package/dist/cjs/src/pro/krakenfutures.js +1 -1
- package/dist/cjs/src/pro/phemex.js +1 -1
- package/dist/cjs/src/pro/poloniex.js +1 -1
- package/dist/cjs/src/pro/probit.js +1 -1
- package/dist/cjs/src/pro/woo.js +61 -6
- package/dist/cjs/src/woo.js +25 -0
- 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/base/Exchange.d.ts +3 -3
- package/js/src/base/Exchange.js +6 -0
- package/js/src/base/types.d.ts +1 -1
- package/js/src/binance.d.ts +2 -2
- package/js/src/binance.js +502 -443
- package/js/src/bingx.js +1 -1
- package/js/src/bitflyer.d.ts +2 -2
- package/js/src/bithumb.d.ts +2 -2
- package/js/src/blofin.js +14 -2
- package/js/src/bybit.d.ts +1 -1
- package/js/src/bybit.js +100 -58
- package/js/src/coinbase.js +1 -1
- package/js/src/delta.d.ts +2 -1
- package/js/src/delta.js +66 -49
- package/js/src/deribit.d.ts +1 -1
- package/js/src/gate.d.ts +1 -1
- package/js/src/hyperliquid.js +1 -1
- package/js/src/kraken.js +8 -8
- package/js/src/kucoin.d.ts +4 -1
- package/js/src/kucoin.js +152 -5
- package/js/src/okx.d.ts +1 -1
- package/js/src/pro/ascendex.js +1 -1
- package/js/src/pro/bitvavo.js +1 -1
- package/js/src/pro/coinex.js +20 -14
- package/js/src/pro/deribit.js +1 -1
- package/js/src/pro/exmo.js +1 -1
- package/js/src/pro/krakenfutures.js +1 -1
- package/js/src/pro/phemex.js +1 -1
- package/js/src/pro/poloniex.js +1 -1
- package/js/src/pro/probit.js +1 -1
- package/js/src/pro/woo.d.ts +1 -0
- package/js/src/pro/woo.js +61 -6
- package/js/src/woo.js +25 -0
- package/package.json +1 -1
- package/skip-tests.json +1 -2
package/dist/cjs/src/delta.js
CHANGED
|
@@ -334,7 +334,7 @@ class delta extends delta$1 {
|
|
|
334
334
|
*/
|
|
335
335
|
const response = await this.publicGetSettings(params);
|
|
336
336
|
// full response sample under `fetchStatus`
|
|
337
|
-
const result = this.
|
|
337
|
+
const result = this.safeDict(response, 'result', {});
|
|
338
338
|
return this.safeIntegerProduct(result, 'server_time', 0.001);
|
|
339
339
|
}
|
|
340
340
|
async fetchStatus(params = {}) {
|
|
@@ -399,7 +399,7 @@ class delta extends delta$1 {
|
|
|
399
399
|
// "success": true
|
|
400
400
|
// }
|
|
401
401
|
//
|
|
402
|
-
const result = this.
|
|
402
|
+
const result = this.safeDict(response, 'result', {});
|
|
403
403
|
const underMaintenance = this.safeString(result, 'under_maintenance');
|
|
404
404
|
const status = (underMaintenance === 'true') ? 'maintenance' : 'ok';
|
|
405
405
|
const updated = this.safeIntegerProduct(result, 'server_time', 0.001, this.milliseconds());
|
|
@@ -451,7 +451,7 @@ class delta extends delta$1 {
|
|
|
451
451
|
// "success":true
|
|
452
452
|
// }
|
|
453
453
|
//
|
|
454
|
-
const currencies = this.
|
|
454
|
+
const currencies = this.safeList(response, 'result', []);
|
|
455
455
|
const result = {};
|
|
456
456
|
for (let i = 0; i < currencies.length; i++) {
|
|
457
457
|
const currency = currencies[i];
|
|
@@ -488,16 +488,33 @@ class delta extends delta$1 {
|
|
|
488
488
|
}
|
|
489
489
|
async loadMarkets(reload = false, params = {}) {
|
|
490
490
|
const markets = await super.loadMarkets(reload, params);
|
|
491
|
-
const currenciesByNumericId = this.
|
|
491
|
+
const currenciesByNumericId = this.safeDict(this.options, 'currenciesByNumericId');
|
|
492
492
|
if ((currenciesByNumericId === undefined) || reload) {
|
|
493
|
-
this.options['currenciesByNumericId'] = this.
|
|
493
|
+
this.options['currenciesByNumericId'] = this.indexByStringifiedNumericId(this.currencies);
|
|
494
494
|
}
|
|
495
|
-
const marketsByNumericId = this.
|
|
495
|
+
const marketsByNumericId = this.safeDict(this.options, 'marketsByNumericId');
|
|
496
496
|
if ((marketsByNumericId === undefined) || reload) {
|
|
497
|
-
this.options['marketsByNumericId'] = this.
|
|
497
|
+
this.options['marketsByNumericId'] = this.indexByStringifiedNumericId(this.markets);
|
|
498
498
|
}
|
|
499
499
|
return markets;
|
|
500
500
|
}
|
|
501
|
+
indexByStringifiedNumericId(input) {
|
|
502
|
+
const result = {};
|
|
503
|
+
if (input === undefined) {
|
|
504
|
+
return undefined;
|
|
505
|
+
}
|
|
506
|
+
const keys = Object.keys(input);
|
|
507
|
+
for (let i = 0; i < keys.length; i++) {
|
|
508
|
+
const key = keys[i];
|
|
509
|
+
const item = input[key];
|
|
510
|
+
const numericIdString = this.safeString(item, 'numericId');
|
|
511
|
+
if (numericIdString === undefined) {
|
|
512
|
+
continue;
|
|
513
|
+
}
|
|
514
|
+
result[numericIdString] = item;
|
|
515
|
+
}
|
|
516
|
+
return result;
|
|
517
|
+
}
|
|
501
518
|
async fetchMarkets(params = {}) {
|
|
502
519
|
/**
|
|
503
520
|
* @method
|
|
@@ -686,7 +703,7 @@ class delta extends delta$1 {
|
|
|
686
703
|
// "success":true
|
|
687
704
|
// }
|
|
688
705
|
//
|
|
689
|
-
const markets = this.
|
|
706
|
+
const markets = this.safeList(response, 'result', []);
|
|
690
707
|
const result = [];
|
|
691
708
|
for (let i = 0; i < markets.length; i++) {
|
|
692
709
|
const market = markets[i];
|
|
@@ -695,10 +712,10 @@ class delta extends delta$1 {
|
|
|
695
712
|
continue;
|
|
696
713
|
}
|
|
697
714
|
// const settlingAsset = this.safeValue (market, 'settling_asset', {});
|
|
698
|
-
const quotingAsset = this.
|
|
699
|
-
const underlyingAsset = this.
|
|
700
|
-
const settlingAsset = this.
|
|
701
|
-
const productSpecs = this.
|
|
715
|
+
const quotingAsset = this.safeDict(market, 'quoting_asset', {});
|
|
716
|
+
const underlyingAsset = this.safeDict(market, 'underlying_asset', {});
|
|
717
|
+
const settlingAsset = this.safeDict(market, 'settling_asset');
|
|
718
|
+
const productSpecs = this.safeDict(market, 'product_specs', {});
|
|
702
719
|
const baseId = this.safeString(underlyingAsset, 'symbol');
|
|
703
720
|
const quoteId = this.safeString(quotingAsset, 'symbol');
|
|
704
721
|
const settleId = this.safeString(settlingAsset, 'symbol');
|
|
@@ -931,7 +948,7 @@ class delta extends delta$1 {
|
|
|
931
948
|
const marketId = this.safeString(ticker, 'symbol');
|
|
932
949
|
const symbol = this.safeSymbol(marketId, market);
|
|
933
950
|
const last = this.safeString(ticker, 'close');
|
|
934
|
-
const quotes = this.
|
|
951
|
+
const quotes = this.safeDict(ticker, 'quotes', {});
|
|
935
952
|
return this.safeTicker({
|
|
936
953
|
'symbol': symbol,
|
|
937
954
|
'timestamp': timestamp,
|
|
@@ -1095,7 +1112,7 @@ class delta extends delta$1 {
|
|
|
1095
1112
|
// "success": true
|
|
1096
1113
|
// }
|
|
1097
1114
|
//
|
|
1098
|
-
const result = this.
|
|
1115
|
+
const result = this.safeDict(response, 'result', {});
|
|
1099
1116
|
return this.parseTicker(result, market);
|
|
1100
1117
|
}
|
|
1101
1118
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
@@ -1241,7 +1258,7 @@ class delta extends delta$1 {
|
|
|
1241
1258
|
// "success":true
|
|
1242
1259
|
// }
|
|
1243
1260
|
//
|
|
1244
|
-
const tickers = this.
|
|
1261
|
+
const tickers = this.safeList(response, 'result', []);
|
|
1245
1262
|
const result = {};
|
|
1246
1263
|
for (let i = 0; i < tickers.length; i++) {
|
|
1247
1264
|
const ticker = this.parseTicker(tickers[i]);
|
|
@@ -1288,7 +1305,7 @@ class delta extends delta$1 {
|
|
|
1288
1305
|
// "success":true
|
|
1289
1306
|
// }
|
|
1290
1307
|
//
|
|
1291
|
-
const result = this.
|
|
1308
|
+
const result = this.safeDict(response, 'result', {});
|
|
1292
1309
|
return this.parseOrderBook(result, market['symbol'], undefined, 'buy', 'sell', 'price', 'size');
|
|
1293
1310
|
}
|
|
1294
1311
|
parseTrade(trade, market = undefined) {
|
|
@@ -1345,7 +1362,7 @@ class delta extends delta$1 {
|
|
|
1345
1362
|
timestamp = this.safeIntegerProduct(trade, 'timestamp', 0.001, timestamp);
|
|
1346
1363
|
const priceString = this.safeString(trade, 'price');
|
|
1347
1364
|
const amountString = this.safeString(trade, 'size');
|
|
1348
|
-
const product = this.
|
|
1365
|
+
const product = this.safeDict(trade, 'product', {});
|
|
1349
1366
|
const marketId = this.safeString(product, 'symbol');
|
|
1350
1367
|
const symbol = this.safeSymbol(marketId, market);
|
|
1351
1368
|
const sellerRole = this.safeString(trade, 'seller_role');
|
|
@@ -1359,7 +1376,7 @@ class delta extends delta$1 {
|
|
|
1359
1376
|
}
|
|
1360
1377
|
}
|
|
1361
1378
|
const takerOrMaker = this.safeString(trade, 'role');
|
|
1362
|
-
const metaData = this.
|
|
1379
|
+
const metaData = this.safeDict(trade, 'meta_data', {});
|
|
1363
1380
|
let type = this.safeString(metaData, 'order_type');
|
|
1364
1381
|
if (type !== undefined) {
|
|
1365
1382
|
type = type.replace('_order', '');
|
|
@@ -1367,7 +1384,7 @@ class delta extends delta$1 {
|
|
|
1367
1384
|
const feeCostString = this.safeString(trade, 'commission');
|
|
1368
1385
|
let fee = undefined;
|
|
1369
1386
|
if (feeCostString !== undefined) {
|
|
1370
|
-
const settlingAsset = this.
|
|
1387
|
+
const settlingAsset = this.safeDict(product, 'settling_asset', {});
|
|
1371
1388
|
const feeCurrencyId = this.safeString(settlingAsset, 'symbol');
|
|
1372
1389
|
const feeCurrencyCode = this.safeCurrencyCode(feeCurrencyId);
|
|
1373
1390
|
fee = {
|
|
@@ -1424,7 +1441,7 @@ class delta extends delta$1 {
|
|
|
1424
1441
|
// "success":true
|
|
1425
1442
|
// }
|
|
1426
1443
|
//
|
|
1427
|
-
const result = this.
|
|
1444
|
+
const result = this.safeList(response, 'result', []);
|
|
1428
1445
|
return this.parseTrades(result, market, since, limit);
|
|
1429
1446
|
}
|
|
1430
1447
|
parseOHLCV(ohlcv, market = undefined) {
|
|
@@ -1499,17 +1516,17 @@ class delta extends delta$1 {
|
|
|
1499
1516
|
// ]
|
|
1500
1517
|
// }
|
|
1501
1518
|
//
|
|
1502
|
-
const result = this.
|
|
1519
|
+
const result = this.safeList(response, 'result', []);
|
|
1503
1520
|
return this.parseOHLCVs(result, market, timeframe, since, limit);
|
|
1504
1521
|
}
|
|
1505
1522
|
parseBalance(response) {
|
|
1506
|
-
const balances = this.
|
|
1523
|
+
const balances = this.safeList(response, 'result', []);
|
|
1507
1524
|
const result = { 'info': response };
|
|
1508
|
-
const currenciesByNumericId = this.
|
|
1525
|
+
const currenciesByNumericId = this.safeDict(this.options, 'currenciesByNumericId', {});
|
|
1509
1526
|
for (let i = 0; i < balances.length; i++) {
|
|
1510
1527
|
const balance = balances[i];
|
|
1511
1528
|
const currencyId = this.safeString(balance, 'asset_id');
|
|
1512
|
-
const currency = this.
|
|
1529
|
+
const currency = this.safeDict(currenciesByNumericId, currencyId);
|
|
1513
1530
|
const code = (currency === undefined) ? currencyId : currency['code'];
|
|
1514
1531
|
const account = this.account();
|
|
1515
1532
|
account['total'] = this.safeString(balance, 'balance');
|
|
@@ -1578,7 +1595,7 @@ class delta extends delta$1 {
|
|
|
1578
1595
|
// "success":true
|
|
1579
1596
|
// }
|
|
1580
1597
|
//
|
|
1581
|
-
const result = this.
|
|
1598
|
+
const result = this.safeDict(response, 'result', {});
|
|
1582
1599
|
return this.parsePosition(result, market);
|
|
1583
1600
|
}
|
|
1584
1601
|
async fetchPositions(symbols = undefined, params = {}) {
|
|
@@ -1614,7 +1631,7 @@ class delta extends delta$1 {
|
|
|
1614
1631
|
// ]
|
|
1615
1632
|
// }
|
|
1616
1633
|
//
|
|
1617
|
-
const result = this.
|
|
1634
|
+
const result = this.safeList(response, 'result', []);
|
|
1618
1635
|
return this.parsePositions(result, symbols);
|
|
1619
1636
|
}
|
|
1620
1637
|
parsePosition(position, market = undefined) {
|
|
@@ -1736,7 +1753,7 @@ class delta extends delta$1 {
|
|
|
1736
1753
|
const clientOrderId = this.safeString(order, 'client_order_id');
|
|
1737
1754
|
const timestamp = this.parse8601(this.safeString(order, 'created_at'));
|
|
1738
1755
|
const marketId = this.safeString(order, 'product_id');
|
|
1739
|
-
const marketsByNumericId = this.
|
|
1756
|
+
const marketsByNumericId = this.safeDict(this.options, 'marketsByNumericId', {});
|
|
1740
1757
|
market = this.safeValue(marketsByNumericId, marketId, market);
|
|
1741
1758
|
const symbol = (market === undefined) ? marketId : market['symbol'];
|
|
1742
1759
|
const status = this.parseOrderStatus(this.safeString(order, 'state'));
|
|
@@ -1752,7 +1769,7 @@ class delta extends delta$1 {
|
|
|
1752
1769
|
if (feeCostString !== undefined) {
|
|
1753
1770
|
let feeCurrencyCode = undefined;
|
|
1754
1771
|
if (market !== undefined) {
|
|
1755
|
-
const settlingAsset = this.
|
|
1772
|
+
const settlingAsset = this.safeDict(market['info'], 'settling_asset', {});
|
|
1756
1773
|
const feeCurrencyId = this.safeString(settlingAsset, 'symbol');
|
|
1757
1774
|
feeCurrencyCode = this.safeCurrencyCode(feeCurrencyId);
|
|
1758
1775
|
}
|
|
@@ -1819,7 +1836,7 @@ class delta extends delta$1 {
|
|
|
1819
1836
|
if (clientOrderId !== undefined) {
|
|
1820
1837
|
request['client_order_id'] = clientOrderId;
|
|
1821
1838
|
}
|
|
1822
|
-
const reduceOnly = this.
|
|
1839
|
+
const reduceOnly = this.safeBool(params, 'reduceOnly');
|
|
1823
1840
|
if (reduceOnly) {
|
|
1824
1841
|
request['reduce_only'] = reduceOnly;
|
|
1825
1842
|
params = this.omit(params, 'reduceOnly');
|
|
@@ -1861,7 +1878,7 @@ class delta extends delta$1 {
|
|
|
1861
1878
|
// "success":true
|
|
1862
1879
|
// }
|
|
1863
1880
|
//
|
|
1864
|
-
const result = this.
|
|
1881
|
+
const result = this.safeDict(response, 'result', {});
|
|
1865
1882
|
return this.parseOrder(result, market);
|
|
1866
1883
|
}
|
|
1867
1884
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
@@ -1911,7 +1928,7 @@ class delta extends delta$1 {
|
|
|
1911
1928
|
// }
|
|
1912
1929
|
// }
|
|
1913
1930
|
//
|
|
1914
|
-
const result = this.
|
|
1931
|
+
const result = this.safeDict(response, 'result');
|
|
1915
1932
|
return this.parseOrder(result, market);
|
|
1916
1933
|
}
|
|
1917
1934
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
@@ -1971,7 +1988,7 @@ class delta extends delta$1 {
|
|
|
1971
1988
|
// "success":true
|
|
1972
1989
|
// }
|
|
1973
1990
|
//
|
|
1974
|
-
const result = this.
|
|
1991
|
+
const result = this.safeDict(response, 'result');
|
|
1975
1992
|
return this.parseOrder(result, market);
|
|
1976
1993
|
}
|
|
1977
1994
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
@@ -2084,7 +2101,7 @@ class delta extends delta$1 {
|
|
|
2084
2101
|
// }
|
|
2085
2102
|
// }
|
|
2086
2103
|
//
|
|
2087
|
-
const result = this.
|
|
2104
|
+
const result = this.safeList(response, 'result', []);
|
|
2088
2105
|
return this.parseOrders(result, market, since, limit);
|
|
2089
2106
|
}
|
|
2090
2107
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -2166,7 +2183,7 @@ class delta extends delta$1 {
|
|
|
2166
2183
|
// "success":true
|
|
2167
2184
|
// }
|
|
2168
2185
|
//
|
|
2169
|
-
const result = this.
|
|
2186
|
+
const result = this.safeList(response, 'result', []);
|
|
2170
2187
|
return this.parseTrades(result, market, since, limit);
|
|
2171
2188
|
}
|
|
2172
2189
|
async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -2219,7 +2236,7 @@ class delta extends delta$1 {
|
|
|
2219
2236
|
// "success":true
|
|
2220
2237
|
// }
|
|
2221
2238
|
//
|
|
2222
|
-
const result = this.
|
|
2239
|
+
const result = this.safeList(response, 'result', []);
|
|
2223
2240
|
return this.parseLedger(result, currency, since, limit);
|
|
2224
2241
|
}
|
|
2225
2242
|
parseLedgerEntryType(type) {
|
|
@@ -2256,7 +2273,7 @@ class delta extends delta$1 {
|
|
|
2256
2273
|
const id = this.safeString(item, 'uuid');
|
|
2257
2274
|
let direction = undefined;
|
|
2258
2275
|
const account = undefined;
|
|
2259
|
-
const metaData = this.
|
|
2276
|
+
const metaData = this.safeDict(item, 'meta_data', {});
|
|
2260
2277
|
const referenceId = this.safeString(metaData, 'transaction_id');
|
|
2261
2278
|
const referenceAccount = undefined;
|
|
2262
2279
|
let type = this.safeString(item, 'transaction_type');
|
|
@@ -2267,8 +2284,8 @@ class delta extends delta$1 {
|
|
|
2267
2284
|
direction = 'out';
|
|
2268
2285
|
}
|
|
2269
2286
|
type = this.parseLedgerEntryType(type);
|
|
2270
|
-
const currencyId = this.
|
|
2271
|
-
const currenciesByNumericId = this.
|
|
2287
|
+
const currencyId = this.safeString(item, 'asset_id');
|
|
2288
|
+
const currenciesByNumericId = this.safeDict(this.options, 'currenciesByNumericId');
|
|
2272
2289
|
currency = this.safeValue(currenciesByNumericId, currencyId, currency);
|
|
2273
2290
|
const code = (currency === undefined) ? undefined : currency['code'];
|
|
2274
2291
|
const amount = this.safeString(item, 'amount');
|
|
@@ -2332,7 +2349,7 @@ class delta extends delta$1 {
|
|
|
2332
2349
|
// }
|
|
2333
2350
|
// }
|
|
2334
2351
|
//
|
|
2335
|
-
const result = this.
|
|
2352
|
+
const result = this.safeDict(response, 'result', {});
|
|
2336
2353
|
return this.parseDepositAddress(result, currency);
|
|
2337
2354
|
}
|
|
2338
2355
|
parseDepositAddress(depositAddress, currency = undefined) {
|
|
@@ -2426,7 +2443,7 @@ class delta extends delta$1 {
|
|
|
2426
2443
|
// "success": true
|
|
2427
2444
|
// }
|
|
2428
2445
|
//
|
|
2429
|
-
const result = this.
|
|
2446
|
+
const result = this.safeDict(response, 'result', {});
|
|
2430
2447
|
return this.parseFundingRate(result, market);
|
|
2431
2448
|
}
|
|
2432
2449
|
async fetchFundingRates(symbols = undefined, params = {}) {
|
|
@@ -2492,7 +2509,7 @@ class delta extends delta$1 {
|
|
|
2492
2509
|
// "success":true
|
|
2493
2510
|
// }
|
|
2494
2511
|
//
|
|
2495
|
-
const rates = this.
|
|
2512
|
+
const rates = this.safeList(response, 'result', []);
|
|
2496
2513
|
const result = this.parseFundingRates(rates);
|
|
2497
2514
|
return this.filterByArray(result, 'symbol', symbols);
|
|
2498
2515
|
}
|
|
@@ -2624,7 +2641,7 @@ class delta extends delta$1 {
|
|
|
2624
2641
|
// "success": true
|
|
2625
2642
|
// }
|
|
2626
2643
|
//
|
|
2627
|
-
const result = this.
|
|
2644
|
+
const result = this.safeDict(response, 'result', {});
|
|
2628
2645
|
return this.parseMarginModification(result, market);
|
|
2629
2646
|
}
|
|
2630
2647
|
parseMarginModification(data, market = undefined) {
|
|
@@ -2731,7 +2748,7 @@ class delta extends delta$1 {
|
|
|
2731
2748
|
// "success": true
|
|
2732
2749
|
// }
|
|
2733
2750
|
//
|
|
2734
|
-
const result = this.
|
|
2751
|
+
const result = this.safeDict(response, 'result', {});
|
|
2735
2752
|
return this.parseOpenInterest(result, market);
|
|
2736
2753
|
}
|
|
2737
2754
|
parseOpenInterest(interest, market = undefined) {
|
|
@@ -2955,7 +2972,7 @@ class delta extends delta$1 {
|
|
|
2955
2972
|
// "success": true
|
|
2956
2973
|
// }
|
|
2957
2974
|
//
|
|
2958
|
-
const result = this.
|
|
2975
|
+
const result = this.safeList(response, 'result', []);
|
|
2959
2976
|
const settlements = this.parseSettlements(result, market);
|
|
2960
2977
|
const sorted = this.sortBy(settlements, 'timestamp');
|
|
2961
2978
|
return this.filterBySymbolSinceLimit(sorted, market['symbol'], since, limit);
|
|
@@ -3099,7 +3116,7 @@ class delta extends delta$1 {
|
|
|
3099
3116
|
// "success": true
|
|
3100
3117
|
// }
|
|
3101
3118
|
//
|
|
3102
|
-
const result = this.
|
|
3119
|
+
const result = this.safeDict(response, 'result', {});
|
|
3103
3120
|
return this.parseGreeks(result, market);
|
|
3104
3121
|
}
|
|
3105
3122
|
parseGreeks(greeks, market = undefined) {
|
|
@@ -3155,8 +3172,8 @@ class delta extends delta$1 {
|
|
|
3155
3172
|
const timestamp = this.safeIntegerProduct(greeks, 'timestamp', 0.001);
|
|
3156
3173
|
const marketId = this.safeString(greeks, 'symbol');
|
|
3157
3174
|
const symbol = this.safeSymbol(marketId, market);
|
|
3158
|
-
const stats = this.
|
|
3159
|
-
const quotes = this.
|
|
3175
|
+
const stats = this.safeDict(greeks, 'greeks', {});
|
|
3176
|
+
const quotes = this.safeDict(greeks, 'quotes', {});
|
|
3160
3177
|
return {
|
|
3161
3178
|
'symbol': symbol,
|
|
3162
3179
|
'timestamp': timestamp,
|
|
@@ -3199,7 +3216,7 @@ class delta extends delta$1 {
|
|
|
3199
3216
|
//
|
|
3200
3217
|
// {"result":{},"success":true}
|
|
3201
3218
|
//
|
|
3202
|
-
const position = this.parsePosition(this.
|
|
3219
|
+
const position = this.parsePosition(this.safeDict(response, 'result', {}));
|
|
3203
3220
|
return [position];
|
|
3204
3221
|
}
|
|
3205
3222
|
async fetchMarginMode(symbol, params = {}) {
|
|
@@ -3336,7 +3353,7 @@ class delta extends delta$1 {
|
|
|
3336
3353
|
//
|
|
3337
3354
|
// {"error":{"code":"insufficient_margin","context":{"available_balance":"0.000000000000000000","required_additional_balance":"1.618626000000000000000000000"}},"success":false}
|
|
3338
3355
|
//
|
|
3339
|
-
const error = this.
|
|
3356
|
+
const error = this.safeDict(response, 'error', {});
|
|
3340
3357
|
const errorCode = this.safeString(error, 'code');
|
|
3341
3358
|
if (errorCode !== undefined) {
|
|
3342
3359
|
const feedback = this.id + ' ' + body;
|
package/dist/cjs/src/kraken.js
CHANGED
|
@@ -452,7 +452,7 @@ class kraken extends kraken$1 {
|
|
|
452
452
|
* @method
|
|
453
453
|
* @name kraken#fetchMarkets
|
|
454
454
|
* @description retrieves data on all markets for kraken
|
|
455
|
-
* @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getTradableAssetPairs
|
|
455
|
+
* @see https://docs.kraken.com/rest/#tag/Spot-Market-Data/operation/getTradableAssetPairs
|
|
456
456
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
457
457
|
* @returns {object[]} an array of objects representing market data
|
|
458
458
|
*/
|
|
@@ -639,7 +639,7 @@ class kraken extends kraken$1 {
|
|
|
639
639
|
* @method
|
|
640
640
|
* @name kraken#fetchCurrencies
|
|
641
641
|
* @description fetches all available currencies on an exchange
|
|
642
|
-
* @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getAssetInfo
|
|
642
|
+
* @see https://docs.kraken.com/rest/#tag/Spot-Market-Data/operation/getAssetInfo
|
|
643
643
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
644
644
|
* @returns {object} an associative dictionary of currencies
|
|
645
645
|
*/
|
|
@@ -767,7 +767,7 @@ class kraken extends kraken$1 {
|
|
|
767
767
|
* @method
|
|
768
768
|
* @name kraken#fetchOrderBook
|
|
769
769
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
770
|
-
* @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getOrderBook
|
|
770
|
+
* @see https://docs.kraken.com/rest/#tag/Spot-Market-Data/operation/getOrderBook
|
|
771
771
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
772
772
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
773
773
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -869,7 +869,7 @@ class kraken extends kraken$1 {
|
|
|
869
869
|
* @method
|
|
870
870
|
* @name kraken#fetchTickers
|
|
871
871
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
872
|
-
* @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getTickerInformation
|
|
872
|
+
* @see https://docs.kraken.com/rest/#tag/Spot-Market-Data/operation/getTickerInformation
|
|
873
873
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
874
874
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
875
875
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -906,7 +906,7 @@ class kraken extends kraken$1 {
|
|
|
906
906
|
* @method
|
|
907
907
|
* @name kraken#fetchTicker
|
|
908
908
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
909
|
-
* @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getTickerInformation
|
|
909
|
+
* @see https://docs.kraken.com/rest/#tag/Spot-Market-Data/operation/getTickerInformation
|
|
910
910
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
911
911
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
912
912
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -951,7 +951,7 @@ class kraken extends kraken$1 {
|
|
|
951
951
|
* @method
|
|
952
952
|
* @name kraken#fetchOHLCV
|
|
953
953
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
954
|
-
* @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getOHLCData
|
|
954
|
+
* @see https://docs.kraken.com/rest/#tag/Spot-Market-Data/operation/getOHLCData
|
|
955
955
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
956
956
|
* @param {string} timeframe the length of time each candle represents
|
|
957
957
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -1249,7 +1249,7 @@ class kraken extends kraken$1 {
|
|
|
1249
1249
|
* @method
|
|
1250
1250
|
* @name kraken#fetchTrades
|
|
1251
1251
|
* @description get the list of most recent trades for a particular symbol
|
|
1252
|
-
* @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getRecentTrades
|
|
1252
|
+
* @see https://docs.kraken.com/rest/#tag/Spot-Market-Data/operation/getRecentTrades
|
|
1253
1253
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
1254
1254
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
1255
1255
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -2413,7 +2413,7 @@ class kraken extends kraken$1 {
|
|
|
2413
2413
|
* @method
|
|
2414
2414
|
* @name kraken#fetchTime
|
|
2415
2415
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
2416
|
-
* @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getServerTime
|
|
2416
|
+
* @see https://docs.kraken.com/rest/#tag/Spot-Market-Data/operation/getServerTime
|
|
2417
2417
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2418
2418
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
2419
2419
|
*/
|
package/dist/cjs/src/kucoin.js
CHANGED
|
@@ -52,8 +52,8 @@ class kucoin extends kucoin$1 {
|
|
|
52
52
|
'fetchAccounts': true,
|
|
53
53
|
'fetchBalance': true,
|
|
54
54
|
'fetchBorrowInterest': true,
|
|
55
|
-
'fetchBorrowRateHistories':
|
|
56
|
-
'fetchBorrowRateHistory':
|
|
55
|
+
'fetchBorrowRateHistories': true,
|
|
56
|
+
'fetchBorrowRateHistory': true,
|
|
57
57
|
'fetchClosedOrders': true,
|
|
58
58
|
'fetchCrossBorrowRate': false,
|
|
59
59
|
'fetchCrossBorrowRates': false,
|
|
@@ -227,6 +227,7 @@ class kucoin extends kucoin$1 {
|
|
|
227
227
|
'isolated/account/{symbol}': 50,
|
|
228
228
|
'margin/borrow': 15,
|
|
229
229
|
'margin/repay': 15,
|
|
230
|
+
'margin/interest': 20,
|
|
230
231
|
'project/list': 10,
|
|
231
232
|
'project/marketInterestRate': 7.5,
|
|
232
233
|
'redeem/orders': 10,
|
|
@@ -588,6 +589,7 @@ class kucoin extends kucoin$1 {
|
|
|
588
589
|
'margin/currencies': 'v3',
|
|
589
590
|
'margin/borrow': 'v3',
|
|
590
591
|
'margin/repay': 'v3',
|
|
592
|
+
'margin/interest': 'v3',
|
|
591
593
|
'project/list': 'v3',
|
|
592
594
|
'project/marketInterestRate': 'v3',
|
|
593
595
|
'redeem/orders': 'v3',
|
|
@@ -4042,12 +4044,19 @@ class kucoin extends kucoin$1 {
|
|
|
4042
4044
|
// "timestamp": 1658531274508488480
|
|
4043
4045
|
// },
|
|
4044
4046
|
//
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
+
// {
|
|
4048
|
+
// "createdAt": 1697783812257,
|
|
4049
|
+
// "currency": "XMR",
|
|
4050
|
+
// "interestAmount": "0.1",
|
|
4051
|
+
// "dayRatio": "0.001"
|
|
4052
|
+
// }
|
|
4053
|
+
//
|
|
4054
|
+
const timestampId = this.safeString2(info, 'createdAt', 'timestamp');
|
|
4055
|
+
const timestamp = this.parseToInt(timestampId.slice(0, 13));
|
|
4047
4056
|
const currencyId = this.safeString(info, 'currency');
|
|
4048
4057
|
return {
|
|
4049
4058
|
'currency': this.safeCurrencyCode(currencyId, currency),
|
|
4050
|
-
'rate': this.
|
|
4059
|
+
'rate': this.safeNumber2(info, 'dailyIntRate', 'dayRatio'),
|
|
4051
4060
|
'period': 86400000,
|
|
4052
4061
|
'timestamp': timestamp,
|
|
4053
4062
|
'datetime': this.iso8601(timestamp),
|
|
@@ -4231,6 +4240,144 @@ class kucoin extends kucoin$1 {
|
|
|
4231
4240
|
'info': info,
|
|
4232
4241
|
};
|
|
4233
4242
|
}
|
|
4243
|
+
async fetchBorrowRateHistories(codes = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4244
|
+
/**
|
|
4245
|
+
* @method
|
|
4246
|
+
* @name kucoin#fetchBorrowRateHistories
|
|
4247
|
+
* @description retrieves a history of a multiple currencies borrow interest rate at specific time slots, returns all currencies if no symbols passed, default is undefined
|
|
4248
|
+
* @see https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/get-cross-isolated-margin-interest-records
|
|
4249
|
+
* @param {string[]|undefined} codes list of unified currency codes, default is undefined
|
|
4250
|
+
* @param {int} [since] timestamp in ms of the earliest borrowRate, default is undefined
|
|
4251
|
+
* @param {int} [limit] max number of borrow rate prices to return, default is undefined
|
|
4252
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4253
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated' default is 'cross'
|
|
4254
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4255
|
+
* @returns {object} a dictionary of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} indexed by the market symbol
|
|
4256
|
+
*/
|
|
4257
|
+
await this.loadMarkets();
|
|
4258
|
+
const marginResult = this.handleMarginModeAndParams('fetchBorrowRateHistories', params);
|
|
4259
|
+
const marginMode = this.safeString(marginResult, 0, 'cross');
|
|
4260
|
+
const isIsolated = (marginMode === 'isolated'); // true-isolated, false-cross
|
|
4261
|
+
let request = {
|
|
4262
|
+
'isIsolated': isIsolated,
|
|
4263
|
+
};
|
|
4264
|
+
if (since !== undefined) {
|
|
4265
|
+
request['startTime'] = since;
|
|
4266
|
+
}
|
|
4267
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
4268
|
+
if (limit !== undefined) {
|
|
4269
|
+
request['pageSize'] = limit; // default:50, min:10, max:500
|
|
4270
|
+
}
|
|
4271
|
+
const response = await this.privateGetMarginInterest(this.extend(request, params));
|
|
4272
|
+
//
|
|
4273
|
+
// {
|
|
4274
|
+
// "code": "200000",
|
|
4275
|
+
// "data": {
|
|
4276
|
+
// "timestamp": 1710829939673,
|
|
4277
|
+
// "currentPage": 1,
|
|
4278
|
+
// "pageSize": 50,
|
|
4279
|
+
// "totalNum": 0,
|
|
4280
|
+
// "totalPage": 0,
|
|
4281
|
+
// "items": [
|
|
4282
|
+
// {
|
|
4283
|
+
// "createdAt": 1697783812257,
|
|
4284
|
+
// "currency": "XMR",
|
|
4285
|
+
// "interestAmount": "0.1",
|
|
4286
|
+
// "dayRatio": "0.001"
|
|
4287
|
+
// }
|
|
4288
|
+
// ]
|
|
4289
|
+
// }
|
|
4290
|
+
// }
|
|
4291
|
+
//
|
|
4292
|
+
const data = this.safeDict(response, 'data');
|
|
4293
|
+
const rows = this.safeList(data, 'items');
|
|
4294
|
+
return this.parseBorrowRateHistories(rows, codes, since, limit);
|
|
4295
|
+
}
|
|
4296
|
+
async fetchBorrowRateHistory(code, since = undefined, limit = undefined, params = {}) {
|
|
4297
|
+
/**
|
|
4298
|
+
* @method
|
|
4299
|
+
* @name kucoin#fetchBorrowRateHistory
|
|
4300
|
+
* @description retrieves a history of a currencies borrow interest rate at specific time slots
|
|
4301
|
+
* @see https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/get-cross-isolated-margin-interest-records
|
|
4302
|
+
* @param {string} code unified currency code
|
|
4303
|
+
* @param {int} [since] timestamp for the earliest borrow rate
|
|
4304
|
+
* @param {int} [limit] the maximum number of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} to retrieve
|
|
4305
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4306
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated' default is 'cross'
|
|
4307
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4308
|
+
* @returns {object[]} an array of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
4309
|
+
*/
|
|
4310
|
+
await this.loadMarkets();
|
|
4311
|
+
const marginResult = this.handleMarginModeAndParams('fetchBorrowRateHistories', params);
|
|
4312
|
+
const marginMode = this.safeString(marginResult, 0, 'cross');
|
|
4313
|
+
const isIsolated = (marginMode === 'isolated'); // true-isolated, false-cross
|
|
4314
|
+
const currency = this.currency(code);
|
|
4315
|
+
let request = {
|
|
4316
|
+
'isIsolated': isIsolated,
|
|
4317
|
+
'currency': currency['id'],
|
|
4318
|
+
};
|
|
4319
|
+
if (since !== undefined) {
|
|
4320
|
+
request['startTime'] = since;
|
|
4321
|
+
}
|
|
4322
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
4323
|
+
if (limit !== undefined) {
|
|
4324
|
+
request['pageSize'] = limit; // default:50, min:10, max:500
|
|
4325
|
+
}
|
|
4326
|
+
const response = await this.privateGetMarginInterest(this.extend(request, params));
|
|
4327
|
+
//
|
|
4328
|
+
// {
|
|
4329
|
+
// "code": "200000",
|
|
4330
|
+
// "data": {
|
|
4331
|
+
// "timestamp": 1710829939673,
|
|
4332
|
+
// "currentPage": 1,
|
|
4333
|
+
// "pageSize": 50,
|
|
4334
|
+
// "totalNum": 0,
|
|
4335
|
+
// "totalPage": 0,
|
|
4336
|
+
// "items": [
|
|
4337
|
+
// {
|
|
4338
|
+
// "createdAt": 1697783812257,
|
|
4339
|
+
// "currency": "XMR",
|
|
4340
|
+
// "interestAmount": "0.1",
|
|
4341
|
+
// "dayRatio": "0.001"
|
|
4342
|
+
// }
|
|
4343
|
+
// ]
|
|
4344
|
+
// }
|
|
4345
|
+
// }
|
|
4346
|
+
//
|
|
4347
|
+
const data = this.safeDict(response, 'data');
|
|
4348
|
+
const rows = this.safeList(data, 'items');
|
|
4349
|
+
return this.parseBorrowRateHistory(rows, code, since, limit);
|
|
4350
|
+
}
|
|
4351
|
+
parseBorrowRateHistories(response, codes, since, limit) {
|
|
4352
|
+
//
|
|
4353
|
+
// [
|
|
4354
|
+
// {
|
|
4355
|
+
// "createdAt": 1697783812257,
|
|
4356
|
+
// "currency": "XMR",
|
|
4357
|
+
// "interestAmount": "0.1",
|
|
4358
|
+
// "dayRatio": "0.001"
|
|
4359
|
+
// }
|
|
4360
|
+
// ]
|
|
4361
|
+
//
|
|
4362
|
+
const borrowRateHistories = {};
|
|
4363
|
+
for (let i = 0; i < response.length; i++) {
|
|
4364
|
+
const item = response[i];
|
|
4365
|
+
const code = this.safeCurrencyCode(this.safeString(item, 'currency'));
|
|
4366
|
+
if (codes === undefined || this.inArray(code, codes)) {
|
|
4367
|
+
if (!(code in borrowRateHistories)) {
|
|
4368
|
+
borrowRateHistories[code] = [];
|
|
4369
|
+
}
|
|
4370
|
+
const borrowRateStructure = this.parseBorrowRate(item);
|
|
4371
|
+
borrowRateHistories[code].push(borrowRateStructure);
|
|
4372
|
+
}
|
|
4373
|
+
}
|
|
4374
|
+
const keys = Object.keys(borrowRateHistories);
|
|
4375
|
+
for (let i = 0; i < keys.length; i++) {
|
|
4376
|
+
const code = keys[i];
|
|
4377
|
+
borrowRateHistories[code] = this.filterByCurrencySinceLimit(borrowRateHistories[code], code, since, limit);
|
|
4378
|
+
}
|
|
4379
|
+
return borrowRateHistories;
|
|
4380
|
+
}
|
|
4234
4381
|
async borrowCrossMargin(code, amount, params = {}) {
|
|
4235
4382
|
/**
|
|
4236
4383
|
* @method
|