ccxt 4.2.24 → 4.2.26
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.js +300 -14
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +2 -4
- package/dist/cjs/src/base/ws/Client.js +4 -1
- package/dist/cjs/src/bingx.js +46 -6
- package/dist/cjs/src/bitfinex2.js +91 -0
- package/dist/cjs/src/gate.js +1 -1
- package/dist/cjs/src/pro/bingx.js +155 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bingx.d.ts +1 -0
- package/js/src/base/Exchange.js +2 -4
- package/js/src/base/ws/Client.js +4 -1
- package/js/src/bingx.js +46 -6
- package/js/src/bitfinex2.d.ts +3 -1
- package/js/src/bitfinex2.js +91 -0
- package/js/src/gate.js +1 -1
- package/js/src/pro/bingx.d.ts +4 -1
- package/js/src/pro/bingx.js +155 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -209,13 +209,13 @@ console.log(version, Object.keys(exchanges));
|
|
|
209
209
|
|
|
210
210
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
211
211
|
|
|
212
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
|
213
|
-
* unpkg: https://unpkg.com/ccxt@4.2.
|
|
212
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.26/dist/ccxt.browser.js
|
|
213
|
+
* unpkg: https://unpkg.com/ccxt@4.2.26/dist/ccxt.browser.js
|
|
214
214
|
|
|
215
215
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
|
216
216
|
|
|
217
217
|
```HTML
|
|
218
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
|
218
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.26/dist/ccxt.browser.js"></script>
|
|
219
219
|
```
|
|
220
220
|
|
|
221
221
|
Creates a global `ccxt` object:
|
package/dist/ccxt.browser.js
CHANGED
|
@@ -8246,15 +8246,13 @@ class Exchange {
|
|
|
8246
8246
|
client.throttle(cost).then(() => {
|
|
8247
8247
|
client.send(message);
|
|
8248
8248
|
}).catch((e) => {
|
|
8249
|
-
|
|
8250
|
-
future.reject(e);
|
|
8249
|
+
client.onError(e);
|
|
8251
8250
|
});
|
|
8252
8251
|
}
|
|
8253
8252
|
else {
|
|
8254
8253
|
client.send(message)
|
|
8255
8254
|
.catch((e) => {
|
|
8256
|
-
|
|
8257
|
-
future.reject(e);
|
|
8255
|
+
client.onError(e);
|
|
8258
8256
|
});
|
|
8259
8257
|
}
|
|
8260
8258
|
}
|
|
@@ -14792,7 +14790,10 @@ class Client {
|
|
|
14792
14790
|
}
|
|
14793
14791
|
else {
|
|
14794
14792
|
if (this.ping) {
|
|
14795
|
-
this.send(this.ping(this))
|
|
14793
|
+
this.send(this.ping(this))
|
|
14794
|
+
.catch((error) => {
|
|
14795
|
+
this.onError(error);
|
|
14796
|
+
});
|
|
14796
14797
|
}
|
|
14797
14798
|
else if (_base_functions_js__WEBPACK_IMPORTED_MODULE_5__/* .isNode */ .UG) {
|
|
14798
14799
|
// can't do this inside browser
|
|
@@ -28018,6 +28019,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28018
28019
|
'fetchLeverage': true,
|
|
28019
28020
|
'fetchLiquidations': false,
|
|
28020
28021
|
'fetchMarkets': true,
|
|
28022
|
+
'fetchMarkOHLCV': true,
|
|
28021
28023
|
'fetchMyLiquidations': true,
|
|
28022
28024
|
'fetchOHLCV': true,
|
|
28023
28025
|
'fetchOpenInterest': true,
|
|
@@ -28122,6 +28124,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28122
28124
|
'private': {
|
|
28123
28125
|
'get': {
|
|
28124
28126
|
'positionSide/dual': 1,
|
|
28127
|
+
'market/markPriceKlines': 1,
|
|
28125
28128
|
},
|
|
28126
28129
|
'post': {
|
|
28127
28130
|
'positionSide/dual': 1,
|
|
@@ -28647,6 +28650,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28647
28650
|
* @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#K-Line%20Data
|
|
28648
28651
|
* @see https://bingx-api.github.io/docs/#/spot/market-api.html#Candlestick%20chart%20data
|
|
28649
28652
|
* @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#%20K-Line%20Data
|
|
28653
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#K-Line%20Data%20-%20Mark%20Price
|
|
28650
28654
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
28651
28655
|
* @param {string} timeframe the length of time each candle represents
|
|
28652
28656
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -28683,7 +28687,14 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28683
28687
|
response = await this.spotV1PublicGetMarketKline(this.extend(request, params));
|
|
28684
28688
|
}
|
|
28685
28689
|
else {
|
|
28686
|
-
|
|
28690
|
+
const price = this.safeString(params, 'price');
|
|
28691
|
+
params = this.omit(params, 'price');
|
|
28692
|
+
if (price === 'mark') {
|
|
28693
|
+
response = await this.swapV1PrivateGetMarketMarkPriceKlines(this.extend(request, params));
|
|
28694
|
+
}
|
|
28695
|
+
else {
|
|
28696
|
+
response = await this.swapV3PublicGetQuoteKlines(this.extend(request, params));
|
|
28697
|
+
}
|
|
28687
28698
|
}
|
|
28688
28699
|
//
|
|
28689
28700
|
// {
|
|
@@ -28702,6 +28713,24 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28702
28713
|
// ]
|
|
28703
28714
|
// }
|
|
28704
28715
|
//
|
|
28716
|
+
// fetchMarkOHLCV
|
|
28717
|
+
//
|
|
28718
|
+
// {
|
|
28719
|
+
// "code": 0,
|
|
28720
|
+
// "msg": "",
|
|
28721
|
+
// "data": [
|
|
28722
|
+
// {
|
|
28723
|
+
// "open": "42191.7",
|
|
28724
|
+
// "close": "42189.5",
|
|
28725
|
+
// "high": "42196.5",
|
|
28726
|
+
// "low": "42189.5",
|
|
28727
|
+
// "volume": "0.00",
|
|
28728
|
+
// "openTime": 1706508840000,
|
|
28729
|
+
// "closeTime": 1706508840000
|
|
28730
|
+
// }
|
|
28731
|
+
// ]
|
|
28732
|
+
// }
|
|
28733
|
+
//
|
|
28705
28734
|
let ohlcvs = this.safeValue(response, 'data', []);
|
|
28706
28735
|
if (!Array.isArray(ohlcvs)) {
|
|
28707
28736
|
ohlcvs = [ohlcvs];
|
|
@@ -28718,6 +28747,18 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28718
28747
|
// "volume": "167.44",
|
|
28719
28748
|
// "time": 1666584000000
|
|
28720
28749
|
// }
|
|
28750
|
+
//
|
|
28751
|
+
// fetchMarkOHLCV
|
|
28752
|
+
//
|
|
28753
|
+
// {
|
|
28754
|
+
// "open": "42191.7",
|
|
28755
|
+
// "close": "42189.5",
|
|
28756
|
+
// "high": "42196.5",
|
|
28757
|
+
// "low": "42189.5",
|
|
28758
|
+
// "volume": "0.00",
|
|
28759
|
+
// "openTime": 1706508840000,
|
|
28760
|
+
// "closeTime": 1706508840000
|
|
28761
|
+
// }
|
|
28721
28762
|
// spot
|
|
28722
28763
|
// [
|
|
28723
28764
|
// 1691402580000,
|
|
@@ -28741,7 +28782,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28741
28782
|
];
|
|
28742
28783
|
}
|
|
28743
28784
|
return [
|
|
28744
|
-
this.
|
|
28785
|
+
this.safeInteger2(ohlcv, 'time', 'closeTime'),
|
|
28745
28786
|
this.safeNumber(ohlcv, 'open'),
|
|
28746
28787
|
this.safeNumber(ohlcv, 'high'),
|
|
28747
28788
|
this.safeNumber(ohlcv, 'low'),
|
|
@@ -30198,10 +30239,10 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
30198
30239
|
const clientOrderId = this.safeStringN(order, ['clientOrderID', 'origClientOrderId', 'c']);
|
|
30199
30240
|
let stopLoss = this.safeValue(order, 'stopLoss');
|
|
30200
30241
|
let stopLossPrice = undefined;
|
|
30201
|
-
if (stopLoss !== undefined) {
|
|
30242
|
+
if ((stopLoss !== undefined) && (stopLoss !== '')) {
|
|
30202
30243
|
stopLossPrice = this.safeNumber(stopLoss, 'stopLoss');
|
|
30203
30244
|
}
|
|
30204
|
-
if ((stopLoss !== undefined) && (typeof stopLoss !== 'number')) {
|
|
30245
|
+
if ((stopLoss !== undefined) && (typeof stopLoss !== 'number') && (stopLoss !== '')) {
|
|
30205
30246
|
// stopLoss: '{"stopPrice":50,"workingType":"MARK_PRICE","type":"STOP_MARKET","quantity":1}',
|
|
30206
30247
|
if (typeof stopLoss === 'string') {
|
|
30207
30248
|
stopLoss = this.parseJson(stopLoss);
|
|
@@ -30210,10 +30251,10 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
30210
30251
|
}
|
|
30211
30252
|
let takeProfit = this.safeValue(order, 'takeProfit');
|
|
30212
30253
|
let takeProfitPrice = undefined;
|
|
30213
|
-
if (takeProfit !== undefined) {
|
|
30254
|
+
if (takeProfit !== undefined && (takeProfit !== '')) {
|
|
30214
30255
|
takeProfitPrice = this.safeNumber(takeProfit, 'takeProfit');
|
|
30215
30256
|
}
|
|
30216
|
-
if ((takeProfit !== undefined) && (typeof takeProfit !== 'number')) {
|
|
30257
|
+
if ((takeProfit !== undefined) && (typeof takeProfit !== 'number') && (takeProfit !== '')) {
|
|
30217
30258
|
// takeProfit: '{"stopPrice":150,"workingType":"MARK_PRICE","type":"TAKE_PROFIT_MARKET","quantity":1}',
|
|
30218
30259
|
if (typeof takeProfit === 'string') {
|
|
30219
30260
|
takeProfit = this.parseJson(takeProfit);
|
|
@@ -36787,6 +36828,7 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
36787
36828
|
'fetchFundingRates': true,
|
|
36788
36829
|
'fetchIndexOHLCV': false,
|
|
36789
36830
|
'fetchLedger': true,
|
|
36831
|
+
'fetchLiquidations': true,
|
|
36790
36832
|
'fetchMarginMode': false,
|
|
36791
36833
|
'fetchMarkOHLCV': false,
|
|
36792
36834
|
'fetchMyTrades': true,
|
|
@@ -39908,6 +39950,96 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
39908
39950
|
'info': interest,
|
|
39909
39951
|
}, market);
|
|
39910
39952
|
}
|
|
39953
|
+
async fetchLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
|
|
39954
|
+
/**
|
|
39955
|
+
* @method
|
|
39956
|
+
* @name bitfinex2#fetchLiquidations
|
|
39957
|
+
* @description retrieves the public liquidations of a trading pair
|
|
39958
|
+
* @see https://docs.bitfinex.com/reference/rest-public-liquidations
|
|
39959
|
+
* @param {string} symbol unified CCXT market symbol
|
|
39960
|
+
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
39961
|
+
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
39962
|
+
* @param {object} [params] exchange specific parameters
|
|
39963
|
+
* @param {int} [params.until] timestamp in ms of the latest liquidation
|
|
39964
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
39965
|
+
* @returns {object} an array of [liquidation structures]{@link https://docs.ccxt.com/#/?id=liquidation-structure}
|
|
39966
|
+
*/
|
|
39967
|
+
await this.loadMarkets();
|
|
39968
|
+
let paginate = false;
|
|
39969
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchLiquidations', 'paginate');
|
|
39970
|
+
if (paginate) {
|
|
39971
|
+
return await this.fetchPaginatedCallDeterministic('fetchLiquidations', symbol, since, limit, '8h', params, 500);
|
|
39972
|
+
}
|
|
39973
|
+
const market = this.market(symbol);
|
|
39974
|
+
let request = {};
|
|
39975
|
+
if (since !== undefined) {
|
|
39976
|
+
request['start'] = since;
|
|
39977
|
+
}
|
|
39978
|
+
if (limit !== undefined) {
|
|
39979
|
+
request['limit'] = limit;
|
|
39980
|
+
}
|
|
39981
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
39982
|
+
const response = await this.publicGetLiquidationsHist(this.extend(request, params));
|
|
39983
|
+
//
|
|
39984
|
+
// [
|
|
39985
|
+
// [
|
|
39986
|
+
// [
|
|
39987
|
+
// "pos",
|
|
39988
|
+
// 171085137,
|
|
39989
|
+
// 1706395919788,
|
|
39990
|
+
// null,
|
|
39991
|
+
// "tAVAXF0:USTF0",
|
|
39992
|
+
// -8,
|
|
39993
|
+
// 32.868,
|
|
39994
|
+
// null,
|
|
39995
|
+
// 1,
|
|
39996
|
+
// 1,
|
|
39997
|
+
// null,
|
|
39998
|
+
// 33.255
|
|
39999
|
+
// ]
|
|
40000
|
+
// ],
|
|
40001
|
+
// ]
|
|
40002
|
+
//
|
|
40003
|
+
return this.parseLiquidations(response, market, since, limit);
|
|
40004
|
+
}
|
|
40005
|
+
parseLiquidation(liquidation, market = undefined) {
|
|
40006
|
+
//
|
|
40007
|
+
// [
|
|
40008
|
+
// [
|
|
40009
|
+
// "pos",
|
|
40010
|
+
// 171085137, // position id
|
|
40011
|
+
// 1706395919788, // timestamp
|
|
40012
|
+
// null,
|
|
40013
|
+
// "tAVAXF0:USTF0", // market id
|
|
40014
|
+
// -8, // amount in contracts
|
|
40015
|
+
// 32.868, // base price
|
|
40016
|
+
// null,
|
|
40017
|
+
// 1,
|
|
40018
|
+
// 1,
|
|
40019
|
+
// null,
|
|
40020
|
+
// 33.255 // acquired price
|
|
40021
|
+
// ]
|
|
40022
|
+
// ]
|
|
40023
|
+
//
|
|
40024
|
+
const entry = liquidation[0];
|
|
40025
|
+
const timestamp = this.safeInteger(entry, 2);
|
|
40026
|
+
const marketId = this.safeString(entry, 4);
|
|
40027
|
+
const contracts = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(this.safeString(entry, 5));
|
|
40028
|
+
const contractSize = this.safeString(market, 'contractSize');
|
|
40029
|
+
const baseValue = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(contracts, contractSize);
|
|
40030
|
+
const price = this.safeString(entry, 11);
|
|
40031
|
+
return this.safeLiquidation({
|
|
40032
|
+
'info': entry,
|
|
40033
|
+
'symbol': this.safeSymbol(marketId, market, undefined, 'contract'),
|
|
40034
|
+
'contracts': this.parseNumber(contracts),
|
|
40035
|
+
'contractSize': this.parseNumber(contractSize),
|
|
40036
|
+
'price': this.parseNumber(price),
|
|
40037
|
+
'baseValue': this.parseNumber(baseValue),
|
|
40038
|
+
'quoteValue': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(baseValue, price)),
|
|
40039
|
+
'timestamp': timestamp,
|
|
40040
|
+
'datetime': this.iso8601(timestamp),
|
|
40041
|
+
});
|
|
40042
|
+
}
|
|
39911
40043
|
}
|
|
39912
40044
|
|
|
39913
40045
|
|
|
@@ -127640,7 +127772,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
127640
127772
|
// "price": "333"
|
|
127641
127773
|
// }
|
|
127642
127774
|
//
|
|
127643
|
-
const id = this.
|
|
127775
|
+
const id = this.safeString2(trade, 'id', 'trade_id');
|
|
127644
127776
|
let timestamp = this.safeTimestamp2(trade, 'time', 'create_time');
|
|
127645
127777
|
timestamp = this.safeInteger(trade, 'create_time_ms', timestamp);
|
|
127646
127778
|
const marketId = this.safeString2(trade, 'currency_pair', 'contract');
|
|
@@ -214119,7 +214251,7 @@ class bingx extends _bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
214119
214251
|
'watchOHLCV': true,
|
|
214120
214252
|
'watchOrders': true,
|
|
214121
214253
|
'watchMyTrades': true,
|
|
214122
|
-
'watchTicker':
|
|
214254
|
+
'watchTicker': true,
|
|
214123
214255
|
'watchTickers': false,
|
|
214124
214256
|
'watchBalance': true,
|
|
214125
214257
|
},
|
|
@@ -214174,6 +214306,151 @@ class bingx extends _bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
214174
214306
|
},
|
|
214175
214307
|
});
|
|
214176
214308
|
}
|
|
214309
|
+
async watchTicker(symbol, params = {}) {
|
|
214310
|
+
/**
|
|
214311
|
+
* @method
|
|
214312
|
+
* @name bingx#watchTicker
|
|
214313
|
+
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
214314
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/socket/market.html#Subscribe%20to%2024-hour%20price%20changes
|
|
214315
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
214316
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
214317
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
214318
|
+
*/
|
|
214319
|
+
await this.loadMarkets();
|
|
214320
|
+
const market = this.market(symbol);
|
|
214321
|
+
const [marketType, query] = this.handleMarketTypeAndParams('watchTrades', market, params);
|
|
214322
|
+
const url = this.safeValue(this.urls['api']['ws'], marketType);
|
|
214323
|
+
if (url === undefined) {
|
|
214324
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' watchTrades is not supported for ' + marketType + ' markets.');
|
|
214325
|
+
}
|
|
214326
|
+
const messageHash = market['id'] + '@ticker';
|
|
214327
|
+
const uuid = this.uuid();
|
|
214328
|
+
const request = {
|
|
214329
|
+
'id': uuid,
|
|
214330
|
+
'dataType': messageHash,
|
|
214331
|
+
};
|
|
214332
|
+
if (marketType === 'swap') {
|
|
214333
|
+
request['reqType'] = 'sub';
|
|
214334
|
+
}
|
|
214335
|
+
return await this.watch(url, messageHash, this.extend(request, query), messageHash);
|
|
214336
|
+
}
|
|
214337
|
+
handleTicker(client, message) {
|
|
214338
|
+
//
|
|
214339
|
+
// swap
|
|
214340
|
+
//
|
|
214341
|
+
// {
|
|
214342
|
+
// "code": 0,
|
|
214343
|
+
// "dataType": "BTC-USDT@ticker",
|
|
214344
|
+
// "data": {
|
|
214345
|
+
// "e": "24hTicker",
|
|
214346
|
+
// "E": 1706498923556,
|
|
214347
|
+
// "s": "BTC-USDT",
|
|
214348
|
+
// "p": "346.4",
|
|
214349
|
+
// "P": "0.82",
|
|
214350
|
+
// "c": "42432.5",
|
|
214351
|
+
// "L": "0.0529",
|
|
214352
|
+
// "h": "42855.4",
|
|
214353
|
+
// "l": "41578.3",
|
|
214354
|
+
// "v": "64310.9754",
|
|
214355
|
+
// "q": "2728360284.15",
|
|
214356
|
+
// "o": "42086.1",
|
|
214357
|
+
// "O": 1706498922655,
|
|
214358
|
+
// "C": 1706498883023,
|
|
214359
|
+
// "A": "42437.8",
|
|
214360
|
+
// "a": "1.4160",
|
|
214361
|
+
// "B": "42437.1",
|
|
214362
|
+
// "b": "2.5747"
|
|
214363
|
+
// }
|
|
214364
|
+
// }
|
|
214365
|
+
//
|
|
214366
|
+
// spot
|
|
214367
|
+
//
|
|
214368
|
+
// {
|
|
214369
|
+
// "code": 0,
|
|
214370
|
+
// "timestamp": 1706506795473,
|
|
214371
|
+
// "data": {
|
|
214372
|
+
// "e": "24hTicker",
|
|
214373
|
+
// "E": 1706506795472,
|
|
214374
|
+
// "s": "BTC-USDT",
|
|
214375
|
+
// "p": -372.12,
|
|
214376
|
+
// "P": "-0.87%",
|
|
214377
|
+
// "o": 42548.95,
|
|
214378
|
+
// "h": 42696.1,
|
|
214379
|
+
// "l": 41621.29,
|
|
214380
|
+
// "c": 42176.83,
|
|
214381
|
+
// "v": 4943.33,
|
|
214382
|
+
// "q": 208842236.5,
|
|
214383
|
+
// "O": 1706420395472,
|
|
214384
|
+
// "C": 1706506795472,
|
|
214385
|
+
// "A": 42177.23,
|
|
214386
|
+
// "a": 5.14484,
|
|
214387
|
+
// "B": 42176.38,
|
|
214388
|
+
// "b": 5.36117
|
|
214389
|
+
// }
|
|
214390
|
+
// }
|
|
214391
|
+
//
|
|
214392
|
+
const data = this.safeValue(message, 'data', {});
|
|
214393
|
+
const marketId = this.safeString(data, 's');
|
|
214394
|
+
// const marketId = messageHash.split('@')[0];
|
|
214395
|
+
const isSwap = client.url.indexOf('swap') >= 0;
|
|
214396
|
+
const marketType = isSwap ? 'swap' : 'spot';
|
|
214397
|
+
const market = this.safeMarket(marketId, undefined, undefined, marketType);
|
|
214398
|
+
const symbol = market['symbol'];
|
|
214399
|
+
const ticker = this.parseWsTicker(data, market);
|
|
214400
|
+
this.tickers[symbol] = ticker;
|
|
214401
|
+
const messageHash = market['id'] + '@ticker';
|
|
214402
|
+
client.resolve(ticker, messageHash);
|
|
214403
|
+
}
|
|
214404
|
+
parseWsTicker(message, market = undefined) {
|
|
214405
|
+
//
|
|
214406
|
+
// {
|
|
214407
|
+
// "e": "24hTicker",
|
|
214408
|
+
// "E": 1706498923556,
|
|
214409
|
+
// "s": "BTC-USDT",
|
|
214410
|
+
// "p": "346.4",
|
|
214411
|
+
// "P": "0.82",
|
|
214412
|
+
// "c": "42432.5",
|
|
214413
|
+
// "L": "0.0529",
|
|
214414
|
+
// "h": "42855.4",
|
|
214415
|
+
// "l": "41578.3",
|
|
214416
|
+
// "v": "64310.9754",
|
|
214417
|
+
// "q": "2728360284.15",
|
|
214418
|
+
// "o": "42086.1",
|
|
214419
|
+
// "O": 1706498922655,
|
|
214420
|
+
// "C": 1706498883023,
|
|
214421
|
+
// "A": "42437.8",
|
|
214422
|
+
// "a": "1.4160",
|
|
214423
|
+
// "B": "42437.1",
|
|
214424
|
+
// "b": "2.5747"
|
|
214425
|
+
// }
|
|
214426
|
+
//
|
|
214427
|
+
const timestamp = this.safeInteger(message, 'ts');
|
|
214428
|
+
const marketId = this.safeString(message, 's');
|
|
214429
|
+
market = this.safeMarket(marketId, market);
|
|
214430
|
+
const close = this.safeString(message, 'c');
|
|
214431
|
+
return this.safeTicker({
|
|
214432
|
+
'symbol': market['symbol'],
|
|
214433
|
+
'timestamp': timestamp,
|
|
214434
|
+
'datetime': this.iso8601(timestamp),
|
|
214435
|
+
'high': this.safeString(message, 'h'),
|
|
214436
|
+
'low': this.safeString(message, 'l'),
|
|
214437
|
+
'bid': this.safeString(message, 'B'),
|
|
214438
|
+
'bidVolume': this.safeString(message, 'b'),
|
|
214439
|
+
'ask': this.safeString(message, 'A'),
|
|
214440
|
+
'askVolume': this.safeString(message, 'a'),
|
|
214441
|
+
'vwap': undefined,
|
|
214442
|
+
'open': this.safeString(message, 'o'),
|
|
214443
|
+
'close': close,
|
|
214444
|
+
'last': close,
|
|
214445
|
+
'previousClose': undefined,
|
|
214446
|
+
'change': this.safeString(message, 'p'),
|
|
214447
|
+
'percentage': undefined,
|
|
214448
|
+
'average': undefined,
|
|
214449
|
+
'baseVolume': this.safeString(message, 'v'),
|
|
214450
|
+
'quoteVolume': this.safeString(message, 'q'),
|
|
214451
|
+
'info': message,
|
|
214452
|
+
}, market);
|
|
214453
|
+
}
|
|
214177
214454
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
214178
214455
|
/**
|
|
214179
214456
|
* @method
|
|
@@ -215010,6 +215287,10 @@ class bingx extends _bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
215010
215287
|
this.handleOrderBook(client, message);
|
|
215011
215288
|
return;
|
|
215012
215289
|
}
|
|
215290
|
+
if (dataType.indexOf('@ticker') >= 0) {
|
|
215291
|
+
this.handleTicker(client, message);
|
|
215292
|
+
return;
|
|
215293
|
+
}
|
|
215013
215294
|
if (dataType.indexOf('@trade') >= 0) {
|
|
215014
215295
|
this.handleTrades(client, message);
|
|
215015
215296
|
return;
|
|
@@ -215040,6 +215321,11 @@ class bingx extends _bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
215040
215321
|
this.handleMyTrades(client, message);
|
|
215041
215322
|
}
|
|
215042
215323
|
}
|
|
215324
|
+
const msgData = this.safeValue(message, 'data');
|
|
215325
|
+
const msgEvent = this.safeString(msgData, 'e');
|
|
215326
|
+
if (msgEvent === '24hTicker') {
|
|
215327
|
+
this.handleTicker(client, message);
|
|
215328
|
+
}
|
|
215043
215329
|
}
|
|
215044
215330
|
}
|
|
215045
215331
|
|
|
@@ -297108,7 +297394,7 @@ SOFTWARE.
|
|
|
297108
297394
|
|
|
297109
297395
|
//-----------------------------------------------------------------------------
|
|
297110
297396
|
// this is updated by vss.js when building
|
|
297111
|
-
const version = '4.2.
|
|
297397
|
+
const version = '4.2.26';
|
|
297112
297398
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
297113
297399
|
//-----------------------------------------------------------------------------
|
|
297114
297400
|
|