ccxt 4.4.16 → 4.4.17
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/base/Exchange.js +13 -0
- package/dist/cjs/src/binance.js +11 -4
- package/dist/cjs/src/bingx.js +59 -0
- package/dist/cjs/src/bitvavo.js +2 -2
- package/dist/cjs/src/bybit.js +7 -3
- package/dist/cjs/src/coinbaseinternational.js +3 -8
- package/dist/cjs/src/kuna.js +3 -12
- package/dist/cjs/src/mexc.js +1 -0
- package/dist/cjs/src/okx.js +35 -1
- package/dist/cjs/src/timex.js +3 -8
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/mexc.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +2 -0
- package/js/src/base/Exchange.js +13 -0
- package/js/src/binance.js +11 -4
- package/js/src/bingx.d.ts +1 -0
- package/js/src/bingx.js +59 -0
- package/js/src/bitvavo.d.ts +1 -1
- package/js/src/bitvavo.js +2 -2
- package/js/src/bybit.js +7 -3
- package/js/src/coinbaseinternational.d.ts +1 -19
- package/js/src/coinbaseinternational.js +3 -8
- package/js/src/kuna.d.ts +1 -25
- package/js/src/kuna.js +3 -12
- package/js/src/mexc.js +1 -0
- package/js/src/okx.d.ts +1 -0
- package/js/src/okx.js +35 -1
- package/js/src/timex.d.ts +1 -23
- package/js/src/timex.js +3 -8
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -194,7 +194,7 @@ var xt$1 = require('./src/pro/xt.js');
|
|
|
194
194
|
|
|
195
195
|
//-----------------------------------------------------------------------------
|
|
196
196
|
// this is updated by vss.js when building
|
|
197
|
-
const version = '4.4.
|
|
197
|
+
const version = '4.4.17';
|
|
198
198
|
Exchange["default"].ccxtVersion = version;
|
|
199
199
|
const exchanges = {
|
|
200
200
|
'ace': ace,
|
|
@@ -2078,6 +2078,19 @@ class Exchange {
|
|
|
2078
2078
|
async fetchTradingLimits(symbols = undefined, params = {}) {
|
|
2079
2079
|
throw new errors.NotSupported(this.id + ' fetchTradingLimits() is not supported yet');
|
|
2080
2080
|
}
|
|
2081
|
+
parseCurrency(rawCurrency) {
|
|
2082
|
+
throw new errors.NotSupported(this.id + ' parseCurrency() is not supported yet');
|
|
2083
|
+
}
|
|
2084
|
+
parseCurrencies(rawCurrencies) {
|
|
2085
|
+
const result = {};
|
|
2086
|
+
const arr = this.toArray(rawCurrencies);
|
|
2087
|
+
for (let i = 0; i < arr.length; i++) {
|
|
2088
|
+
const parsed = this.parseCurrency(arr[i]);
|
|
2089
|
+
const code = parsed['code'];
|
|
2090
|
+
result[code] = parsed;
|
|
2091
|
+
}
|
|
2092
|
+
return result;
|
|
2093
|
+
}
|
|
2081
2094
|
parseMarket(market) {
|
|
2082
2095
|
throw new errors.NotSupported(this.id + ' parseMarket() is not supported yet');
|
|
2083
2096
|
}
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -2673,11 +2673,18 @@ class binance extends binance$1 {
|
|
|
2673
2673
|
if (apiBackup !== undefined) {
|
|
2674
2674
|
return undefined;
|
|
2675
2675
|
}
|
|
2676
|
-
const promises = [this.sapiGetCapitalConfigGetall(params)
|
|
2676
|
+
const promises = [this.sapiGetCapitalConfigGetall(params)];
|
|
2677
|
+
const fetchMargins = this.safeBool(this.options, 'fetchMargins', false);
|
|
2678
|
+
if (fetchMargins) {
|
|
2679
|
+
promises.push(this.sapiGetMarginAllPairs(params));
|
|
2680
|
+
}
|
|
2677
2681
|
const results = await Promise.all(promises);
|
|
2678
2682
|
const responseCurrencies = results[0];
|
|
2679
|
-
|
|
2680
|
-
|
|
2683
|
+
let marginablesById = undefined;
|
|
2684
|
+
if (fetchMargins) {
|
|
2685
|
+
const responseMarginables = results[1];
|
|
2686
|
+
marginablesById = this.indexBy(responseMarginables, 'assetName');
|
|
2687
|
+
}
|
|
2681
2688
|
const result = {};
|
|
2682
2689
|
for (let i = 0; i < responseCurrencies.length; i++) {
|
|
2683
2690
|
//
|
|
@@ -4249,7 +4256,7 @@ class binance extends binance$1 {
|
|
|
4249
4256
|
* @description fetches mark price for the market
|
|
4250
4257
|
* @see https://binance-docs.github.io/apidocs/futures/en/#mark-price
|
|
4251
4258
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#index-price-and-mark-price
|
|
4252
|
-
* @param {string
|
|
4259
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
4253
4260
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4254
4261
|
* @param {string} [params.subType] "linear" or "inverse"
|
|
4255
4262
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -66,6 +66,7 @@ class bingx extends bingx$1 {
|
|
|
66
66
|
'fetchMarginMode': true,
|
|
67
67
|
'fetchMarkets': true,
|
|
68
68
|
'fetchMarkOHLCV': true,
|
|
69
|
+
'fetchMarkPrice': true,
|
|
69
70
|
'fetchMarkPrices': true,
|
|
70
71
|
'fetchMyLiquidations': true,
|
|
71
72
|
'fetchOHLCV': true,
|
|
@@ -1731,6 +1732,64 @@ class bingx extends bingx$1 {
|
|
|
1731
1732
|
const tickers = this.safeList(response, 'data');
|
|
1732
1733
|
return this.parseTickers(tickers, symbols);
|
|
1733
1734
|
}
|
|
1735
|
+
async fetchMarkPrice(symbol, params = {}) {
|
|
1736
|
+
/**
|
|
1737
|
+
* @method
|
|
1738
|
+
* @name bingx#fetchMarkPrice
|
|
1739
|
+
* @description fetches mark prices for the market
|
|
1740
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Mark%20Price%20and%20Funding%20Rate
|
|
1741
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
1742
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1743
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1744
|
+
*/
|
|
1745
|
+
await this.loadMarkets();
|
|
1746
|
+
const market = this.market(symbol);
|
|
1747
|
+
let subType = undefined;
|
|
1748
|
+
[subType, params] = this.handleSubTypeAndParams('fetchMarkPrice', market, params, 'linear');
|
|
1749
|
+
const request = {
|
|
1750
|
+
'symbol': market['id'],
|
|
1751
|
+
};
|
|
1752
|
+
let response = undefined;
|
|
1753
|
+
if (subType === 'inverse') {
|
|
1754
|
+
response = await this.cswapV1PublicGetMarketPremiumIndex(this.extend(request, params));
|
|
1755
|
+
//
|
|
1756
|
+
// {
|
|
1757
|
+
// "code": 0,
|
|
1758
|
+
// "msg": "",
|
|
1759
|
+
// "timestamp": 1728577213289,
|
|
1760
|
+
// "data": [
|
|
1761
|
+
// {
|
|
1762
|
+
// "symbol": "ETH-USD",
|
|
1763
|
+
// "lastFundingRate": "0.0001",
|
|
1764
|
+
// "markPrice": "2402.68",
|
|
1765
|
+
// "indexPrice": "2404.92",
|
|
1766
|
+
// "nextFundingTime": 1728604800000
|
|
1767
|
+
// }
|
|
1768
|
+
// ]
|
|
1769
|
+
// }
|
|
1770
|
+
//
|
|
1771
|
+
}
|
|
1772
|
+
else {
|
|
1773
|
+
response = await this.swapV2PublicGetQuotePremiumIndex(this.extend(request, params));
|
|
1774
|
+
//
|
|
1775
|
+
// {
|
|
1776
|
+
// "code": 0,
|
|
1777
|
+
// "msg": "",
|
|
1778
|
+
// "data": {
|
|
1779
|
+
// "symbol": "ETH-USDT",
|
|
1780
|
+
// "markPrice": "2408.40",
|
|
1781
|
+
// "indexPrice": "2409.62",
|
|
1782
|
+
// "lastFundingRate": "0.00009900",
|
|
1783
|
+
// "nextFundingTime": 1728604800000
|
|
1784
|
+
// }
|
|
1785
|
+
// }
|
|
1786
|
+
//
|
|
1787
|
+
}
|
|
1788
|
+
if (Array.isArray(response['data'])) {
|
|
1789
|
+
return this.parseTicker(this.safeDict(response['data'], 0, {}), market);
|
|
1790
|
+
}
|
|
1791
|
+
return this.parseTicker(response['data'], market);
|
|
1792
|
+
}
|
|
1734
1793
|
async fetchMarkPrices(symbols = undefined, params = {}) {
|
|
1735
1794
|
/**
|
|
1736
1795
|
* @method
|
package/dist/cjs/src/bitvavo.js
CHANGED
|
@@ -447,9 +447,9 @@ class bitvavo extends bitvavo$1 {
|
|
|
447
447
|
// },
|
|
448
448
|
// ]
|
|
449
449
|
//
|
|
450
|
-
return this.
|
|
450
|
+
return this.parseCurrenciesCustom(response);
|
|
451
451
|
}
|
|
452
|
-
|
|
452
|
+
parseCurrenciesCustom(currencies) {
|
|
453
453
|
//
|
|
454
454
|
// [
|
|
455
455
|
// {
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -4882,7 +4882,7 @@ class bybit extends bybit$1 {
|
|
|
4882
4882
|
const length = result.length;
|
|
4883
4883
|
if (length === 0) {
|
|
4884
4884
|
const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
|
|
4885
|
-
const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
|
|
4885
|
+
const extra = isTrigger ? '' : ' If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
|
|
4886
4886
|
throw new errors.OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
|
|
4887
4887
|
}
|
|
4888
4888
|
if (length > 1) {
|
|
@@ -4978,6 +4978,10 @@ class bybit extends bybit$1 {
|
|
|
4978
4978
|
//
|
|
4979
4979
|
const result = this.safeDict(response, 'result', {});
|
|
4980
4980
|
const innerList = this.safeList(result, 'list', []);
|
|
4981
|
+
if (innerList.length === 0) {
|
|
4982
|
+
const extra = isTrigger ? '' : ' If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
|
|
4983
|
+
throw new errors.OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
|
|
4984
|
+
}
|
|
4981
4985
|
const order = this.safeDict(innerList, 0, {});
|
|
4982
4986
|
return this.parseOrder(order, market);
|
|
4983
4987
|
}
|
|
@@ -5143,7 +5147,7 @@ class bybit extends bybit$1 {
|
|
|
5143
5147
|
const length = result.length;
|
|
5144
5148
|
if (length === 0) {
|
|
5145
5149
|
const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
|
|
5146
|
-
const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
|
|
5150
|
+
const extra = isTrigger ? '' : ' If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
|
|
5147
5151
|
throw new errors.OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
|
|
5148
5152
|
}
|
|
5149
5153
|
if (length > 1) {
|
|
@@ -5176,7 +5180,7 @@ class bybit extends bybit$1 {
|
|
|
5176
5180
|
const length = result.length;
|
|
5177
5181
|
if (length === 0) {
|
|
5178
5182
|
const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
|
|
5179
|
-
const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
|
|
5183
|
+
const extra = isTrigger ? '' : ' If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
|
|
5180
5184
|
throw new errors.OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
|
|
5181
5185
|
}
|
|
5182
5186
|
if (length > 1) {
|
|
@@ -1388,12 +1388,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
1388
1388
|
// ...
|
|
1389
1389
|
// ]
|
|
1390
1390
|
//
|
|
1391
|
-
|
|
1392
|
-
for (let i = 0; i < currencies.length; i++) {
|
|
1393
|
-
const currency = this.parseCurrency(currencies[i]);
|
|
1394
|
-
result[currency['code']] = currency;
|
|
1395
|
-
}
|
|
1396
|
-
return result;
|
|
1391
|
+
return this.parseCurrencies(currencies);
|
|
1397
1392
|
}
|
|
1398
1393
|
parseCurrency(currency) {
|
|
1399
1394
|
//
|
|
@@ -1409,7 +1404,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
1409
1404
|
const id = this.safeString(currency, 'asset_name');
|
|
1410
1405
|
const code = this.safeCurrencyCode(id);
|
|
1411
1406
|
const statusId = this.safeString(currency, 'status');
|
|
1412
|
-
return {
|
|
1407
|
+
return this.safeCurrencyStructure({
|
|
1413
1408
|
'id': id,
|
|
1414
1409
|
'name': code,
|
|
1415
1410
|
'code': code,
|
|
@@ -1422,7 +1417,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
1422
1417
|
'fee': undefined,
|
|
1423
1418
|
'fees': undefined,
|
|
1424
1419
|
'limits': this.limits,
|
|
1425
|
-
};
|
|
1420
|
+
});
|
|
1426
1421
|
}
|
|
1427
1422
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
1428
1423
|
/**
|
package/dist/cjs/src/kuna.js
CHANGED
|
@@ -459,15 +459,6 @@ class kuna extends kuna$1 {
|
|
|
459
459
|
const data = this.safeValue(response, 'data', []);
|
|
460
460
|
return this.parseCurrencies(data);
|
|
461
461
|
}
|
|
462
|
-
parseCurrencies(currencies, params = {}) {
|
|
463
|
-
currencies = this.toArray(currencies);
|
|
464
|
-
const result = {};
|
|
465
|
-
for (let i = 0; i < currencies.length; i++) {
|
|
466
|
-
const currency = this.parseCurrency(currencies[i]);
|
|
467
|
-
result[currency['code']] = currency;
|
|
468
|
-
}
|
|
469
|
-
return result;
|
|
470
|
-
}
|
|
471
462
|
parseCurrency(currency) {
|
|
472
463
|
//
|
|
473
464
|
// {
|
|
@@ -492,7 +483,7 @@ class kuna extends kuna$1 {
|
|
|
492
483
|
const currencyId = this.safeString(currency, 'code');
|
|
493
484
|
const precision = this.safeString(currency, 'precision');
|
|
494
485
|
const tradePrecision = this.safeString(currency, 'tradePrecision');
|
|
495
|
-
return {
|
|
486
|
+
return this.safeCurrencyStructure({
|
|
496
487
|
'info': currency,
|
|
497
488
|
'id': currencyId,
|
|
498
489
|
'code': this.safeCurrencyCode(currencyId),
|
|
@@ -503,7 +494,7 @@ class kuna extends kuna$1 {
|
|
|
503
494
|
'deposit': undefined,
|
|
504
495
|
'withdraw': undefined,
|
|
505
496
|
'fee': undefined,
|
|
506
|
-
'precision': Precise["default"].stringMin(precision, tradePrecision),
|
|
497
|
+
'precision': this.parseNumber(Precise["default"].stringMin(precision, tradePrecision)),
|
|
507
498
|
'limits': {
|
|
508
499
|
'amount': {
|
|
509
500
|
'min': undefined,
|
|
@@ -515,7 +506,7 @@ class kuna extends kuna$1 {
|
|
|
515
506
|
},
|
|
516
507
|
},
|
|
517
508
|
'networks': {},
|
|
518
|
-
};
|
|
509
|
+
});
|
|
519
510
|
}
|
|
520
511
|
async fetchMarkets(params = {}) {
|
|
521
512
|
/**
|
package/dist/cjs/src/mexc.js
CHANGED
package/dist/cjs/src/okx.js
CHANGED
|
@@ -97,6 +97,7 @@ class okx extends okx$1 {
|
|
|
97
97
|
'fetchMarketLeverageTiers': true,
|
|
98
98
|
'fetchMarkets': true,
|
|
99
99
|
'fetchMarkOHLCV': true,
|
|
100
|
+
'fetchMarkPrice': true,
|
|
100
101
|
'fetchMarkPrices': true,
|
|
101
102
|
'fetchMySettlementHistory': false,
|
|
102
103
|
'fetchMyTrades': true,
|
|
@@ -1981,6 +1982,39 @@ class okx extends okx$1 {
|
|
|
1981
1982
|
const tickers = this.safeList(response, 'data', []);
|
|
1982
1983
|
return this.parseTickers(tickers, symbols);
|
|
1983
1984
|
}
|
|
1985
|
+
async fetchMarkPrice(symbol, params = {}) {
|
|
1986
|
+
/**
|
|
1987
|
+
* @method
|
|
1988
|
+
* @name okx#fetchMarkPrice
|
|
1989
|
+
* @description fetches mark price for the market
|
|
1990
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-mark-price
|
|
1991
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
1992
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1993
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1994
|
+
*/
|
|
1995
|
+
await this.loadMarkets();
|
|
1996
|
+
const market = this.market(symbol);
|
|
1997
|
+
const request = {
|
|
1998
|
+
'instId': market['id'],
|
|
1999
|
+
};
|
|
2000
|
+
const response = await this.publicGetPublicMarkPrice(this.extend(request, params));
|
|
2001
|
+
//
|
|
2002
|
+
// {
|
|
2003
|
+
// "code": "0",
|
|
2004
|
+
// "data": [
|
|
2005
|
+
// {
|
|
2006
|
+
// "instId": "ETH-USDT",
|
|
2007
|
+
// "instType": "MARGIN",
|
|
2008
|
+
// "markPx": "2403.98",
|
|
2009
|
+
// "ts": "1728578500703"
|
|
2010
|
+
// }
|
|
2011
|
+
// ],
|
|
2012
|
+
// "msg": ""
|
|
2013
|
+
// }
|
|
2014
|
+
//
|
|
2015
|
+
const data = this.safeList(response, 'data');
|
|
2016
|
+
return this.parseTicker(this.safeDict(data, 0), market);
|
|
2017
|
+
}
|
|
1984
2018
|
async fetchMarkPrices(symbols = undefined, params = {}) {
|
|
1985
2019
|
/**
|
|
1986
2020
|
* @method
|
|
@@ -2003,7 +2037,7 @@ class okx extends okx$1 {
|
|
|
2003
2037
|
const defaultUnderlying = this.safeString(this.options, 'defaultUnderlying', 'BTC-USD');
|
|
2004
2038
|
const currencyId = this.safeString2(params, 'uly', 'marketId', defaultUnderlying);
|
|
2005
2039
|
if (currencyId === undefined) {
|
|
2006
|
-
throw new errors.ArgumentsRequired(this.id + '
|
|
2040
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchMarkPrices() requires an underlying uly or marketId parameter for options markets');
|
|
2007
2041
|
}
|
|
2008
2042
|
else {
|
|
2009
2043
|
request['uly'] = currencyId;
|
package/dist/cjs/src/timex.js
CHANGED
|
@@ -351,12 +351,7 @@ class timex extends timex$1 {
|
|
|
351
351
|
// },
|
|
352
352
|
// ]
|
|
353
353
|
//
|
|
354
|
-
|
|
355
|
-
for (let i = 0; i < response.length; i++) {
|
|
356
|
-
const currency = response[i];
|
|
357
|
-
result.push(this.parseCurrency(currency));
|
|
358
|
-
}
|
|
359
|
-
return this.indexBy(result, 'code');
|
|
354
|
+
return this.parseCurrencies(response);
|
|
360
355
|
}
|
|
361
356
|
async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
362
357
|
/**
|
|
@@ -1359,7 +1354,7 @@ class timex extends timex$1 {
|
|
|
1359
1354
|
fee = this.parseNumber(fraction + feeString);
|
|
1360
1355
|
}
|
|
1361
1356
|
}
|
|
1362
|
-
return {
|
|
1357
|
+
return this.safeCurrencyStructure({
|
|
1363
1358
|
'id': code,
|
|
1364
1359
|
'code': code,
|
|
1365
1360
|
'info': currency,
|
|
@@ -1375,7 +1370,7 @@ class timex extends timex$1 {
|
|
|
1375
1370
|
'amount': { 'min': undefined, 'max': undefined },
|
|
1376
1371
|
},
|
|
1377
1372
|
'networks': {},
|
|
1378
|
-
};
|
|
1373
|
+
});
|
|
1379
1374
|
}
|
|
1380
1375
|
parseTicker(ticker, market = undefined) {
|
|
1381
1376
|
//
|
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 { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarketMarginModes, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.4.
|
|
7
|
+
declare const version = "4.4.16";
|
|
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, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.4.
|
|
41
|
+
const version = '4.4.17';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -55,6 +55,7 @@ interface Exchange {
|
|
|
55
55
|
spotPrivateGetRebateAffiliateCommissionDetail(params?: {}): Promise<implicitReturnType>;
|
|
56
56
|
spotPrivateGetMxDeductEnable(params?: {}): Promise<implicitReturnType>;
|
|
57
57
|
spotPrivateGetUserDataStream(params?: {}): Promise<implicitReturnType>;
|
|
58
|
+
spotPrivateGetSelfSymbols(params?: {}): Promise<implicitReturnType>;
|
|
58
59
|
spotPrivatePostOrder(params?: {}): Promise<implicitReturnType>;
|
|
59
60
|
spotPrivatePostOrderTest(params?: {}): Promise<implicitReturnType>;
|
|
60
61
|
spotPrivatePostSubAccountVirtualSubAccount(params?: {}): Promise<implicitReturnType>;
|
|
@@ -753,6 +753,8 @@ export default class Exchange {
|
|
|
753
753
|
watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
754
754
|
fetchTime(params?: {}): Promise<Int>;
|
|
755
755
|
fetchTradingLimits(symbols?: Strings, params?: {}): Promise<{}>;
|
|
756
|
+
parseCurrency(rawCurrency: Dict): Currency;
|
|
757
|
+
parseCurrencies(rawCurrencies: any): Currencies;
|
|
756
758
|
parseMarket(market: Dict): Market;
|
|
757
759
|
parseMarkets(markets: any): Market[];
|
|
758
760
|
parseTicker(ticker: Dict, market?: Market): Ticker;
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -2061,6 +2061,19 @@ export default class Exchange {
|
|
|
2061
2061
|
async fetchTradingLimits(symbols = undefined, params = {}) {
|
|
2062
2062
|
throw new NotSupported(this.id + ' fetchTradingLimits() is not supported yet');
|
|
2063
2063
|
}
|
|
2064
|
+
parseCurrency(rawCurrency) {
|
|
2065
|
+
throw new NotSupported(this.id + ' parseCurrency() is not supported yet');
|
|
2066
|
+
}
|
|
2067
|
+
parseCurrencies(rawCurrencies) {
|
|
2068
|
+
const result = {};
|
|
2069
|
+
const arr = this.toArray(rawCurrencies);
|
|
2070
|
+
for (let i = 0; i < arr.length; i++) {
|
|
2071
|
+
const parsed = this.parseCurrency(arr[i]);
|
|
2072
|
+
const code = parsed['code'];
|
|
2073
|
+
result[code] = parsed;
|
|
2074
|
+
}
|
|
2075
|
+
return result;
|
|
2076
|
+
}
|
|
2064
2077
|
parseMarket(market) {
|
|
2065
2078
|
throw new NotSupported(this.id + ' parseMarket() is not supported yet');
|
|
2066
2079
|
}
|
package/js/src/binance.js
CHANGED
|
@@ -2676,11 +2676,18 @@ export default class binance extends Exchange {
|
|
|
2676
2676
|
if (apiBackup !== undefined) {
|
|
2677
2677
|
return undefined;
|
|
2678
2678
|
}
|
|
2679
|
-
const promises = [this.sapiGetCapitalConfigGetall(params)
|
|
2679
|
+
const promises = [this.sapiGetCapitalConfigGetall(params)];
|
|
2680
|
+
const fetchMargins = this.safeBool(this.options, 'fetchMargins', false);
|
|
2681
|
+
if (fetchMargins) {
|
|
2682
|
+
promises.push(this.sapiGetMarginAllPairs(params));
|
|
2683
|
+
}
|
|
2680
2684
|
const results = await Promise.all(promises);
|
|
2681
2685
|
const responseCurrencies = results[0];
|
|
2682
|
-
|
|
2683
|
-
|
|
2686
|
+
let marginablesById = undefined;
|
|
2687
|
+
if (fetchMargins) {
|
|
2688
|
+
const responseMarginables = results[1];
|
|
2689
|
+
marginablesById = this.indexBy(responseMarginables, 'assetName');
|
|
2690
|
+
}
|
|
2684
2691
|
const result = {};
|
|
2685
2692
|
for (let i = 0; i < responseCurrencies.length; i++) {
|
|
2686
2693
|
//
|
|
@@ -4252,7 +4259,7 @@ export default class binance extends Exchange {
|
|
|
4252
4259
|
* @description fetches mark price for the market
|
|
4253
4260
|
* @see https://binance-docs.github.io/apidocs/futures/en/#mark-price
|
|
4254
4261
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#index-price-and-mark-price
|
|
4255
|
-
* @param {string
|
|
4262
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
4256
4263
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4257
4264
|
* @param {string} [params.subType] "linear" or "inverse"
|
|
4258
4265
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
package/js/src/bingx.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export default class bingx extends Exchange {
|
|
|
26
26
|
parseOpenInterest(interest: any, market?: Market): import("./base/types.js").OpenInterest;
|
|
27
27
|
fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
28
28
|
fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
29
|
+
fetchMarkPrice(symbol: string, params?: {}): Promise<Ticker>;
|
|
29
30
|
fetchMarkPrices(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
30
31
|
parseTicker(ticker: Dict, market?: Market): Ticker;
|
|
31
32
|
fetchBalance(params?: {}): Promise<Balances>;
|
package/js/src/bingx.js
CHANGED
|
@@ -69,6 +69,7 @@ export default class bingx extends Exchange {
|
|
|
69
69
|
'fetchMarginMode': true,
|
|
70
70
|
'fetchMarkets': true,
|
|
71
71
|
'fetchMarkOHLCV': true,
|
|
72
|
+
'fetchMarkPrice': true,
|
|
72
73
|
'fetchMarkPrices': true,
|
|
73
74
|
'fetchMyLiquidations': true,
|
|
74
75
|
'fetchOHLCV': true,
|
|
@@ -1734,6 +1735,64 @@ export default class bingx extends Exchange {
|
|
|
1734
1735
|
const tickers = this.safeList(response, 'data');
|
|
1735
1736
|
return this.parseTickers(tickers, symbols);
|
|
1736
1737
|
}
|
|
1738
|
+
async fetchMarkPrice(symbol, params = {}) {
|
|
1739
|
+
/**
|
|
1740
|
+
* @method
|
|
1741
|
+
* @name bingx#fetchMarkPrice
|
|
1742
|
+
* @description fetches mark prices for the market
|
|
1743
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Mark%20Price%20and%20Funding%20Rate
|
|
1744
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
1745
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1746
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1747
|
+
*/
|
|
1748
|
+
await this.loadMarkets();
|
|
1749
|
+
const market = this.market(symbol);
|
|
1750
|
+
let subType = undefined;
|
|
1751
|
+
[subType, params] = this.handleSubTypeAndParams('fetchMarkPrice', market, params, 'linear');
|
|
1752
|
+
const request = {
|
|
1753
|
+
'symbol': market['id'],
|
|
1754
|
+
};
|
|
1755
|
+
let response = undefined;
|
|
1756
|
+
if (subType === 'inverse') {
|
|
1757
|
+
response = await this.cswapV1PublicGetMarketPremiumIndex(this.extend(request, params));
|
|
1758
|
+
//
|
|
1759
|
+
// {
|
|
1760
|
+
// "code": 0,
|
|
1761
|
+
// "msg": "",
|
|
1762
|
+
// "timestamp": 1728577213289,
|
|
1763
|
+
// "data": [
|
|
1764
|
+
// {
|
|
1765
|
+
// "symbol": "ETH-USD",
|
|
1766
|
+
// "lastFundingRate": "0.0001",
|
|
1767
|
+
// "markPrice": "2402.68",
|
|
1768
|
+
// "indexPrice": "2404.92",
|
|
1769
|
+
// "nextFundingTime": 1728604800000
|
|
1770
|
+
// }
|
|
1771
|
+
// ]
|
|
1772
|
+
// }
|
|
1773
|
+
//
|
|
1774
|
+
}
|
|
1775
|
+
else {
|
|
1776
|
+
response = await this.swapV2PublicGetQuotePremiumIndex(this.extend(request, params));
|
|
1777
|
+
//
|
|
1778
|
+
// {
|
|
1779
|
+
// "code": 0,
|
|
1780
|
+
// "msg": "",
|
|
1781
|
+
// "data": {
|
|
1782
|
+
// "symbol": "ETH-USDT",
|
|
1783
|
+
// "markPrice": "2408.40",
|
|
1784
|
+
// "indexPrice": "2409.62",
|
|
1785
|
+
// "lastFundingRate": "0.00009900",
|
|
1786
|
+
// "nextFundingTime": 1728604800000
|
|
1787
|
+
// }
|
|
1788
|
+
// }
|
|
1789
|
+
//
|
|
1790
|
+
}
|
|
1791
|
+
if (Array.isArray(response['data'])) {
|
|
1792
|
+
return this.parseTicker(this.safeDict(response['data'], 0, {}), market);
|
|
1793
|
+
}
|
|
1794
|
+
return this.parseTicker(response['data'], market);
|
|
1795
|
+
}
|
|
1737
1796
|
async fetchMarkPrices(symbols = undefined, params = {}) {
|
|
1738
1797
|
/**
|
|
1739
1798
|
* @method
|
package/js/src/bitvavo.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export default class bitvavo extends Exchange {
|
|
|
12
12
|
fetchMarkets(params?: {}): Promise<Market[]>;
|
|
13
13
|
parseMarkets(markets: any): any[];
|
|
14
14
|
fetchCurrencies(params?: {}): Promise<Currencies>;
|
|
15
|
-
|
|
15
|
+
parseCurrenciesCustom(currencies: any): Dict;
|
|
16
16
|
fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
17
17
|
parseTicker(ticker: Dict, market?: Market): Ticker;
|
|
18
18
|
fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
package/js/src/bitvavo.js
CHANGED
|
@@ -450,9 +450,9 @@ export default class bitvavo extends Exchange {
|
|
|
450
450
|
// },
|
|
451
451
|
// ]
|
|
452
452
|
//
|
|
453
|
-
return this.
|
|
453
|
+
return this.parseCurrenciesCustom(response);
|
|
454
454
|
}
|
|
455
|
-
|
|
455
|
+
parseCurrenciesCustom(currencies) {
|
|
456
456
|
//
|
|
457
457
|
// [
|
|
458
458
|
// {
|
package/js/src/bybit.js
CHANGED
|
@@ -4885,7 +4885,7 @@ export default class bybit extends Exchange {
|
|
|
4885
4885
|
const length = result.length;
|
|
4886
4886
|
if (length === 0) {
|
|
4887
4887
|
const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
|
|
4888
|
-
const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
|
|
4888
|
+
const extra = isTrigger ? '' : ' If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
|
|
4889
4889
|
throw new OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
|
|
4890
4890
|
}
|
|
4891
4891
|
if (length > 1) {
|
|
@@ -4981,6 +4981,10 @@ export default class bybit extends Exchange {
|
|
|
4981
4981
|
//
|
|
4982
4982
|
const result = this.safeDict(response, 'result', {});
|
|
4983
4983
|
const innerList = this.safeList(result, 'list', []);
|
|
4984
|
+
if (innerList.length === 0) {
|
|
4985
|
+
const extra = isTrigger ? '' : ' If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
|
|
4986
|
+
throw new OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
|
|
4987
|
+
}
|
|
4984
4988
|
const order = this.safeDict(innerList, 0, {});
|
|
4985
4989
|
return this.parseOrder(order, market);
|
|
4986
4990
|
}
|
|
@@ -5146,7 +5150,7 @@ export default class bybit extends Exchange {
|
|
|
5146
5150
|
const length = result.length;
|
|
5147
5151
|
if (length === 0) {
|
|
5148
5152
|
const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
|
|
5149
|
-
const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
|
|
5153
|
+
const extra = isTrigger ? '' : ' If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
|
|
5150
5154
|
throw new OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
|
|
5151
5155
|
}
|
|
5152
5156
|
if (length > 1) {
|
|
@@ -5179,7 +5183,7 @@ export default class bybit extends Exchange {
|
|
|
5179
5183
|
const length = result.length;
|
|
5180
5184
|
if (length === 0) {
|
|
5181
5185
|
const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
|
|
5182
|
-
const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
|
|
5186
|
+
const extra = isTrigger ? '' : ' If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
|
|
5183
5187
|
throw new OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
|
|
5184
5188
|
}
|
|
5185
5189
|
if (length > 1) {
|
|
@@ -95,25 +95,7 @@ export default class coinbaseinternational extends Exchange {
|
|
|
95
95
|
fetchMarkets(params?: {}): Promise<Market[]>;
|
|
96
96
|
parseMarket(market: Dict): Market;
|
|
97
97
|
fetchCurrencies(params?: {}): Promise<Currencies>;
|
|
98
|
-
parseCurrency(currency: Dict):
|
|
99
|
-
id: string;
|
|
100
|
-
name: string;
|
|
101
|
-
code: string;
|
|
102
|
-
precision: any;
|
|
103
|
-
info: Dict;
|
|
104
|
-
active: boolean;
|
|
105
|
-
deposit: any;
|
|
106
|
-
withdraw: any;
|
|
107
|
-
networks: any;
|
|
108
|
-
fee: any;
|
|
109
|
-
fees: any;
|
|
110
|
-
limits: {
|
|
111
|
-
amount?: import("./base/types.js").MinMax;
|
|
112
|
-
cost?: import("./base/types.js").MinMax;
|
|
113
|
-
leverage?: import("./base/types.js").MinMax;
|
|
114
|
-
price?: import("./base/types.js").MinMax;
|
|
115
|
-
};
|
|
116
|
-
};
|
|
98
|
+
parseCurrency(currency: Dict): Currency;
|
|
117
99
|
fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
118
100
|
fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
119
101
|
parseTicker(ticker: object, market?: Market): Ticker;
|