ccxt 4.0.94 → 4.0.95

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
@@ -215,13 +215,13 @@ console.log(version, Object.keys(exchanges));
215
215
 
216
216
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
217
217
 
218
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.94/dist/ccxt.browser.js
219
- * unpkg: https://unpkg.com/ccxt@4.0.94/dist/ccxt.browser.js
218
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.95/dist/ccxt.browser.js
219
+ * unpkg: https://unpkg.com/ccxt@4.0.95/dist/ccxt.browser.js
220
220
 
221
221
  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.
222
222
 
223
223
  ```HTML
224
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.94/dist/ccxt.browser.js"></script>
224
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.95/dist/ccxt.browser.js"></script>
225
225
  ```
226
226
 
227
227
  Creates a global `ccxt` object:
@@ -43429,6 +43429,8 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
43429
43429
  'fetchMarkets': true,
43430
43430
  'fetchMyTrades': true,
43431
43431
  'fetchOHLCV': true,
43432
+ 'fetchOpenInterest': true,
43433
+ 'fetchOpenInterestHistory': false,
43432
43434
  'fetchOpenOrders': true,
43433
43435
  'fetchOrder': true,
43434
43436
  'fetchOrderBook': true,
@@ -46515,6 +46517,61 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
46515
46517
  'info': info,
46516
46518
  };
46517
46519
  }
46520
+ async fetchOpenInterest(symbol, params = {}) {
46521
+ /**
46522
+ * @method
46523
+ * @name bitmart#fetchOpenInterest
46524
+ * @description Retrieves the open interest of a currency
46525
+ * @see https://developer-pro.bitmart.com/en/futures/#get-futures-openinterest
46526
+ * @param {string} symbol Unified CCXT market symbol
46527
+ * @param {object} [params] exchange specific parameters
46528
+ * @returns {object} an open interest structure{@link https://github.com/ccxt/ccxt/wiki/Manual#interest-history-structure}
46529
+ */
46530
+ await this.loadMarkets();
46531
+ const market = this.market(symbol);
46532
+ if (!market['contract']) {
46533
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchOpenInterest() supports contract markets only');
46534
+ }
46535
+ const request = {
46536
+ 'symbol': market['id'],
46537
+ };
46538
+ const response = await this.publicGetContractPublicOpenInterest(this.extend(request, params));
46539
+ //
46540
+ // {
46541
+ // "code": 1000,
46542
+ // "message": "Ok",
46543
+ // "data": {
46544
+ // "timestamp": 1694657502415,
46545
+ // "symbol": "BTCUSDT",
46546
+ // "open_interest": "265231.721368593081729069",
46547
+ // "open_interest_value": "7006353.83988919"
46548
+ // },
46549
+ // "trace": "7f9c94e10f9d4513bc08a7bfc2a5559a.72.16946575108274991"
46550
+ // }
46551
+ //
46552
+ const data = this.safeValue(response, 'data', {});
46553
+ return this.parseOpenInterest(data, market);
46554
+ }
46555
+ parseOpenInterest(interest, market = undefined) {
46556
+ //
46557
+ // {
46558
+ // "timestamp": 1694657502415,
46559
+ // "symbol": "BTCUSDT",
46560
+ // "open_interest": "265231.721368593081729069",
46561
+ // "open_interest_value": "7006353.83988919"
46562
+ // }
46563
+ //
46564
+ const timestamp = this.safeInteger(interest, 'timestamp');
46565
+ const id = this.safeString(interest, 'symbol');
46566
+ return {
46567
+ 'symbol': this.safeSymbol(id, market),
46568
+ 'openInterestAmount': this.safeNumber(interest, 'open_interest'),
46569
+ 'openInterestValue': this.safeNumber(interest, 'open_interest_value'),
46570
+ 'timestamp': timestamp,
46571
+ 'datetime': this.iso8601(timestamp),
46572
+ 'info': interest,
46573
+ };
46574
+ }
46518
46575
  handleMarginModeAndParams(methodName, params = {}, defaultValue = undefined) {
46519
46576
  /**
46520
46577
  * @ignore
@@ -275536,7 +275593,7 @@ SOFTWARE.
275536
275593
 
275537
275594
  //-----------------------------------------------------------------------------
275538
275595
  // this is updated by vss.js when building
275539
- const version = '4.0.94';
275596
+ const version = '4.0.95';
275540
275597
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
275541
275598
  //-----------------------------------------------------------------------------
275542
275599