ccxt 4.4.18 → 4.4.20
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 +2 -2
- package/dist/cjs/ccxt.js +3 -1
- package/dist/cjs/src/base/Exchange.js +5 -0
- package/dist/cjs/src/binance.js +22 -3
- package/dist/cjs/src/bingx.js +2 -1
- package/dist/cjs/src/bitget.js +1 -1
- package/dist/cjs/src/bybit.js +2 -1
- package/dist/cjs/src/gate.js +1 -0
- package/dist/cjs/src/htx.js +24 -0
- package/dist/cjs/src/hyperliquid.js +4 -0
- package/dist/cjs/src/kucoin.js +1 -1
- package/dist/cjs/src/kucoinfutures.js +63 -0
- package/dist/cjs/src/lbank.js +3 -3
- package/dist/cjs/src/phemex.js +75 -0
- package/dist/cjs/src/pro/coinbaseadvanced.js +17 -0
- package/js/ccxt.d.ts +4 -1
- package/js/ccxt.js +3 -1
- package/js/src/abstract/binance.d.ts +4 -0
- package/js/src/abstract/binancecoinm.d.ts +4 -0
- package/js/src/abstract/binanceus.d.ts +4 -0
- package/js/src/abstract/binanceusdm.d.ts +4 -0
- package/js/src/abstract/kucoinfutures.d.ts +1 -0
- package/js/src/base/Exchange.js +5 -0
- package/js/src/base/types.d.ts +1 -0
- package/js/src/binance.js +22 -3
- package/js/src/bingx.js +2 -1
- package/js/src/bitget.js +1 -1
- package/js/src/bybit.js +2 -1
- package/js/src/gate.js +1 -0
- package/js/src/htx.js +24 -0
- package/js/src/hyperliquid.js +4 -0
- package/js/src/kucoin.js +1 -1
- package/js/src/kucoinfutures.d.ts +1 -0
- package/js/src/kucoinfutures.js +63 -0
- package/js/src/lbank.js +3 -3
- package/js/src/phemex.d.ts +2 -0
- package/js/src/phemex.js +75 -0
- package/js/src/pro/coinbaseadvanced.d.ts +4 -0
- package/js/src/pro/coinbaseadvanced.js +18 -0
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -145,6 +145,7 @@ var blofin$1 = require('./src/pro/blofin.js');
|
|
|
145
145
|
var bybit$1 = require('./src/pro/bybit.js');
|
|
146
146
|
var cex$1 = require('./src/pro/cex.js');
|
|
147
147
|
var coinbase$1 = require('./src/pro/coinbase.js');
|
|
148
|
+
var coinbaseadvanced$1 = require('./src/pro/coinbaseadvanced.js');
|
|
148
149
|
var coinbaseexchange$1 = require('./src/pro/coinbaseexchange.js');
|
|
149
150
|
var coinbaseinternational$1 = require('./src/pro/coinbaseinternational.js');
|
|
150
151
|
var coincheck$1 = require('./src/pro/coincheck.js');
|
|
@@ -194,7 +195,7 @@ var xt$1 = require('./src/pro/xt.js');
|
|
|
194
195
|
|
|
195
196
|
//-----------------------------------------------------------------------------
|
|
196
197
|
// this is updated by vss.js when building
|
|
197
|
-
const version = '4.4.
|
|
198
|
+
const version = '4.4.20';
|
|
198
199
|
Exchange["default"].ccxtVersion = version;
|
|
199
200
|
const exchanges = {
|
|
200
201
|
'ace': ace,
|
|
@@ -332,6 +333,7 @@ const pro = {
|
|
|
332
333
|
'bybit': bybit$1,
|
|
333
334
|
'cex': cex$1,
|
|
334
335
|
'coinbase': coinbase$1,
|
|
336
|
+
'coinbaseadvanced': coinbaseadvanced$1,
|
|
335
337
|
'coinbaseexchange': coinbaseexchange$1,
|
|
336
338
|
'coinbaseinternational': coinbaseinternational$1,
|
|
337
339
|
'coincheck': coincheck$1,
|
|
@@ -6165,6 +6165,8 @@ class Exchange {
|
|
|
6165
6165
|
let i = 0;
|
|
6166
6166
|
let errors = 0;
|
|
6167
6167
|
let result = [];
|
|
6168
|
+
const timeframe = this.safeString(params, 'timeframe');
|
|
6169
|
+
params = this.omit(params, 'timeframe'); // reading the timeframe from the method arguments to avoid changing the signature
|
|
6168
6170
|
while (i < maxCalls) {
|
|
6169
6171
|
try {
|
|
6170
6172
|
if (cursorValue !== undefined) {
|
|
@@ -6180,6 +6182,9 @@ class Exchange {
|
|
|
6180
6182
|
else if (method === 'getLeverageTiersPaginated' || method === 'fetchPositions') {
|
|
6181
6183
|
response = await this[method](symbol, params);
|
|
6182
6184
|
}
|
|
6185
|
+
else if (method === 'fetchOpenInterestHistory') {
|
|
6186
|
+
response = await this[method](symbol, timeframe, since, maxEntriesPerRequest, params);
|
|
6187
|
+
}
|
|
6183
6188
|
else {
|
|
6184
6189
|
response = await this[method](symbol, since, maxEntriesPerRequest, params);
|
|
6185
6190
|
}
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -804,6 +804,7 @@ class binance extends binance$1 {
|
|
|
804
804
|
'constituents': 2,
|
|
805
805
|
'apiTradingStatus': { 'cost': 1, 'noSymbol': 10 },
|
|
806
806
|
'lvtKlines': 1,
|
|
807
|
+
'convert/exchangeInfo': 4,
|
|
807
808
|
},
|
|
808
809
|
},
|
|
809
810
|
'fapiData': {
|
|
@@ -857,6 +858,7 @@ class binance extends binance$1 {
|
|
|
857
858
|
'feeBurn': 1,
|
|
858
859
|
'symbolConfig': 5,
|
|
859
860
|
'accountConfig': 5,
|
|
861
|
+
'convert/orderStatus': 5,
|
|
860
862
|
},
|
|
861
863
|
'post': {
|
|
862
864
|
'batchOrders': 5,
|
|
@@ -872,6 +874,8 @@ class binance extends binance$1 {
|
|
|
872
874
|
'apiReferral/customization': 1,
|
|
873
875
|
'apiReferral/userCustomization': 1,
|
|
874
876
|
'feeBurn': 1,
|
|
877
|
+
'convert/getQuote': 200,
|
|
878
|
+
'convert/acceptQuote': 20,
|
|
875
879
|
},
|
|
876
880
|
'put': {
|
|
877
881
|
'listenKey': 1,
|
|
@@ -3199,8 +3203,8 @@ class binance extends binance$1 {
|
|
|
3199
3203
|
let fees = this.fees;
|
|
3200
3204
|
let linear = undefined;
|
|
3201
3205
|
let inverse = undefined;
|
|
3202
|
-
const strike = this.safeString(market, 'strikePrice');
|
|
3203
3206
|
let symbol = base + '/' + quote;
|
|
3207
|
+
let strike = undefined;
|
|
3204
3208
|
if (contract) {
|
|
3205
3209
|
if (swap) {
|
|
3206
3210
|
symbol = symbol + ':' + settle;
|
|
@@ -3209,6 +3213,7 @@ class binance extends binance$1 {
|
|
|
3209
3213
|
symbol = symbol + ':' + settle + '-' + this.yymmdd(expiry);
|
|
3210
3214
|
}
|
|
3211
3215
|
else if (option) {
|
|
3216
|
+
strike = this.numberToString(this.parseToNumeric(this.safeString(market, 'strikePrice')));
|
|
3212
3217
|
symbol = symbol + ':' + settle + '-' + this.yymmdd(expiry) + '-' + strike + '-' + this.safeString(optionParts, 3);
|
|
3213
3218
|
}
|
|
3214
3219
|
contractSize = this.safeNumber2(market, 'contractSize', 'unit', this.parseNumber('1'));
|
|
@@ -6282,14 +6287,28 @@ class binance extends binance$1 {
|
|
|
6282
6287
|
request['quantity'] = this.parseToNumeric(amount);
|
|
6283
6288
|
}
|
|
6284
6289
|
else {
|
|
6285
|
-
|
|
6290
|
+
const marketAmountPrecision = this.safeString(market['precision'], 'amount');
|
|
6291
|
+
const isPrecisionAvailable = (marketAmountPrecision !== undefined);
|
|
6292
|
+
if (isPrecisionAvailable) {
|
|
6293
|
+
request['quantity'] = this.amountToPrecision(symbol, amount);
|
|
6294
|
+
}
|
|
6295
|
+
else {
|
|
6296
|
+
request['quantity'] = this.parseToNumeric(amount); // some options don't have the precision available
|
|
6297
|
+
}
|
|
6286
6298
|
}
|
|
6287
6299
|
}
|
|
6288
6300
|
if (priceIsRequired && !isPriceMatch) {
|
|
6289
6301
|
if (price === undefined) {
|
|
6290
6302
|
throw new errors.InvalidOrder(this.id + ' createOrder() requires a price argument for a ' + type + ' order');
|
|
6291
6303
|
}
|
|
6292
|
-
|
|
6304
|
+
const pricePrecision = this.safeString(market['precision'], 'price');
|
|
6305
|
+
const isPricePrecisionAvailable = (pricePrecision !== undefined);
|
|
6306
|
+
if (isPricePrecisionAvailable) {
|
|
6307
|
+
request['price'] = this.priceToPrecision(symbol, price);
|
|
6308
|
+
}
|
|
6309
|
+
else {
|
|
6310
|
+
request['price'] = this.parseToNumeric(price); // some options don't have the precision available
|
|
6311
|
+
}
|
|
6293
6312
|
}
|
|
6294
6313
|
if (stopPriceIsRequired) {
|
|
6295
6314
|
if (market['contract']) {
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -493,6 +493,7 @@ class bingx extends bingx$1 {
|
|
|
493
493
|
},
|
|
494
494
|
'networks': {
|
|
495
495
|
'ARB': 'ARBITRUM',
|
|
496
|
+
'MATIC': 'POLYGON',
|
|
496
497
|
},
|
|
497
498
|
},
|
|
498
499
|
});
|
|
@@ -772,7 +773,7 @@ class bingx extends bingx$1 {
|
|
|
772
773
|
if ((this.safeString(market, 'apiStateOpen') === 'true') && (this.safeString(market, 'apiStateClose') === 'true')) {
|
|
773
774
|
isActive = true; // swap active
|
|
774
775
|
}
|
|
775
|
-
else if (this.safeBool(market, 'apiStateSell') && this.safeBool(market, 'apiStateBuy') && (this.
|
|
776
|
+
else if (this.safeBool(market, 'apiStateSell') && this.safeBool(market, 'apiStateBuy') && (this.safeString(market, 'status') === '1')) {
|
|
776
777
|
isActive = true; // spot active
|
|
777
778
|
}
|
|
778
779
|
const isInverse = (spot) ? undefined : checkIsInverse;
|
package/dist/cjs/src/bitget.js
CHANGED
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -7239,7 +7239,8 @@ class bybit extends bybit$1 {
|
|
|
7239
7239
|
const paginate = this.safeBool(params, 'paginate');
|
|
7240
7240
|
if (paginate) {
|
|
7241
7241
|
params = this.omit(params, 'paginate');
|
|
7242
|
-
|
|
7242
|
+
params['timeframe'] = timeframe;
|
|
7243
|
+
return await this.fetchPaginatedCallCursor('fetchOpenInterestHistory', symbol, since, limit, params, 'nextPageCursor', 'cursor', undefined, 200);
|
|
7243
7244
|
}
|
|
7244
7245
|
const market = this.market(symbol);
|
|
7245
7246
|
if (market['spot'] || market['option']) {
|
package/dist/cjs/src/gate.js
CHANGED
|
@@ -4734,6 +4734,7 @@ class gate extends gate$1 {
|
|
|
4734
4734
|
* @name gate#fetchOpenOrders
|
|
4735
4735
|
* @description fetch all unfilled currently open orders
|
|
4736
4736
|
* @see https://www.gate.io/docs/developers/apiv4/en/#list-all-open-orders
|
|
4737
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#retrieve-running-auto-order-list
|
|
4737
4738
|
* @param {string} symbol unified market symbol
|
|
4738
4739
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
4739
4740
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
package/dist/cjs/src/htx.js
CHANGED
|
@@ -1235,6 +1235,18 @@ class htx extends htx$1 {
|
|
|
1235
1235
|
});
|
|
1236
1236
|
}
|
|
1237
1237
|
async fetchStatus(params = {}) {
|
|
1238
|
+
/**
|
|
1239
|
+
* @method
|
|
1240
|
+
* @name htx#fetchStatus
|
|
1241
|
+
* @description the latest known information on the availability of the exchange API
|
|
1242
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-system-status
|
|
1243
|
+
* @see https://huobiapi.github.io/docs/dm/v1/en/#get-system-status
|
|
1244
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-system-status
|
|
1245
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#get-system-status
|
|
1246
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#query-whether-the-system-is-available // contractPublicGetHeartbeat
|
|
1247
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1248
|
+
* @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
|
|
1249
|
+
*/
|
|
1238
1250
|
await this.loadMarkets();
|
|
1239
1251
|
let marketType = undefined;
|
|
1240
1252
|
[marketType, params] = this.handleMarketTypeAndParams('fetchStatus', undefined, params);
|
|
@@ -1461,6 +1473,8 @@ class htx extends htx$1 {
|
|
|
1461
1473
|
* @method
|
|
1462
1474
|
* @name htx#fetchTime
|
|
1463
1475
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
1476
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-current-timestamp
|
|
1477
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-current-system-timestamp
|
|
1464
1478
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1465
1479
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
1466
1480
|
*/
|
|
@@ -1511,6 +1525,7 @@ class htx extends htx$1 {
|
|
|
1511
1525
|
* @method
|
|
1512
1526
|
* @name htx#fetchTradingFee
|
|
1513
1527
|
* @description fetch the trading fees for a market
|
|
1528
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-current-fee-rate-applied-to-the-user
|
|
1514
1529
|
* @param {string} symbol unified market symbol
|
|
1515
1530
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1516
1531
|
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
@@ -1556,6 +1571,15 @@ class htx extends htx$1 {
|
|
|
1556
1571
|
return result;
|
|
1557
1572
|
}
|
|
1558
1573
|
async fetchTradingLimitsById(id, params = {}) {
|
|
1574
|
+
/**
|
|
1575
|
+
* @ignore
|
|
1576
|
+
* @method
|
|
1577
|
+
* @name htx#fetchTradingLimitsById
|
|
1578
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-current-fee-rate-applied-to-the-user
|
|
1579
|
+
* @param {string} id market id
|
|
1580
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1581
|
+
* @returns {object} the limits object of a market structure
|
|
1582
|
+
*/
|
|
1559
1583
|
const request = {
|
|
1560
1584
|
'symbol': id,
|
|
1561
1585
|
};
|
|
@@ -1983,6 +1983,10 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1983
1983
|
const statuses = {
|
|
1984
1984
|
'triggered': 'open',
|
|
1985
1985
|
'filled': 'closed',
|
|
1986
|
+
'open': 'open',
|
|
1987
|
+
'canceled': 'canceled',
|
|
1988
|
+
'rejected': 'rejected',
|
|
1989
|
+
'marginCanceled': 'canceled',
|
|
1986
1990
|
};
|
|
1987
1991
|
return this.safeString(statuses, status, status);
|
|
1988
1992
|
}
|
package/dist/cjs/src/kucoin.js
CHANGED
|
@@ -5037,7 +5037,7 @@ class kucoin extends kucoin$1 {
|
|
|
5037
5037
|
headers = (headers !== undefined) ? headers : {};
|
|
5038
5038
|
let url = this.urls['api'][api];
|
|
5039
5039
|
if (!this.isEmpty(query)) {
|
|
5040
|
-
if ((method === 'GET') || (method === 'DELETE')) {
|
|
5040
|
+
if (((method === 'GET') || (method === 'DELETE')) && (path !== 'orders/multi-cancel')) {
|
|
5041
5041
|
endpoint += '?' + this.rawencode(query);
|
|
5042
5042
|
}
|
|
5043
5043
|
else {
|
|
@@ -33,6 +33,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
33
33
|
'addMargin': true,
|
|
34
34
|
'cancelAllOrders': true,
|
|
35
35
|
'cancelOrder': true,
|
|
36
|
+
'cancelOrders': true,
|
|
36
37
|
'closeAllPositions': false,
|
|
37
38
|
'closePosition': true,
|
|
38
39
|
'closePositions': false,
|
|
@@ -204,6 +205,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
204
205
|
'stopOrders': 1,
|
|
205
206
|
'sub/api-key': 1,
|
|
206
207
|
'orders/client-order/{clientOid}': 1,
|
|
208
|
+
'orders/multi-cancel': 20,
|
|
207
209
|
},
|
|
208
210
|
},
|
|
209
211
|
'webExchange': {
|
|
@@ -1662,6 +1664,67 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1662
1664
|
//
|
|
1663
1665
|
return this.safeValue(response, 'data');
|
|
1664
1666
|
}
|
|
1667
|
+
async cancelOrders(ids, symbol = undefined, params = {}) {
|
|
1668
|
+
/**
|
|
1669
|
+
* @method
|
|
1670
|
+
* @name kucoinfutures#cancelOrders
|
|
1671
|
+
* @description cancel multiple orders
|
|
1672
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/orders/batch-cancel-orders
|
|
1673
|
+
* @param {string[]} ids order ids
|
|
1674
|
+
* @param {string} symbol unified symbol of the market the order was made in
|
|
1675
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1676
|
+
* @param {string[]} [params.clientOrderIds] client order ids
|
|
1677
|
+
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1678
|
+
*/
|
|
1679
|
+
await this.loadMarkets();
|
|
1680
|
+
let market = undefined;
|
|
1681
|
+
if (symbol !== undefined) {
|
|
1682
|
+
market = this.market(symbol);
|
|
1683
|
+
}
|
|
1684
|
+
const ordersRequests = [];
|
|
1685
|
+
const clientOrderIds = this.safeList2(params, 'clientOrderIds', 'clientOids', []);
|
|
1686
|
+
params = this.omit(params, ['clientOrderIds', 'clientOids']);
|
|
1687
|
+
let useClientorderId = false;
|
|
1688
|
+
for (let i = 0; i < clientOrderIds.length; i++) {
|
|
1689
|
+
useClientorderId = true;
|
|
1690
|
+
if (symbol === undefined) {
|
|
1691
|
+
throw new errors.ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument when cancelling by clientOrderIds');
|
|
1692
|
+
}
|
|
1693
|
+
ordersRequests.push({
|
|
1694
|
+
'symbol': market['id'],
|
|
1695
|
+
'clientOid': this.safeString(clientOrderIds, i),
|
|
1696
|
+
});
|
|
1697
|
+
}
|
|
1698
|
+
for (let i = 0; i < ids.length; i++) {
|
|
1699
|
+
ordersRequests.push(ids[i]);
|
|
1700
|
+
}
|
|
1701
|
+
const requestKey = useClientorderId ? 'clientOidsList' : 'orderIdsList';
|
|
1702
|
+
const request = {};
|
|
1703
|
+
request[requestKey] = ordersRequests;
|
|
1704
|
+
const response = await this.futuresPrivateDeleteOrdersMultiCancel(this.extend(request, params));
|
|
1705
|
+
//
|
|
1706
|
+
// {
|
|
1707
|
+
// "code": "200000",
|
|
1708
|
+
// "data":
|
|
1709
|
+
// [
|
|
1710
|
+
// {
|
|
1711
|
+
// "orderId": "80465574458560512",
|
|
1712
|
+
// "clientOid": null,
|
|
1713
|
+
// "code": "200",
|
|
1714
|
+
// "msg": "success"
|
|
1715
|
+
// },
|
|
1716
|
+
// {
|
|
1717
|
+
// "orderId": "80465575289094144",
|
|
1718
|
+
// "clientOid": null,
|
|
1719
|
+
// "code": "200",
|
|
1720
|
+
// "msg": "success"
|
|
1721
|
+
// }
|
|
1722
|
+
// ]
|
|
1723
|
+
// }
|
|
1724
|
+
//
|
|
1725
|
+
const orders = this.safeList(response, 'data', []);
|
|
1726
|
+
return this.parseOrders(orders, market);
|
|
1727
|
+
}
|
|
1665
1728
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
1666
1729
|
/**
|
|
1667
1730
|
* @method
|
package/dist/cjs/src/lbank.js
CHANGED
|
@@ -1007,16 +1007,16 @@ class lbank extends lbank$1 {
|
|
|
1007
1007
|
}
|
|
1008
1008
|
if (since === undefined) {
|
|
1009
1009
|
const duration = this.parseTimeframe(timeframe);
|
|
1010
|
-
since = this.milliseconds() - duration * 1000 * limit;
|
|
1010
|
+
since = this.milliseconds() - (duration * 1000 * limit);
|
|
1011
1011
|
}
|
|
1012
1012
|
const request = {
|
|
1013
1013
|
'symbol': market['id'],
|
|
1014
1014
|
'type': this.safeString(this.timeframes, timeframe, timeframe),
|
|
1015
1015
|
'time': this.parseToInt(since / 1000),
|
|
1016
|
-
'size': limit, // max 2000
|
|
1016
|
+
'size': Math.min(limit + 1, 2000), // max 2000
|
|
1017
1017
|
};
|
|
1018
1018
|
const response = await this.spotPublicGetKline(this.extend(request, params));
|
|
1019
|
-
const ohlcvs = this.
|
|
1019
|
+
const ohlcvs = this.safeList(response, 'data', []);
|
|
1020
1020
|
//
|
|
1021
1021
|
//
|
|
1022
1022
|
// [
|
package/dist/cjs/src/phemex.js
CHANGED
|
@@ -66,6 +66,7 @@ class phemex extends phemex$1 {
|
|
|
66
66
|
'fetchMarkOHLCV': false,
|
|
67
67
|
'fetchMyTrades': true,
|
|
68
68
|
'fetchOHLCV': true,
|
|
69
|
+
'fetchOpenInterest': true,
|
|
69
70
|
'fetchOpenOrders': true,
|
|
70
71
|
'fetchOrder': true,
|
|
71
72
|
'fetchOrderBook': true,
|
|
@@ -4849,6 +4850,80 @@ class phemex extends phemex$1 {
|
|
|
4849
4850
|
const data = this.safeDict(response, 'data', {});
|
|
4850
4851
|
return this.parseTransaction(data, currency);
|
|
4851
4852
|
}
|
|
4853
|
+
async fetchOpenInterest(symbol, params = {}) {
|
|
4854
|
+
/**
|
|
4855
|
+
* @method
|
|
4856
|
+
* @name phemex#fetchOpenInterest
|
|
4857
|
+
* @description retrieves the open interest of a trading pair
|
|
4858
|
+
* @see https://phemex-docs.github.io/#query-24-hours-ticker
|
|
4859
|
+
* @param {string} symbol unified CCXT market symbol
|
|
4860
|
+
* @param {object} [params] exchange specific parameters
|
|
4861
|
+
* @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
4862
|
+
*/
|
|
4863
|
+
await this.loadMarkets();
|
|
4864
|
+
const market = this.market(symbol);
|
|
4865
|
+
if (!market['contract']) {
|
|
4866
|
+
throw new errors.BadRequest(this.id + ' fetchOpenInterest is only supported for contract markets.');
|
|
4867
|
+
}
|
|
4868
|
+
const request = {
|
|
4869
|
+
'symbol': market['id'],
|
|
4870
|
+
};
|
|
4871
|
+
const response = await this.v2GetMdV2Ticker24hr(this.extend(request, params));
|
|
4872
|
+
//
|
|
4873
|
+
// {
|
|
4874
|
+
// error: null,
|
|
4875
|
+
// id: '0',
|
|
4876
|
+
// result: {
|
|
4877
|
+
// closeRp: '67550.1',
|
|
4878
|
+
// fundingRateRr: '0.0001',
|
|
4879
|
+
// highRp: '68400',
|
|
4880
|
+
// indexPriceRp: '67567.15389794',
|
|
4881
|
+
// lowRp: '66096.4',
|
|
4882
|
+
// markPriceRp: '67550.1',
|
|
4883
|
+
// openInterestRv: '1848.1144186',
|
|
4884
|
+
// openRp: '66330',
|
|
4885
|
+
// predFundingRateRr: '0.0001',
|
|
4886
|
+
// symbol: 'BTCUSDT',
|
|
4887
|
+
// timestamp: '1729114315443343001',
|
|
4888
|
+
// turnoverRv: '228863389.3237532',
|
|
4889
|
+
// volumeRq: '3388.5600312'
|
|
4890
|
+
// }
|
|
4891
|
+
// }
|
|
4892
|
+
//
|
|
4893
|
+
const result = this.safeDict(response, 'result');
|
|
4894
|
+
return this.parseOpenInterest(result, market);
|
|
4895
|
+
}
|
|
4896
|
+
parseOpenInterest(interest, market = undefined) {
|
|
4897
|
+
//
|
|
4898
|
+
// {
|
|
4899
|
+
// closeRp: '67550.1',
|
|
4900
|
+
// fundingRateRr: '0.0001',
|
|
4901
|
+
// highRp: '68400',
|
|
4902
|
+
// indexPriceRp: '67567.15389794',
|
|
4903
|
+
// lowRp: '66096.4',
|
|
4904
|
+
// markPriceRp: '67550.1',
|
|
4905
|
+
// openInterestRv: '1848.1144186',
|
|
4906
|
+
// openRp: '66330',
|
|
4907
|
+
// predFundingRateRr: '0.0001',
|
|
4908
|
+
// symbol: 'BTCUSDT',
|
|
4909
|
+
// timestamp: '1729114315443343001',
|
|
4910
|
+
// turnoverRv: '228863389.3237532',
|
|
4911
|
+
// volumeRq: '3388.5600312'
|
|
4912
|
+
// }
|
|
4913
|
+
//
|
|
4914
|
+
const timestamp = this.safeInteger(interest, 'timestamp') / 1000000;
|
|
4915
|
+
const id = this.safeString(interest, 'symbol');
|
|
4916
|
+
return this.safeOpenInterest({
|
|
4917
|
+
'info': interest,
|
|
4918
|
+
'symbol': this.safeSymbol(id, market),
|
|
4919
|
+
'baseVolume': this.safeString(interest, 'volumeRq'),
|
|
4920
|
+
'quoteVolume': undefined,
|
|
4921
|
+
'openInterestAmount': this.safeString(interest, 'openInterestRv'),
|
|
4922
|
+
'openInterestValue': undefined,
|
|
4923
|
+
'timestamp': timestamp,
|
|
4924
|
+
'datetime': this.iso8601(timestamp),
|
|
4925
|
+
}, market);
|
|
4926
|
+
}
|
|
4852
4927
|
handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
4853
4928
|
if (response === undefined) {
|
|
4854
4929
|
return undefined; // fallback to default error handler
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var coinbase = require('./coinbase.js');
|
|
4
|
+
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
class coinbaseadvanced extends coinbase {
|
|
8
|
+
describe() {
|
|
9
|
+
return this.deepExtend(super.describe(), {
|
|
10
|
+
'id': 'coinbaseadvanced',
|
|
11
|
+
'name': 'Coinbase Advanced',
|
|
12
|
+
'alias': true,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = coinbaseadvanced;
|
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.19";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
|
@@ -138,6 +138,7 @@ import blofinPro from './src/pro/blofin.js';
|
|
|
138
138
|
import bybitPro from './src/pro/bybit.js';
|
|
139
139
|
import cexPro from './src/pro/cex.js';
|
|
140
140
|
import coinbasePro from './src/pro/coinbase.js';
|
|
141
|
+
import coinbaseadvancedPro from './src/pro/coinbaseadvanced.js';
|
|
141
142
|
import coinbaseexchangePro from './src/pro/coinbaseexchange.js';
|
|
142
143
|
import coinbaseinternationalPro from './src/pro/coinbaseinternational.js';
|
|
143
144
|
import coincheckPro from './src/pro/coincheck.js';
|
|
@@ -320,6 +321,7 @@ declare const pro: {
|
|
|
320
321
|
bybit: typeof bybitPro;
|
|
321
322
|
cex: typeof cexPro;
|
|
322
323
|
coinbase: typeof coinbasePro;
|
|
324
|
+
coinbaseadvanced: typeof coinbaseadvancedPro;
|
|
323
325
|
coinbaseexchange: typeof coinbaseexchangePro;
|
|
324
326
|
coinbaseinternational: typeof coinbaseinternationalPro;
|
|
325
327
|
coincheck: typeof coincheckPro;
|
|
@@ -398,6 +400,7 @@ declare const ccxt: {
|
|
|
398
400
|
bybit: typeof bybitPro;
|
|
399
401
|
cex: typeof cexPro;
|
|
400
402
|
coinbase: typeof coinbasePro;
|
|
403
|
+
coinbaseadvanced: typeof coinbaseadvancedPro;
|
|
401
404
|
coinbaseexchange: typeof coinbaseexchangePro;
|
|
402
405
|
coinbaseinternational: typeof coinbaseinternationalPro;
|
|
403
406
|
coincheck: typeof coincheckPro;
|
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.20';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -175,6 +175,7 @@ import blofinPro from './src/pro/blofin.js';
|
|
|
175
175
|
import bybitPro from './src/pro/bybit.js';
|
|
176
176
|
import cexPro from './src/pro/cex.js';
|
|
177
177
|
import coinbasePro from './src/pro/coinbase.js';
|
|
178
|
+
import coinbaseadvancedPro from './src/pro/coinbaseadvanced.js';
|
|
178
179
|
import coinbaseexchangePro from './src/pro/coinbaseexchange.js';
|
|
179
180
|
import coinbaseinternationalPro from './src/pro/coinbaseinternational.js';
|
|
180
181
|
import coincheckPro from './src/pro/coincheck.js';
|
|
@@ -357,6 +358,7 @@ const pro = {
|
|
|
357
358
|
'bybit': bybitPro,
|
|
358
359
|
'cex': cexPro,
|
|
359
360
|
'coinbase': coinbasePro,
|
|
361
|
+
'coinbaseadvanced': coinbaseadvancedPro,
|
|
360
362
|
'coinbaseexchange': coinbaseexchangePro,
|
|
361
363
|
'coinbaseinternational': coinbaseinternationalPro,
|
|
362
364
|
'coincheck': coincheckPro,
|
|
@@ -481,6 +481,7 @@ interface Exchange {
|
|
|
481
481
|
fapiPublicGetConstituents(params?: {}): Promise<implicitReturnType>;
|
|
482
482
|
fapiPublicGetApiTradingStatus(params?: {}): Promise<implicitReturnType>;
|
|
483
483
|
fapiPublicGetLvtKlines(params?: {}): Promise<implicitReturnType>;
|
|
484
|
+
fapiPublicGetConvertExchangeInfo(params?: {}): Promise<implicitReturnType>;
|
|
484
485
|
fapiDataGetDeliveryPrice(params?: {}): Promise<implicitReturnType>;
|
|
485
486
|
fapiDataGetOpenInterestHist(params?: {}): Promise<implicitReturnType>;
|
|
486
487
|
fapiDataGetTopLongShortAccountRatio(params?: {}): Promise<implicitReturnType>;
|
|
@@ -525,6 +526,7 @@ interface Exchange {
|
|
|
525
526
|
fapiPrivateGetFeeBurn(params?: {}): Promise<implicitReturnType>;
|
|
526
527
|
fapiPrivateGetSymbolConfig(params?: {}): Promise<implicitReturnType>;
|
|
527
528
|
fapiPrivateGetAccountConfig(params?: {}): Promise<implicitReturnType>;
|
|
529
|
+
fapiPrivateGetConvertOrderStatus(params?: {}): Promise<implicitReturnType>;
|
|
528
530
|
fapiPrivatePostBatchOrders(params?: {}): Promise<implicitReturnType>;
|
|
529
531
|
fapiPrivatePostPositionSideDual(params?: {}): Promise<implicitReturnType>;
|
|
530
532
|
fapiPrivatePostPositionMargin(params?: {}): Promise<implicitReturnType>;
|
|
@@ -537,6 +539,8 @@ interface Exchange {
|
|
|
537
539
|
fapiPrivatePostApiReferralCustomization(params?: {}): Promise<implicitReturnType>;
|
|
538
540
|
fapiPrivatePostApiReferralUserCustomization(params?: {}): Promise<implicitReturnType>;
|
|
539
541
|
fapiPrivatePostFeeBurn(params?: {}): Promise<implicitReturnType>;
|
|
542
|
+
fapiPrivatePostConvertGetQuote(params?: {}): Promise<implicitReturnType>;
|
|
543
|
+
fapiPrivatePostConvertAcceptQuote(params?: {}): Promise<implicitReturnType>;
|
|
540
544
|
fapiPrivatePutListenKey(params?: {}): Promise<implicitReturnType>;
|
|
541
545
|
fapiPrivatePutOrder(params?: {}): Promise<implicitReturnType>;
|
|
542
546
|
fapiPrivatePutBatchOrders(params?: {}): Promise<implicitReturnType>;
|
|
@@ -481,6 +481,7 @@ interface binance {
|
|
|
481
481
|
fapiPublicGetConstituents(params?: {}): Promise<implicitReturnType>;
|
|
482
482
|
fapiPublicGetApiTradingStatus(params?: {}): Promise<implicitReturnType>;
|
|
483
483
|
fapiPublicGetLvtKlines(params?: {}): Promise<implicitReturnType>;
|
|
484
|
+
fapiPublicGetConvertExchangeInfo(params?: {}): Promise<implicitReturnType>;
|
|
484
485
|
fapiDataGetDeliveryPrice(params?: {}): Promise<implicitReturnType>;
|
|
485
486
|
fapiDataGetOpenInterestHist(params?: {}): Promise<implicitReturnType>;
|
|
486
487
|
fapiDataGetTopLongShortAccountRatio(params?: {}): Promise<implicitReturnType>;
|
|
@@ -525,6 +526,7 @@ interface binance {
|
|
|
525
526
|
fapiPrivateGetFeeBurn(params?: {}): Promise<implicitReturnType>;
|
|
526
527
|
fapiPrivateGetSymbolConfig(params?: {}): Promise<implicitReturnType>;
|
|
527
528
|
fapiPrivateGetAccountConfig(params?: {}): Promise<implicitReturnType>;
|
|
529
|
+
fapiPrivateGetConvertOrderStatus(params?: {}): Promise<implicitReturnType>;
|
|
528
530
|
fapiPrivatePostBatchOrders(params?: {}): Promise<implicitReturnType>;
|
|
529
531
|
fapiPrivatePostPositionSideDual(params?: {}): Promise<implicitReturnType>;
|
|
530
532
|
fapiPrivatePostPositionMargin(params?: {}): Promise<implicitReturnType>;
|
|
@@ -537,6 +539,8 @@ interface binance {
|
|
|
537
539
|
fapiPrivatePostApiReferralCustomization(params?: {}): Promise<implicitReturnType>;
|
|
538
540
|
fapiPrivatePostApiReferralUserCustomization(params?: {}): Promise<implicitReturnType>;
|
|
539
541
|
fapiPrivatePostFeeBurn(params?: {}): Promise<implicitReturnType>;
|
|
542
|
+
fapiPrivatePostConvertGetQuote(params?: {}): Promise<implicitReturnType>;
|
|
543
|
+
fapiPrivatePostConvertAcceptQuote(params?: {}): Promise<implicitReturnType>;
|
|
540
544
|
fapiPrivatePutListenKey(params?: {}): Promise<implicitReturnType>;
|
|
541
545
|
fapiPrivatePutOrder(params?: {}): Promise<implicitReturnType>;
|
|
542
546
|
fapiPrivatePutBatchOrders(params?: {}): Promise<implicitReturnType>;
|
|
@@ -533,6 +533,7 @@ interface binance {
|
|
|
533
533
|
fapiPublicGetConstituents(params?: {}): Promise<implicitReturnType>;
|
|
534
534
|
fapiPublicGetApiTradingStatus(params?: {}): Promise<implicitReturnType>;
|
|
535
535
|
fapiPublicGetLvtKlines(params?: {}): Promise<implicitReturnType>;
|
|
536
|
+
fapiPublicGetConvertExchangeInfo(params?: {}): Promise<implicitReturnType>;
|
|
536
537
|
fapiDataGetDeliveryPrice(params?: {}): Promise<implicitReturnType>;
|
|
537
538
|
fapiDataGetOpenInterestHist(params?: {}): Promise<implicitReturnType>;
|
|
538
539
|
fapiDataGetTopLongShortAccountRatio(params?: {}): Promise<implicitReturnType>;
|
|
@@ -577,6 +578,7 @@ interface binance {
|
|
|
577
578
|
fapiPrivateGetFeeBurn(params?: {}): Promise<implicitReturnType>;
|
|
578
579
|
fapiPrivateGetSymbolConfig(params?: {}): Promise<implicitReturnType>;
|
|
579
580
|
fapiPrivateGetAccountConfig(params?: {}): Promise<implicitReturnType>;
|
|
581
|
+
fapiPrivateGetConvertOrderStatus(params?: {}): Promise<implicitReturnType>;
|
|
580
582
|
fapiPrivatePostBatchOrders(params?: {}): Promise<implicitReturnType>;
|
|
581
583
|
fapiPrivatePostPositionSideDual(params?: {}): Promise<implicitReturnType>;
|
|
582
584
|
fapiPrivatePostPositionMargin(params?: {}): Promise<implicitReturnType>;
|
|
@@ -589,6 +591,8 @@ interface binance {
|
|
|
589
591
|
fapiPrivatePostApiReferralCustomization(params?: {}): Promise<implicitReturnType>;
|
|
590
592
|
fapiPrivatePostApiReferralUserCustomization(params?: {}): Promise<implicitReturnType>;
|
|
591
593
|
fapiPrivatePostFeeBurn(params?: {}): Promise<implicitReturnType>;
|
|
594
|
+
fapiPrivatePostConvertGetQuote(params?: {}): Promise<implicitReturnType>;
|
|
595
|
+
fapiPrivatePostConvertAcceptQuote(params?: {}): Promise<implicitReturnType>;
|
|
592
596
|
fapiPrivatePutListenKey(params?: {}): Promise<implicitReturnType>;
|
|
593
597
|
fapiPrivatePutOrder(params?: {}): Promise<implicitReturnType>;
|
|
594
598
|
fapiPrivatePutBatchOrders(params?: {}): Promise<implicitReturnType>;
|
|
@@ -481,6 +481,7 @@ interface binance {
|
|
|
481
481
|
fapiPublicGetConstituents(params?: {}): Promise<implicitReturnType>;
|
|
482
482
|
fapiPublicGetApiTradingStatus(params?: {}): Promise<implicitReturnType>;
|
|
483
483
|
fapiPublicGetLvtKlines(params?: {}): Promise<implicitReturnType>;
|
|
484
|
+
fapiPublicGetConvertExchangeInfo(params?: {}): Promise<implicitReturnType>;
|
|
484
485
|
fapiDataGetDeliveryPrice(params?: {}): Promise<implicitReturnType>;
|
|
485
486
|
fapiDataGetOpenInterestHist(params?: {}): Promise<implicitReturnType>;
|
|
486
487
|
fapiDataGetTopLongShortAccountRatio(params?: {}): Promise<implicitReturnType>;
|
|
@@ -525,6 +526,7 @@ interface binance {
|
|
|
525
526
|
fapiPrivateGetFeeBurn(params?: {}): Promise<implicitReturnType>;
|
|
526
527
|
fapiPrivateGetSymbolConfig(params?: {}): Promise<implicitReturnType>;
|
|
527
528
|
fapiPrivateGetAccountConfig(params?: {}): Promise<implicitReturnType>;
|
|
529
|
+
fapiPrivateGetConvertOrderStatus(params?: {}): Promise<implicitReturnType>;
|
|
528
530
|
fapiPrivatePostBatchOrders(params?: {}): Promise<implicitReturnType>;
|
|
529
531
|
fapiPrivatePostPositionSideDual(params?: {}): Promise<implicitReturnType>;
|
|
530
532
|
fapiPrivatePostPositionMargin(params?: {}): Promise<implicitReturnType>;
|
|
@@ -537,6 +539,8 @@ interface binance {
|
|
|
537
539
|
fapiPrivatePostApiReferralCustomization(params?: {}): Promise<implicitReturnType>;
|
|
538
540
|
fapiPrivatePostApiReferralUserCustomization(params?: {}): Promise<implicitReturnType>;
|
|
539
541
|
fapiPrivatePostFeeBurn(params?: {}): Promise<implicitReturnType>;
|
|
542
|
+
fapiPrivatePostConvertGetQuote(params?: {}): Promise<implicitReturnType>;
|
|
543
|
+
fapiPrivatePostConvertAcceptQuote(params?: {}): Promise<implicitReturnType>;
|
|
540
544
|
fapiPrivatePutListenKey(params?: {}): Promise<implicitReturnType>;
|
|
541
545
|
fapiPrivatePutOrder(params?: {}): Promise<implicitReturnType>;
|
|
542
546
|
fapiPrivatePutBatchOrders(params?: {}): Promise<implicitReturnType>;
|
|
@@ -218,6 +218,7 @@ interface kucoin {
|
|
|
218
218
|
futuresPrivateDeleteWithdrawalsWithdrawalId(params?: {}): Promise<implicitReturnType>;
|
|
219
219
|
futuresPrivateDeleteCancelTransferOut(params?: {}): Promise<implicitReturnType>;
|
|
220
220
|
futuresPrivateDeleteSubApiKey(params?: {}): Promise<implicitReturnType>;
|
|
221
|
+
futuresPrivateDeleteOrdersMultiCancel(params?: {}): Promise<implicitReturnType>;
|
|
221
222
|
webExchangeGetCurrencyCurrencyChainInfo(params?: {}): Promise<implicitReturnType>;
|
|
222
223
|
webExchangeGetContractSymbolFundingRates(params?: {}): Promise<implicitReturnType>;
|
|
223
224
|
brokerGetBrokerNdInfo(params?: {}): Promise<implicitReturnType>;
|