ccxt 4.4.19 → 4.4.21
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 +4 -4
- package/dist/cjs/ccxt.js +3 -1
- package/dist/cjs/src/base/Exchange.js +18 -0
- package/dist/cjs/src/base/ws/Future.js +3 -1
- package/dist/cjs/src/binance.js +0 -10
- package/dist/cjs/src/bingx.js +6 -1
- package/dist/cjs/src/bybit.js +67 -4
- package/dist/cjs/src/gate.js +1 -0
- package/dist/cjs/src/htx.js +28 -0
- package/dist/cjs/src/hyperliquid.js +7 -6
- package/dist/cjs/src/kucoin.js +16 -36
- package/dist/cjs/src/kucoinfutures.js +2 -2
- package/dist/cjs/src/lbank.js +3 -3
- package/dist/cjs/src/okx.js +8 -10
- package/dist/cjs/src/paradex.js +1 -2
- package/dist/cjs/src/phemex.js +75 -0
- package/dist/cjs/src/pro/coinbaseadvanced.js +17 -0
- package/dist/cjs/src/static_dependencies/noble-hashes/_sha2.js +1 -1
- package/dist/cjs/src/static_dependencies/noble-hashes/hmac.js +1 -1
- package/dist/cjs/src/static_dependencies/noble-hashes/sha3.js +1 -1
- package/dist/cjs/src/static_dependencies/watchable/src/unpromise.js +298 -0
- package/js/ccxt.d.ts +4 -1
- package/js/ccxt.js +3 -1
- package/js/src/abstract/bybit.d.ts +1 -0
- package/js/src/abstract/kucoin.d.ts +1 -0
- package/js/src/abstract/kucoinfutures.d.ts +1 -0
- package/js/src/abstract/okx.d.ts +3 -0
- package/js/src/base/Exchange.d.ts +3 -1
- package/js/src/base/Exchange.js +18 -0
- package/js/src/base/ws/Future.js +2 -1
- package/js/src/binance.d.ts +0 -1
- package/js/src/binance.js +0 -10
- package/js/src/bingx.js +6 -1
- package/js/src/bybit.d.ts +1 -0
- package/js/src/bybit.js +67 -4
- package/js/src/gate.js +1 -0
- package/js/src/htx.d.ts +2 -2
- package/js/src/htx.js +28 -0
- package/js/src/hyperliquid.js +7 -6
- package/js/src/kucoin.d.ts +0 -1
- package/js/src/kucoin.js +16 -36
- package/js/src/kucoinfutures.js +2 -2
- package/js/src/lbank.js +3 -3
- package/js/src/okx.d.ts +0 -1
- package/js/src/okx.js +9 -11
- package/js/src/paradex.js +1 -1
- 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/js/src/static_dependencies/noble-hashes/_blake2.js +1 -1
- package/js/src/static_dependencies/noble-hashes/_sha2.js +1 -1
- package/js/src/static_dependencies/noble-hashes/hmac.js +1 -1
- package/js/src/static_dependencies/noble-hashes/sha3-addons.js +5 -5
- package/js/src/static_dependencies/noble-hashes/sha3.js +1 -1
- package/js/src/static_dependencies/watchable/src/index.d.ts +2 -0
- package/js/src/static_dependencies/watchable/src/index.js +7 -0
- package/js/src/static_dependencies/watchable/src/types.d.ts +28 -0
- package/js/src/static_dependencies/watchable/src/types.js +8 -0
- package/js/src/static_dependencies/watchable/src/unpromise.d.ts +120 -0
- package/js/src/static_dependencies/watchable/src/unpromise.js +297 -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.21';
|
|
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,
|
|
@@ -5524,6 +5524,19 @@ class Exchange {
|
|
|
5524
5524
|
}
|
|
5525
5525
|
return interests;
|
|
5526
5526
|
}
|
|
5527
|
+
parseBorrowRate(info, currency = undefined) {
|
|
5528
|
+
throw new errors.NotSupported(this.id + ' parseBorrowRate() is not supported yet');
|
|
5529
|
+
}
|
|
5530
|
+
parseBorrowRateHistory(response, code, since, limit) {
|
|
5531
|
+
const result = [];
|
|
5532
|
+
for (let i = 0; i < response.length; i++) {
|
|
5533
|
+
const item = response[i];
|
|
5534
|
+
const borrowRate = this.parseBorrowRate(item);
|
|
5535
|
+
result.push(borrowRate);
|
|
5536
|
+
}
|
|
5537
|
+
const sorted = this.sortBy(result, 'timestamp');
|
|
5538
|
+
return this.filterByCurrencySinceLimit(sorted, code, since, limit);
|
|
5539
|
+
}
|
|
5527
5540
|
parseIsolatedBorrowRates(info) {
|
|
5528
5541
|
const result = {};
|
|
5529
5542
|
for (let i = 0; i < info.length; i++) {
|
|
@@ -6165,6 +6178,8 @@ class Exchange {
|
|
|
6165
6178
|
let i = 0;
|
|
6166
6179
|
let errors = 0;
|
|
6167
6180
|
let result = [];
|
|
6181
|
+
const timeframe = this.safeString(params, 'timeframe');
|
|
6182
|
+
params = this.omit(params, 'timeframe'); // reading the timeframe from the method arguments to avoid changing the signature
|
|
6168
6183
|
while (i < maxCalls) {
|
|
6169
6184
|
try {
|
|
6170
6185
|
if (cursorValue !== undefined) {
|
|
@@ -6180,6 +6195,9 @@ class Exchange {
|
|
|
6180
6195
|
else if (method === 'getLeverageTiersPaginated' || method === 'fetchPositions') {
|
|
6181
6196
|
response = await this[method](symbol, params);
|
|
6182
6197
|
}
|
|
6198
|
+
else if (method === 'fetchOpenInterestHistory') {
|
|
6199
|
+
response = await this[method](symbol, timeframe, since, maxEntriesPerRequest, params);
|
|
6200
|
+
}
|
|
6183
6201
|
else {
|
|
6184
6202
|
response = await this[method](symbol, since, maxEntriesPerRequest, params);
|
|
6185
6203
|
}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var unpromise = require('../../static_dependencies/watchable/src/unpromise.js');
|
|
6
|
+
|
|
5
7
|
// @ts-nocheck
|
|
6
8
|
function Future() {
|
|
7
9
|
let resolve = undefined, reject = undefined;
|
|
@@ -29,6 +31,6 @@ function wrapFuture(aggregatePromise) {
|
|
|
29
31
|
aggregatePromise.then(p.resolve, p.reject);
|
|
30
32
|
return p;
|
|
31
33
|
}
|
|
32
|
-
Future.race = (futures) => wrapFuture(
|
|
34
|
+
Future.race = (futures) => wrapFuture(unpromise.Unpromise.race(futures));
|
|
33
35
|
|
|
34
36
|
exports.Future = Future;
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -12115,16 +12115,6 @@ class binance extends binance$1 {
|
|
|
12115
12115
|
//
|
|
12116
12116
|
return this.parseBorrowRateHistory(response, code, since, limit);
|
|
12117
12117
|
}
|
|
12118
|
-
parseBorrowRateHistory(response, code, since, limit) {
|
|
12119
|
-
const result = [];
|
|
12120
|
-
for (let i = 0; i < response.length; i++) {
|
|
12121
|
-
const item = response[i];
|
|
12122
|
-
const borrowRate = this.parseBorrowRate(item);
|
|
12123
|
-
result.push(borrowRate);
|
|
12124
|
-
}
|
|
12125
|
-
const sorted = this.sortBy(result, 'timestamp');
|
|
12126
|
-
return this.filterByCurrencySinceLimit(sorted, code, since, limit);
|
|
12127
|
-
}
|
|
12128
12118
|
parseBorrowRate(info, currency = undefined) {
|
|
12129
12119
|
//
|
|
12130
12120
|
// {
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -5316,7 +5316,7 @@ class bingx extends bingx$1 {
|
|
|
5316
5316
|
* @method
|
|
5317
5317
|
* @name bingx#withdraw
|
|
5318
5318
|
* @description make a withdrawal
|
|
5319
|
-
* @see https://bingx-api.github.io/docs/#/
|
|
5319
|
+
* @see https://bingx-api.github.io/docs/#/en-us/spot/wallet-api.html#Withdraw
|
|
5320
5320
|
* @param {string} code unified currency code
|
|
5321
5321
|
* @param {float} amount the amount to withdraw
|
|
5322
5322
|
* @param {string} address the address to withdraw to
|
|
@@ -5325,6 +5325,8 @@ class bingx extends bingx$1 {
|
|
|
5325
5325
|
* @param {int} [params.walletType] 1 fund account, 2 standard account, 3 perpetual account
|
|
5326
5326
|
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5327
5327
|
*/
|
|
5328
|
+
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
5329
|
+
this.checkAddress(address);
|
|
5328
5330
|
await this.loadMarkets();
|
|
5329
5331
|
const currency = this.currency(code);
|
|
5330
5332
|
let walletType = this.safeInteger(params, 'walletType');
|
|
@@ -5344,6 +5346,9 @@ class bingx extends bingx$1 {
|
|
|
5344
5346
|
if (network !== undefined) {
|
|
5345
5347
|
request['network'] = this.networkCodeToId(network);
|
|
5346
5348
|
}
|
|
5349
|
+
if (tag !== undefined) {
|
|
5350
|
+
request['addressTag'] = tag;
|
|
5351
|
+
}
|
|
5347
5352
|
params = this.omit(params, ['walletType', 'network']);
|
|
5348
5353
|
const response = await this.walletsV1PrivatePostCapitalWithdrawApply(this.extend(request, params));
|
|
5349
5354
|
const data = this.safeValue(response, 'data');
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -368,6 +368,7 @@ class bybit extends bybit$1 {
|
|
|
368
368
|
// spot leverage token
|
|
369
369
|
'v5/spot-lever-token/order-record': 1,
|
|
370
370
|
// spot margin trade
|
|
371
|
+
'v5/spot-margin-trade/interest-rate-history': 5,
|
|
371
372
|
'v5/spot-margin-trade/state': 5,
|
|
372
373
|
'v5/spot-cross-margin-trade/loan-info': 1,
|
|
373
374
|
'v5/spot-cross-margin-trade/account': 1,
|
|
@@ -7239,7 +7240,8 @@ class bybit extends bybit$1 {
|
|
|
7239
7240
|
const paginate = this.safeBool(params, 'paginate');
|
|
7240
7241
|
if (paginate) {
|
|
7241
7242
|
params = this.omit(params, 'paginate');
|
|
7242
|
-
|
|
7243
|
+
params['timeframe'] = timeframe;
|
|
7244
|
+
return await this.fetchPaginatedCallCursor('fetchOpenInterestHistory', symbol, since, limit, params, 'nextPageCursor', 'cursor', undefined, 200);
|
|
7243
7245
|
}
|
|
7244
7246
|
const market = this.market(symbol);
|
|
7245
7247
|
if (market['spot'] || market['option']) {
|
|
@@ -7313,12 +7315,22 @@ class bybit extends bybit$1 {
|
|
|
7313
7315
|
// "timestamp": 1666734490778
|
|
7314
7316
|
// }
|
|
7315
7317
|
//
|
|
7318
|
+
// fetchBorrowRateHistory
|
|
7319
|
+
// {
|
|
7320
|
+
// "timestamp": 1721469600000,
|
|
7321
|
+
// "currency": "USDC",
|
|
7322
|
+
// "hourlyBorrowRate": "0.000014621596",
|
|
7323
|
+
// "vipLevel": "No VIP"
|
|
7324
|
+
// }
|
|
7325
|
+
//
|
|
7316
7326
|
const timestamp = this.safeInteger(info, 'timestamp');
|
|
7317
|
-
const currencyId = this.
|
|
7327
|
+
const currencyId = this.safeString2(info, 'coin', 'currency');
|
|
7328
|
+
const hourlyBorrowRate = this.safeNumber(info, 'hourlyBorrowRate');
|
|
7329
|
+
const period = (hourlyBorrowRate !== undefined) ? 3600000 : 86400000; // 1h or 1d
|
|
7318
7330
|
return {
|
|
7319
7331
|
'currency': this.safeCurrencyCode(currencyId, currency),
|
|
7320
|
-
'rate': this.safeNumber(info, 'interestRate'),
|
|
7321
|
-
'period':
|
|
7332
|
+
'rate': this.safeNumber(info, 'interestRate', hourlyBorrowRate),
|
|
7333
|
+
'period': period,
|
|
7322
7334
|
'timestamp': timestamp,
|
|
7323
7335
|
'datetime': this.iso8601(timestamp),
|
|
7324
7336
|
'info': info,
|
|
@@ -7370,6 +7382,57 @@ class bybit extends bybit$1 {
|
|
|
7370
7382
|
const interest = this.parseBorrowInterests(rows, undefined);
|
|
7371
7383
|
return this.filterByCurrencySinceLimit(interest, code, since, limit);
|
|
7372
7384
|
}
|
|
7385
|
+
async fetchBorrowRateHistory(code, since = undefined, limit = undefined, params = {}) {
|
|
7386
|
+
/**
|
|
7387
|
+
* @method
|
|
7388
|
+
* @name bybit#fetchBorrowRateHistory
|
|
7389
|
+
* @description retrieves a history of a currencies borrow interest rate at specific time slots
|
|
7390
|
+
* @see https://bybit-exchange.github.io/docs/v5/spot-margin-uta/historical-interest
|
|
7391
|
+
* @param {string} code unified currency code
|
|
7392
|
+
* @param {int} [since] timestamp for the earliest borrow rate
|
|
7393
|
+
* @param {int} [limit] the maximum number of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} to retrieve
|
|
7394
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7395
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
7396
|
+
* @returns {object[]} an array of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
7397
|
+
*/
|
|
7398
|
+
await this.loadMarkets();
|
|
7399
|
+
const currency = this.currency(code);
|
|
7400
|
+
const request = {
|
|
7401
|
+
'currency': currency['id'],
|
|
7402
|
+
};
|
|
7403
|
+
if (since === undefined) {
|
|
7404
|
+
since = this.milliseconds() - 86400000 * 30; // last 30 days
|
|
7405
|
+
}
|
|
7406
|
+
request['startTime'] = since;
|
|
7407
|
+
let endTime = this.safeInteger2(params, 'until', 'endTime');
|
|
7408
|
+
params = this.omit(params, ['until']);
|
|
7409
|
+
if (endTime === undefined) {
|
|
7410
|
+
endTime = since + 86400000 * 30; // since + 30 days
|
|
7411
|
+
}
|
|
7412
|
+
request['endTime'] = endTime;
|
|
7413
|
+
const response = await this.privateGetV5SpotMarginTradeInterestRateHistory(this.extend(request, params));
|
|
7414
|
+
//
|
|
7415
|
+
// {
|
|
7416
|
+
// "retCode": 0,
|
|
7417
|
+
// "retMsg": "OK",
|
|
7418
|
+
// "result": {
|
|
7419
|
+
// "list": [
|
|
7420
|
+
// {
|
|
7421
|
+
// "timestamp": 1721469600000,
|
|
7422
|
+
// "currency": "USDC",
|
|
7423
|
+
// "hourlyBorrowRate": "0.000014621596",
|
|
7424
|
+
// "vipLevel": "No VIP"
|
|
7425
|
+
// }
|
|
7426
|
+
// ]
|
|
7427
|
+
// },
|
|
7428
|
+
// "retExtInfo": "{}",
|
|
7429
|
+
// "time": 1721899048991
|
|
7430
|
+
// }
|
|
7431
|
+
//
|
|
7432
|
+
const data = this.safeDict(response, 'result');
|
|
7433
|
+
const rows = this.safeList(data, 'list', []);
|
|
7434
|
+
return this.parseBorrowRateHistory(rows, code, since, limit);
|
|
7435
|
+
}
|
|
7373
7436
|
parseBorrowInterest(info, market = undefined) {
|
|
7374
7437
|
//
|
|
7375
7438
|
// {
|
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
|
@@ -1636,6 +1636,10 @@ class htx extends htx$1 {
|
|
|
1636
1636
|
* @method
|
|
1637
1637
|
* @name htx#fetchMarkets
|
|
1638
1638
|
* @description retrieves data on all markets for huobi
|
|
1639
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-all-supported-trading-symbol-v1-deprecated
|
|
1640
|
+
* @see https://huobiapi.github.io/docs/dm/v1/en/#get-contract-info
|
|
1641
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-swap-info
|
|
1642
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-swap-info
|
|
1639
1643
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1640
1644
|
* @returns {object[]} an array of objects representing market data
|
|
1641
1645
|
*/
|
|
@@ -1666,6 +1670,20 @@ class htx extends htx$1 {
|
|
|
1666
1670
|
return allMarkets;
|
|
1667
1671
|
}
|
|
1668
1672
|
async fetchMarketsByTypeAndSubType(type, subType, params = {}) {
|
|
1673
|
+
/**
|
|
1674
|
+
* @ignore
|
|
1675
|
+
* @method
|
|
1676
|
+
* @name htx#fetchMarketsByTypeAndSubType
|
|
1677
|
+
* @description retrieves data on all markets of a certain type and/or subtype
|
|
1678
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-all-supported-trading-symbol-v1-deprecated
|
|
1679
|
+
* @see https://huobiapi.github.io/docs/dm/v1/en/#get-contract-info
|
|
1680
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-swap-info
|
|
1681
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-swap-info
|
|
1682
|
+
* @param {string} [type] 'spot', 'swap' or 'future'
|
|
1683
|
+
* @param {string} [subType] 'linear' or 'inverse'
|
|
1684
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1685
|
+
* @returns {object[]} an array of objects representing market data
|
|
1686
|
+
*/
|
|
1669
1687
|
const isSpot = (type === 'spot');
|
|
1670
1688
|
const request = {};
|
|
1671
1689
|
let response = undefined;
|
|
@@ -3188,6 +3206,16 @@ class htx extends htx$1 {
|
|
|
3188
3206
|
};
|
|
3189
3207
|
}
|
|
3190
3208
|
async fetchAccountIdByType(type, marginMode = undefined, symbol = undefined, params = {}) {
|
|
3209
|
+
/**
|
|
3210
|
+
* @method
|
|
3211
|
+
* @name htx#fetchAccountIdByType
|
|
3212
|
+
* @description fetch all the accounts by a type and marginModeassociated with a profile
|
|
3213
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-all-accounts-of-the-current-user
|
|
3214
|
+
* @param {string} type 'spot', 'swap' or 'future
|
|
3215
|
+
* @param {string} [marginMode] 'cross' or 'isolated'
|
|
3216
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3217
|
+
* @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
|
|
3218
|
+
*/
|
|
3191
3219
|
const accounts = await this.loadAccounts();
|
|
3192
3220
|
const accountId = this.safeValue2(params, 'accountId', 'account-id');
|
|
3193
3221
|
if (accountId !== undefined) {
|
|
@@ -642,9 +642,9 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
642
642
|
const code = this.safeCurrencyCode(this.safeString(balance, 'coin'));
|
|
643
643
|
const account = this.account();
|
|
644
644
|
const total = this.safeString(balance, 'total');
|
|
645
|
-
const
|
|
645
|
+
const used = this.safeString(balance, 'hold');
|
|
646
646
|
account['total'] = total;
|
|
647
|
-
account['used'] =
|
|
647
|
+
account['used'] = used;
|
|
648
648
|
spotBalances[code] = account;
|
|
649
649
|
}
|
|
650
650
|
return this.safeBalance(spotBalances);
|
|
@@ -653,8 +653,8 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
653
653
|
const result = {
|
|
654
654
|
'info': response,
|
|
655
655
|
'USDC': {
|
|
656
|
-
'total': this.
|
|
657
|
-
'
|
|
656
|
+
'total': this.safeNumber(data, 'accountValue'),
|
|
657
|
+
'free': this.safeNumber(response, 'withdrawable'),
|
|
658
658
|
},
|
|
659
659
|
};
|
|
660
660
|
const timestamp = this.safeInteger(response, 'time');
|
|
@@ -2227,10 +2227,11 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2227
2227
|
const leverage = this.safeDict(entry, 'leverage', {});
|
|
2228
2228
|
const marginMode = this.safeString(leverage, 'type');
|
|
2229
2229
|
const isIsolated = (marginMode === 'isolated');
|
|
2230
|
-
|
|
2230
|
+
let size = this.safeString(entry, 'szi');
|
|
2231
2231
|
let side = undefined;
|
|
2232
2232
|
if (size !== undefined) {
|
|
2233
|
-
side = (size
|
|
2233
|
+
side = Precise["default"].stringGt(size, '0') ? 'long' : 'short';
|
|
2234
|
+
size = Precise["default"].stringAbs(size);
|
|
2234
2235
|
}
|
|
2235
2236
|
const unrealizedPnl = this.safeNumber(entry, 'unrealizedPnl');
|
|
2236
2237
|
const initialMargin = this.safeNumber(entry, 'marginUsed');
|
package/dist/cjs/src/kucoin.js
CHANGED
|
@@ -163,7 +163,8 @@ class kucoin extends kucoin$1 {
|
|
|
163
163
|
// margin trading
|
|
164
164
|
'mark-price/{symbol}/current': 3,
|
|
165
165
|
'mark-price/all-symbols': 3,
|
|
166
|
-
'margin/config': 25,
|
|
166
|
+
'margin/config': 25,
|
|
167
|
+
'announcements': 20, // 20W
|
|
167
168
|
},
|
|
168
169
|
'post': {
|
|
169
170
|
// ws
|
|
@@ -453,6 +454,7 @@ class kucoin extends kucoin$1 {
|
|
|
453
454
|
'precisionMode': number.TICK_SIZE,
|
|
454
455
|
'exceptions': {
|
|
455
456
|
'exact': {
|
|
457
|
+
'The order does not exist.': errors.OrderNotFound,
|
|
456
458
|
'order not exist': errors.OrderNotFound,
|
|
457
459
|
'order not exist.': errors.OrderNotFound,
|
|
458
460
|
'order_not_exist': errors.OrderNotFound,
|
|
@@ -653,6 +655,7 @@ class kucoin extends kucoin$1 {
|
|
|
653
655
|
'currencies/{currency}': 'v3',
|
|
654
656
|
'symbols': 'v2',
|
|
655
657
|
'mark-price/all-symbols': 'v3',
|
|
658
|
+
'announcements': 'v3',
|
|
656
659
|
},
|
|
657
660
|
},
|
|
658
661
|
'private': {
|
|
@@ -1541,41 +1544,28 @@ class kucoin extends kucoin$1 {
|
|
|
1541
1544
|
// "chain": "ERC20"
|
|
1542
1545
|
// }
|
|
1543
1546
|
//
|
|
1547
|
+
const minWithdrawFee = this.safeNumber(fee, 'withdrawMinFee');
|
|
1544
1548
|
const result = {
|
|
1545
1549
|
'info': fee,
|
|
1546
1550
|
'withdraw': {
|
|
1551
|
+
'fee': minWithdrawFee,
|
|
1552
|
+
'percentage': false,
|
|
1553
|
+
},
|
|
1554
|
+
'deposit': {
|
|
1547
1555
|
'fee': undefined,
|
|
1548
1556
|
'percentage': undefined,
|
|
1549
1557
|
},
|
|
1558
|
+
'networks': {},
|
|
1559
|
+
};
|
|
1560
|
+
const networkId = this.safeString(fee, 'chain');
|
|
1561
|
+
const networkCode = this.networkIdToCode(networkId, this.safeString(currency, 'code'));
|
|
1562
|
+
result['networks'][networkCode] = {
|
|
1563
|
+
'withdraw': minWithdrawFee,
|
|
1550
1564
|
'deposit': {
|
|
1551
1565
|
'fee': undefined,
|
|
1552
1566
|
'percentage': undefined,
|
|
1553
1567
|
},
|
|
1554
|
-
'networks': {},
|
|
1555
1568
|
};
|
|
1556
|
-
const isWithdrawEnabled = this.safeBool(fee, 'isWithdrawEnabled', true);
|
|
1557
|
-
let minFee = undefined;
|
|
1558
|
-
if (isWithdrawEnabled) {
|
|
1559
|
-
result['withdraw']['percentage'] = false;
|
|
1560
|
-
const chains = this.safeList(fee, 'chains', []);
|
|
1561
|
-
for (let i = 0; i < chains.length; i++) {
|
|
1562
|
-
const chain = chains[i];
|
|
1563
|
-
const networkId = this.safeString(chain, 'chainId');
|
|
1564
|
-
const networkCode = this.networkIdToCode(networkId, this.safeString(currency, 'code'));
|
|
1565
|
-
const withdrawFee = this.safeString(chain, 'withdrawalMinFee');
|
|
1566
|
-
if (minFee === undefined || (Precise["default"].stringLt(withdrawFee, minFee))) {
|
|
1567
|
-
minFee = withdrawFee;
|
|
1568
|
-
}
|
|
1569
|
-
result['networks'][networkCode] = {
|
|
1570
|
-
'withdraw': this.parseNumber(withdrawFee),
|
|
1571
|
-
'deposit': {
|
|
1572
|
-
'fee': undefined,
|
|
1573
|
-
'percentage': undefined,
|
|
1574
|
-
},
|
|
1575
|
-
};
|
|
1576
|
-
}
|
|
1577
|
-
result['withdraw']['fee'] = this.parseNumber(minFee);
|
|
1578
|
-
}
|
|
1579
1569
|
return result;
|
|
1580
1570
|
}
|
|
1581
1571
|
isFuturesMethod(methodName, params) {
|
|
@@ -3091,7 +3081,7 @@ class kucoin extends kucoin$1 {
|
|
|
3091
3081
|
},
|
|
3092
3082
|
'status': status,
|
|
3093
3083
|
'lastTradeTimestamp': undefined,
|
|
3094
|
-
'average':
|
|
3084
|
+
'average': this.safeString(order, 'avgDealPrice'),
|
|
3095
3085
|
'trades': undefined,
|
|
3096
3086
|
}, market);
|
|
3097
3087
|
}
|
|
@@ -4426,16 +4416,6 @@ class kucoin extends kucoin$1 {
|
|
|
4426
4416
|
}
|
|
4427
4417
|
return this.safeValue(config, 'cost', 1);
|
|
4428
4418
|
}
|
|
4429
|
-
parseBorrowRateHistory(response, code, since, limit) {
|
|
4430
|
-
const result = [];
|
|
4431
|
-
for (let i = 0; i < response.length; i++) {
|
|
4432
|
-
const item = response[i];
|
|
4433
|
-
const borrowRate = this.parseBorrowRate(item);
|
|
4434
|
-
result.push(borrowRate);
|
|
4435
|
-
}
|
|
4436
|
-
const sorted = this.sortBy(result, 'timestamp');
|
|
4437
|
-
return this.filterByCurrencySinceLimit(sorted, code, since, limit);
|
|
4438
|
-
}
|
|
4439
4419
|
parseBorrowRate(info, currency = undefined) {
|
|
4440
4420
|
//
|
|
4441
4421
|
// {
|
|
@@ -2217,8 +2217,8 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
2217
2217
|
const amount = this.safeString(order, 'size');
|
|
2218
2218
|
const filled = this.safeString(order, 'filledSize');
|
|
2219
2219
|
const cost = this.safeString(order, 'filledValue');
|
|
2220
|
-
let average =
|
|
2221
|
-
if (Precise["default"].stringGt(filled, '0')) {
|
|
2220
|
+
let average = this.safeString(order, 'avgDealPrice');
|
|
2221
|
+
if ((average === undefined) && Precise["default"].stringGt(filled, '0')) {
|
|
2222
2222
|
const contractSize = this.safeString(market, 'contractSize');
|
|
2223
2223
|
if (market['linear']) {
|
|
2224
2224
|
average = Precise["default"].stringDiv(cost, Precise["default"].stringMul(contractSize, filled));
|
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/okx.js
CHANGED
|
@@ -353,6 +353,9 @@ class okx extends okx$1 {
|
|
|
353
353
|
'account/fixed-loan/borrowing-limit': 4,
|
|
354
354
|
'account/fixed-loan/borrowing-quote': 5,
|
|
355
355
|
'account/fixed-loan/borrowing-orders-list': 5,
|
|
356
|
+
'account/spot-manual-borrow-repay': 10,
|
|
357
|
+
'account/set-auto-repay': 4,
|
|
358
|
+
'account/spot-borrow-repay-history': 4,
|
|
356
359
|
// subaccount
|
|
357
360
|
'users/subaccount/list': 10,
|
|
358
361
|
'account/subaccount/balances': 10 / 3,
|
|
@@ -884,6 +887,11 @@ class okx extends okx$1 {
|
|
|
884
887
|
'59301': errors.ExchangeError,
|
|
885
888
|
'59313': errors.ExchangeError,
|
|
886
889
|
'59401': errors.ExchangeError,
|
|
890
|
+
'59410': errors.OperationRejected,
|
|
891
|
+
'59411': errors.InsufficientFunds,
|
|
892
|
+
'59412': errors.OperationRejected,
|
|
893
|
+
'59413': errors.OperationRejected,
|
|
894
|
+
'59414': errors.BadRequest,
|
|
887
895
|
'59500': errors.ExchangeError,
|
|
888
896
|
'59501': errors.ExchangeError,
|
|
889
897
|
'59502': errors.ExchangeError,
|
|
@@ -6673,16 +6681,6 @@ class okx extends okx$1 {
|
|
|
6673
6681
|
}
|
|
6674
6682
|
return borrowRateHistories;
|
|
6675
6683
|
}
|
|
6676
|
-
parseBorrowRateHistory(response, code, since, limit) {
|
|
6677
|
-
const result = [];
|
|
6678
|
-
for (let i = 0; i < response.length; i++) {
|
|
6679
|
-
const item = response[i];
|
|
6680
|
-
const borrowRate = this.parseBorrowRate(item);
|
|
6681
|
-
result.push(borrowRate);
|
|
6682
|
-
}
|
|
6683
|
-
const sorted = this.sortBy(result, 'timestamp');
|
|
6684
|
-
return this.filterByCurrencySinceLimit(sorted, code, since, limit);
|
|
6685
|
-
}
|
|
6686
6684
|
async fetchBorrowRateHistories(codes = undefined, since = undefined, limit = undefined, params = {}) {
|
|
6687
6685
|
/**
|
|
6688
6686
|
* @method
|
package/dist/cjs/src/paradex.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('
|
|
3
|
+
var Precise = require('./base/Precise.js');
|
|
4
4
|
var paradex$1 = require('./abstract/paradex.js');
|
|
5
5
|
var errors = require('./base/errors.js');
|
|
6
6
|
var number = require('./base/functions/number.js');
|
|
7
7
|
var crypto = require('./base/functions/crypto.js');
|
|
8
8
|
var sha3 = require('./static_dependencies/noble-hashes/sha3.js');
|
|
9
9
|
var secp256k1 = require('./static_dependencies/noble-curves/secp256k1.js');
|
|
10
|
-
var Precise = require('./base/Precise.js');
|
|
11
10
|
|
|
12
11
|
// ---------------------------------------------------------------------------
|
|
13
12
|
// ---------------------------------------------------------------------------
|
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;
|
|
@@ -104,7 +104,7 @@ class SHA2 extends utils.Hash {
|
|
|
104
104
|
return res;
|
|
105
105
|
}
|
|
106
106
|
_cloneInto(to) {
|
|
107
|
-
to
|
|
107
|
+
to ||= new this.constructor();
|
|
108
108
|
to.set(...this.get());
|
|
109
109
|
const { blockLen, buffer, length, finished, destroyed, pos } = this;
|
|
110
110
|
to.length = length;
|
|
@@ -54,7 +54,7 @@ class HMAC extends utils.Hash {
|
|
|
54
54
|
}
|
|
55
55
|
_cloneInto(to) {
|
|
56
56
|
// Create new instance without calling constructor since key already in state and we don't know it.
|
|
57
|
-
to
|
|
57
|
+
to ||= Object.create(Object.getPrototypeOf(this), {});
|
|
58
58
|
const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
|
|
59
59
|
to = to;
|
|
60
60
|
to.finished = finished;
|