ccxt 4.4.21 → 4.4.23
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 +112 -111
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +6 -1
- package/dist/cjs/src/abstract/coincatch.js +9 -0
- package/dist/cjs/src/alpaca.js +1 -0
- package/dist/cjs/src/base/Exchange.js +21 -0
- package/dist/cjs/src/bigone.js +3 -0
- package/dist/cjs/src/binance.js +172 -44
- package/dist/cjs/src/bitfinex.js +4 -0
- package/dist/cjs/src/bitflyer.js +58 -0
- package/dist/cjs/src/bitget.js +77 -0
- package/dist/cjs/src/bitrue.js +3 -0
- package/dist/cjs/src/bybit.js +80 -2
- package/dist/cjs/src/cex.js +1307 -1381
- package/dist/cjs/src/coinbase.js +1 -1
- package/dist/cjs/src/coinbaseexchange.js +3 -0
- package/dist/cjs/src/coincatch.js +5370 -0
- package/dist/cjs/src/coinex.js +63 -1
- package/dist/cjs/src/cryptocom.js +1 -1
- package/dist/cjs/src/gate.js +103 -3
- package/dist/cjs/src/htx.js +1 -7
- package/dist/cjs/src/hyperliquid.js +10 -8
- package/dist/cjs/src/kucoin.js +27 -59
- package/dist/cjs/src/latoken.js +6 -0
- package/dist/cjs/src/mexc.js +1 -1
- package/dist/cjs/src/oceanex.js +2 -0
- package/dist/cjs/src/okcoin.js +1 -0
- package/dist/cjs/src/okx.js +74 -0
- package/dist/cjs/src/poloniex.js +5 -0
- package/dist/cjs/src/pro/coincatch.js +1554 -0
- package/js/ccxt.d.ts +9 -3
- package/js/ccxt.js +6 -2
- package/js/src/abstract/binance.d.ts +21 -0
- package/js/src/abstract/binancecoinm.d.ts +21 -0
- package/js/src/abstract/binanceus.d.ts +21 -0
- package/js/src/abstract/binanceusdm.d.ts +21 -0
- package/js/src/abstract/bitflyer.d.ts +1 -0
- package/js/src/abstract/bitget.d.ts +3 -0
- package/js/src/abstract/cex.d.ts +28 -29
- package/js/src/abstract/coincatch.d.ts +97 -0
- package/js/src/abstract/coincatch.js +11 -0
- package/js/src/abstract/gate.d.ts +5 -0
- package/js/src/abstract/gateio.d.ts +5 -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 +1 -0
- package/js/src/alpaca.js +1 -0
- package/js/src/base/Exchange.d.ts +8 -2
- package/js/src/base/Exchange.js +21 -0
- package/js/src/base/types.d.ts +8 -0
- package/js/src/bigone.js +3 -0
- package/js/src/binance.d.ts +3 -1
- package/js/src/binance.js +172 -44
- package/js/src/bitfinex.js +4 -0
- package/js/src/bitflyer.d.ts +3 -1
- package/js/src/bitflyer.js +58 -0
- package/js/src/bitget.d.ts +3 -1
- package/js/src/bitget.js +77 -0
- package/js/src/bitrue.js +3 -0
- package/js/src/bybit.d.ts +3 -1
- package/js/src/bybit.js +80 -2
- package/js/src/cex.d.ts +34 -20
- package/js/src/cex.js +1308 -1382
- package/js/src/coinbase.js +1 -1
- package/js/src/coinbaseexchange.js +3 -0
- package/js/src/coincatch.d.ts +130 -0
- package/js/src/coincatch.js +5371 -0
- package/js/src/coinex.d.ts +1 -0
- package/js/src/coinex.js +63 -1
- package/js/src/cryptocom.js +1 -1
- package/js/src/gate.d.ts +2 -0
- package/js/src/gate.js +103 -3
- package/js/src/htx.js +1 -7
- package/js/src/hyperliquid.js +10 -8
- package/js/src/kucoin.d.ts +0 -1
- package/js/src/kucoin.js +27 -59
- package/js/src/latoken.js +6 -0
- package/js/src/mexc.js +1 -1
- package/js/src/oceanex.js +2 -0
- package/js/src/okcoin.js +1 -0
- package/js/src/okx.d.ts +3 -1
- package/js/src/okx.js +74 -0
- package/js/src/poloniex.js +5 -0
- package/js/src/pro/coincatch.d.ts +57 -0
- package/js/src/pro/coincatch.js +1555 -0
- package/package.json +1 -1
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -89,6 +89,8 @@ class bybit extends bybit$1 {
|
|
|
89
89
|
'fetchLedger': true,
|
|
90
90
|
'fetchLeverage': true,
|
|
91
91
|
'fetchLeverageTiers': true,
|
|
92
|
+
'fetchLongShortRatio': false,
|
|
93
|
+
'fetchLongShortRatioHistory': true,
|
|
92
94
|
'fetchMarginAdjustmentHistory': false,
|
|
93
95
|
'fetchMarketLeverageTiers': true,
|
|
94
96
|
'fetchMarkets': true,
|
|
@@ -7642,13 +7644,13 @@ class bybit extends bybit$1 {
|
|
|
7642
7644
|
}
|
|
7643
7645
|
parseMarginLoan(info, currency = undefined) {
|
|
7644
7646
|
//
|
|
7645
|
-
//
|
|
7647
|
+
// borrowCrossMargin
|
|
7646
7648
|
//
|
|
7647
7649
|
// {
|
|
7648
7650
|
// "transactId": "14143"
|
|
7649
7651
|
// }
|
|
7650
7652
|
//
|
|
7651
|
-
//
|
|
7653
|
+
// repayCrossMargin
|
|
7652
7654
|
//
|
|
7653
7655
|
// {
|
|
7654
7656
|
// "repayId": "12128"
|
|
@@ -9307,6 +9309,82 @@ class bybit extends bybit$1 {
|
|
|
9307
9309
|
'fee': undefined,
|
|
9308
9310
|
};
|
|
9309
9311
|
}
|
|
9312
|
+
async fetchLongShortRatioHistory(symbol = undefined, timeframe = undefined, since = undefined, limit = undefined, params = {}) {
|
|
9313
|
+
/**
|
|
9314
|
+
* @method
|
|
9315
|
+
* @name bybit#fetchLongShortRatioHistory
|
|
9316
|
+
* @description fetches the long short ratio history for a unified market symbol
|
|
9317
|
+
* @see https://bybit-exchange.github.io/docs/v5/market/long-short-ratio
|
|
9318
|
+
* @param {string} symbol unified symbol of the market to fetch the long short ratio for
|
|
9319
|
+
* @param {string} [timeframe] the period for the ratio, default is 24 hours
|
|
9320
|
+
* @param {int} [since] the earliest time in ms to fetch ratios for
|
|
9321
|
+
* @param {int} [limit] the maximum number of long short ratio structures to retrieve
|
|
9322
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
9323
|
+
* @returns {object[]} an array of [long short ratio structures]{@link https://docs.ccxt.com/#/?id=long-short-ratio-structure}
|
|
9324
|
+
*/
|
|
9325
|
+
await this.loadMarkets();
|
|
9326
|
+
const market = this.market(symbol);
|
|
9327
|
+
let type = undefined;
|
|
9328
|
+
[type, params] = this.getBybitType('fetchLongShortRatioHistory', market, params);
|
|
9329
|
+
if (type === 'spot' || type === 'option') {
|
|
9330
|
+
throw new errors.NotSupported(this.id + ' fetchLongShortRatioHistory() only support linear and inverse markets');
|
|
9331
|
+
}
|
|
9332
|
+
if (timeframe === undefined) {
|
|
9333
|
+
timeframe = '1d';
|
|
9334
|
+
}
|
|
9335
|
+
const request = {
|
|
9336
|
+
'symbol': market['id'],
|
|
9337
|
+
'period': timeframe,
|
|
9338
|
+
'category': type,
|
|
9339
|
+
};
|
|
9340
|
+
if (limit !== undefined) {
|
|
9341
|
+
request['limit'] = limit;
|
|
9342
|
+
}
|
|
9343
|
+
const response = await this.publicGetV5MarketAccountRatio(this.extend(request, params));
|
|
9344
|
+
//
|
|
9345
|
+
// {
|
|
9346
|
+
// "retCode": 0,
|
|
9347
|
+
// "retMsg": "OK",
|
|
9348
|
+
// "result": {
|
|
9349
|
+
// "list": [
|
|
9350
|
+
// {
|
|
9351
|
+
// "symbol": "BTCUSDT",
|
|
9352
|
+
// "buyRatio": "0.5707",
|
|
9353
|
+
// "sellRatio": "0.4293",
|
|
9354
|
+
// "timestamp": "1729123200000"
|
|
9355
|
+
// },
|
|
9356
|
+
// ]
|
|
9357
|
+
// },
|
|
9358
|
+
// "retExtInfo": {},
|
|
9359
|
+
// "time": 1729147842516
|
|
9360
|
+
// }
|
|
9361
|
+
//
|
|
9362
|
+
const result = this.safeDict(response, 'result', {});
|
|
9363
|
+
const data = this.safeList(result, 'list', []);
|
|
9364
|
+
return this.parseLongShortRatioHistory(data, market);
|
|
9365
|
+
}
|
|
9366
|
+
parseLongShortRatio(info, market = undefined) {
|
|
9367
|
+
//
|
|
9368
|
+
// {
|
|
9369
|
+
// "symbol": "BTCUSDT",
|
|
9370
|
+
// "buyRatio": "0.5707",
|
|
9371
|
+
// "sellRatio": "0.4293",
|
|
9372
|
+
// "timestamp": "1729123200000"
|
|
9373
|
+
// }
|
|
9374
|
+
//
|
|
9375
|
+
const marketId = this.safeString(info, 'symbol');
|
|
9376
|
+
const timestamp = this.safeIntegerOmitZero(info, 'timestamp');
|
|
9377
|
+
const longString = this.safeString(info, 'buyRatio');
|
|
9378
|
+
const shortString = this.safeString(info, 'sellRatio');
|
|
9379
|
+
return {
|
|
9380
|
+
'info': info,
|
|
9381
|
+
'symbol': this.safeSymbol(marketId, market, undefined, 'contract'),
|
|
9382
|
+
'timestamp': timestamp,
|
|
9383
|
+
'datetime': this.iso8601(timestamp),
|
|
9384
|
+
'timeframe': undefined,
|
|
9385
|
+
'longShortRatio': this.parseToNumeric(Precise["default"].stringDiv(longString, shortString)),
|
|
9386
|
+
};
|
|
9387
|
+
}
|
|
9310
9388
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
9311
9389
|
let url = this.implodeHostname(this.urls['api'][api]) + '/' + path;
|
|
9312
9390
|
if (api === 'public') {
|