ccxt 4.2.24 → 4.2.25

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 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.24/dist/ccxt.browser.js
213
- * unpkg: https://unpkg.com/ccxt@4.2.24/dist/ccxt.browser.js
212
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.25/dist/ccxt.browser.js
213
+ * unpkg: https://unpkg.com/ccxt@4.2.25/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.24/dist/ccxt.browser.js"></script>
218
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.25/dist/ccxt.browser.js"></script>
219
219
  ```
220
220
 
221
221
  Creates a global `ccxt` object:
@@ -36787,6 +36787,7 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
36787
36787
  'fetchFundingRates': true,
36788
36788
  'fetchIndexOHLCV': false,
36789
36789
  'fetchLedger': true,
36790
+ 'fetchLiquidations': true,
36790
36791
  'fetchMarginMode': false,
36791
36792
  'fetchMarkOHLCV': false,
36792
36793
  'fetchMyTrades': true,
@@ -39908,6 +39909,96 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
39908
39909
  'info': interest,
39909
39910
  }, market);
39910
39911
  }
39912
+ async fetchLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
39913
+ /**
39914
+ * @method
39915
+ * @name bitfinex2#fetchLiquidations
39916
+ * @description retrieves the public liquidations of a trading pair
39917
+ * @see https://docs.bitfinex.com/reference/rest-public-liquidations
39918
+ * @param {string} symbol unified CCXT market symbol
39919
+ * @param {int} [since] the earliest time in ms to fetch liquidations for
39920
+ * @param {int} [limit] the maximum number of liquidation structures to retrieve
39921
+ * @param {object} [params] exchange specific parameters
39922
+ * @param {int} [params.until] timestamp in ms of the latest liquidation
39923
+ * @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)
39924
+ * @returns {object} an array of [liquidation structures]{@link https://docs.ccxt.com/#/?id=liquidation-structure}
39925
+ */
39926
+ await this.loadMarkets();
39927
+ let paginate = false;
39928
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchLiquidations', 'paginate');
39929
+ if (paginate) {
39930
+ return await this.fetchPaginatedCallDeterministic('fetchLiquidations', symbol, since, limit, '8h', params, 500);
39931
+ }
39932
+ const market = this.market(symbol);
39933
+ let request = {};
39934
+ if (since !== undefined) {
39935
+ request['start'] = since;
39936
+ }
39937
+ if (limit !== undefined) {
39938
+ request['limit'] = limit;
39939
+ }
39940
+ [request, params] = this.handleUntilOption('end', request, params);
39941
+ const response = await this.publicGetLiquidationsHist(this.extend(request, params));
39942
+ //
39943
+ // [
39944
+ // [
39945
+ // [
39946
+ // "pos",
39947
+ // 171085137,
39948
+ // 1706395919788,
39949
+ // null,
39950
+ // "tAVAXF0:USTF0",
39951
+ // -8,
39952
+ // 32.868,
39953
+ // null,
39954
+ // 1,
39955
+ // 1,
39956
+ // null,
39957
+ // 33.255
39958
+ // ]
39959
+ // ],
39960
+ // ]
39961
+ //
39962
+ return this.parseLiquidations(response, market, since, limit);
39963
+ }
39964
+ parseLiquidation(liquidation, market = undefined) {
39965
+ //
39966
+ // [
39967
+ // [
39968
+ // "pos",
39969
+ // 171085137, // position id
39970
+ // 1706395919788, // timestamp
39971
+ // null,
39972
+ // "tAVAXF0:USTF0", // market id
39973
+ // -8, // amount in contracts
39974
+ // 32.868, // base price
39975
+ // null,
39976
+ // 1,
39977
+ // 1,
39978
+ // null,
39979
+ // 33.255 // acquired price
39980
+ // ]
39981
+ // ]
39982
+ //
39983
+ const entry = liquidation[0];
39984
+ const timestamp = this.safeInteger(entry, 2);
39985
+ const marketId = this.safeString(entry, 4);
39986
+ const contracts = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(this.safeString(entry, 5));
39987
+ const contractSize = this.safeString(market, 'contractSize');
39988
+ const baseValue = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(contracts, contractSize);
39989
+ const price = this.safeString(entry, 11);
39990
+ return this.safeLiquidation({
39991
+ 'info': entry,
39992
+ 'symbol': this.safeSymbol(marketId, market, undefined, 'contract'),
39993
+ 'contracts': this.parseNumber(contracts),
39994
+ 'contractSize': this.parseNumber(contractSize),
39995
+ 'price': this.parseNumber(price),
39996
+ 'baseValue': this.parseNumber(baseValue),
39997
+ 'quoteValue': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(baseValue, price)),
39998
+ 'timestamp': timestamp,
39999
+ 'datetime': this.iso8601(timestamp),
40000
+ });
40001
+ }
39911
40002
  }
39912
40003
 
39913
40004
 
@@ -127640,7 +127731,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
127640
127731
  // "price": "333"
127641
127732
  // }
127642
127733
  //
127643
- const id = this.safeString(trade, 'id');
127734
+ const id = this.safeString2(trade, 'id', 'trade_id');
127644
127735
  let timestamp = this.safeTimestamp2(trade, 'time', 'create_time');
127645
127736
  timestamp = this.safeInteger(trade, 'create_time_ms', timestamp);
127646
127737
  const marketId = this.safeString2(trade, 'currency_pair', 'contract');
@@ -297108,7 +297199,7 @@ SOFTWARE.
297108
297199
 
297109
297200
  //-----------------------------------------------------------------------------
297110
297201
  // this is updated by vss.js when building
297111
- const version = '4.2.24';
297202
+ const version = '4.2.25';
297112
297203
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
297113
297204
  //-----------------------------------------------------------------------------
297114
297205