ccxt 4.0.93 → 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.93/dist/ccxt.browser.js
219
- * unpkg: https://unpkg.com/ccxt@4.0.93/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.93/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:
@@ -13861,6 +13861,7 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
13861
13861
  'options': {
13862
13862
  'accountsByType': {
13863
13863
  'spot': 'SPOT',
13864
+ 'fund': 'FUND',
13864
13865
  'funding': 'FUND',
13865
13866
  'future': 'CONTRACT',
13866
13867
  'swap': 'CONTRACT',
@@ -15320,7 +15321,7 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
15320
15321
  const txid = this.safeString(transaction, 'txid');
15321
15322
  const address = this.safeString(transaction, 'target_address');
15322
15323
  const tag = this.safeString(transaction, 'memo');
15323
- const type = ('customer_id' in transaction) ? 'deposit' : 'withdrawal';
15324
+ const type = ('customer_id' in transaction) ? 'withdrawal' : 'deposit';
15324
15325
  return {
15325
15326
  'info': transaction,
15326
15327
  'id': id,
@@ -15449,10 +15450,11 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
15449
15450
  * @method
15450
15451
  * @name bigone#transfer
15451
15452
  * @description transfer currency internally between wallets on the same account
15453
+ * @see https://open.big.one/docs/spot_transfer.html#transfer-of-user
15452
15454
  * @param {string} code unified currency code
15453
15455
  * @param {float} amount amount to transfer
15454
- * @param {string} fromAccount account to transfer from
15455
- * @param {string} toAccount account to transfer to
15456
+ * @param {string} fromAccount 'SPOT', 'FUND', or 'CONTRACT'
15457
+ * @param {string} toAccount 'SPOT', 'FUND', or 'CONTRACT'
15456
15458
  * @param {object} [params] extra parameters specific to the bigone api endpoint
15457
15459
  * @returns {object} a [transfer structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#transfer-structure}
15458
15460
  */
@@ -43427,6 +43429,8 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
43427
43429
  'fetchMarkets': true,
43428
43430
  'fetchMyTrades': true,
43429
43431
  'fetchOHLCV': true,
43432
+ 'fetchOpenInterest': true,
43433
+ 'fetchOpenInterestHistory': false,
43430
43434
  'fetchOpenOrders': true,
43431
43435
  'fetchOrder': true,
43432
43436
  'fetchOrderBook': true,
@@ -46513,6 +46517,61 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
46513
46517
  'info': info,
46514
46518
  };
46515
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
+ }
46516
46575
  handleMarginModeAndParams(methodName, params = {}, defaultValue = undefined) {
46517
46576
  /**
46518
46577
  * @ignore
@@ -49394,42 +49453,42 @@ class bitopro extends _abstract_bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
49394
49453
  },
49395
49454
  'api': {
49396
49455
  'public': {
49397
- 'get': [
49398
- 'order-book/{pair}',
49399
- 'tickers',
49400
- 'tickers/{pair}',
49401
- 'trades/{pair}',
49402
- 'provisioning/currencies',
49403
- 'provisioning/trading-pairs',
49404
- 'provisioning/limitations-and-fees',
49405
- 'trading-history/{pair}',
49406
- ],
49456
+ 'get': {
49457
+ 'order-book/{pair}': 1,
49458
+ 'tickers': 1,
49459
+ 'tickers/{pair}': 1,
49460
+ 'trades/{pair}': 1,
49461
+ 'provisioning/currencies': 1,
49462
+ 'provisioning/trading-pairs': 1,
49463
+ 'provisioning/limitations-and-fees': 1,
49464
+ 'trading-history/{pair}': 1,
49465
+ },
49407
49466
  },
49408
49467
  'private': {
49409
- 'get': [
49410
- 'accounts/balance',
49411
- 'orders/history',
49412
- 'orders/all/{pair}',
49413
- 'orders/trades/{pair}',
49414
- 'orders/{pair}/{orderId}',
49415
- 'wallet/withdraw/{currency}/{serial}',
49416
- 'wallet/withdraw/{currency}/id/{id}',
49417
- 'wallet/depositHistory/{currency}',
49418
- 'wallet/withdrawHistory/{currency}',
49419
- ],
49420
- 'post': [
49421
- 'orders/{pair}',
49422
- 'orders/batch',
49423
- 'wallet/withdraw/{currency}',
49424
- ],
49425
- 'put': [
49426
- 'orders',
49427
- ],
49428
- 'delete': [
49429
- 'orders/{pair}/{id}',
49430
- 'orders/all',
49431
- 'orders/{pair}',
49432
- ],
49468
+ 'get': {
49469
+ 'accounts/balance': 1,
49470
+ 'orders/history': 1,
49471
+ 'orders/all/{pair}': 1,
49472
+ 'orders/trades/{pair}': 1,
49473
+ 'orders/{pair}/{orderId}': 1,
49474
+ 'wallet/withdraw/{currency}/{serial}': 1,
49475
+ 'wallet/withdraw/{currency}/id/{id}': 1,
49476
+ 'wallet/depositHistory/{currency}': 1,
49477
+ 'wallet/withdrawHistory/{currency}': 1,
49478
+ },
49479
+ 'post': {
49480
+ 'orders/{pair}': 1 / 2,
49481
+ 'orders/batch': 20 / 3,
49482
+ 'wallet/withdraw/{currency}': 10, // 60/m => 1/s => 10/1 = 10
49483
+ },
49484
+ 'put': {
49485
+ 'orders': 5, // 2/s => 10/2 = 5
49486
+ },
49487
+ 'delete': {
49488
+ 'orders/{pair}/{id}': 2 / 3,
49489
+ 'orders/all': 5,
49490
+ 'orders/{pair}': 5, // 2/s => 10/2 = 5
49491
+ },
49433
49492
  },
49434
49493
  },
49435
49494
  'fees': {
@@ -126898,6 +126957,7 @@ class hollaex extends _abstract_hollaex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
126898
126957
  'createMarketBuyOrder': true,
126899
126958
  'createMarketSellOrder': true,
126900
126959
  'createOrder': true,
126960
+ 'createPostOnlyOrder': true,
126901
126961
  'createReduceOnlyOrder': false,
126902
126962
  'createStopLimitOrder': true,
126903
126963
  'createStopMarketOrder': true,
@@ -127986,6 +128046,8 @@ class hollaex extends _abstract_hollaex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
127986
128046
  * @param {float} amount how much of currency you want to trade in units of base currency
127987
128047
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
127988
128048
  * @param {object} [params] extra parameters specific to the hollaex api endpoint
128049
+ * @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
128050
+ * @param {bool} [params.postOnly] if true, the order will only be posted to the order book and not executed immediately
127989
128051
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
127990
128052
  */
127991
128053
  await this.loadMarkets();
@@ -133551,10 +133613,10 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
133551
133613
  }
133552
133614
  }
133553
133615
  else {
133554
- const clientOrderId = this.safeString2(params, 'client_order_id', 'clientOrderId');
133616
+ const clientOrderId = this.safeInteger2(params, 'client_order_id', 'clientOrderId');
133555
133617
  if (clientOrderId !== undefined) {
133556
133618
  request['client_order_id'] = clientOrderId;
133557
- params = this.omit(params, ['client_order_id', 'clientOrderId']);
133619
+ params = this.omit(params, ['clientOrderId']);
133558
133620
  }
133559
133621
  if (type === 'limit' || type === 'ioc' || type === 'fok' || type === 'post_only') {
133560
133622
  request['price'] = this.priceToPrecision(symbol, price);
@@ -180077,7 +180139,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
180077
180139
  else {
180078
180140
  request['slOrdPx'] = '-1'; // market sl order
180079
180141
  }
180080
- const stopLossTriggerPriceType = this.safeString2(stopLoss, 'triggerPriceType', 'slTriggerPxType');
180142
+ const stopLossTriggerPriceType = this.safeString2(stopLoss, 'triggerPriceType', 'slTriggerPxType', 'last');
180081
180143
  if (stopLossTriggerPriceType !== undefined) {
180082
180144
  if ((stopLossTriggerPriceType !== 'last') && (stopLossTriggerPriceType !== 'index') && (stopLossTriggerPriceType !== 'mark')) {
180083
180145
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' createOrder() stop loss trigger price type must be one of "last", "index" or "mark"');
@@ -180117,7 +180179,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
180117
180179
  else {
180118
180180
  request['tpOrdPx'] = '-1'; // market tp order
180119
180181
  }
180120
- const takeProfitTriggerPriceType = this.safeString2(stopLoss, 'triggerPriceType', 'tpTriggerPxType');
180182
+ const takeProfitTriggerPriceType = this.safeString2(takeProfit, 'triggerPriceType', 'tpTriggerPxType', 'last');
180121
180183
  if (takeProfitTriggerPriceType !== undefined) {
180122
180184
  if ((takeProfitTriggerPriceType !== 'last') && (takeProfitTriggerPriceType !== 'index') && (takeProfitTriggerPriceType !== 'mark')) {
180123
180185
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' createOrder() take profit trigger price type must be one of "last", "index" or "mark"');
@@ -195372,8 +195434,8 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
195372
195434
  for (let i = 0; i < symbols.length; i++) {
195373
195435
  const symbol = symbols[i];
195374
195436
  const market = this.market(symbol);
195375
- const messageHash = market['lowercaseId'] + '@' + name + '@' + watchOrderBookRate + 'ms';
195376
- subParams.push(messageHash);
195437
+ const symbolHash = market['lowercaseId'] + '@' + name + '@' + watchOrderBookRate + 'ms';
195438
+ subParams.push(symbolHash);
195377
195439
  }
195378
195440
  const request = {
195379
195441
  'method': 'SUBSCRIBE',
@@ -195587,7 +195649,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
195587
195649
  delete this.orderbooks[symbol];
195588
195650
  }
195589
195651
  this.orderbooks[symbol] = this.orderBook({}, limit);
195590
- subscription['symbol'] = symbol;
195652
+ subscription = this.extend(subscription, { 'symbol': symbol });
195591
195653
  // fetch the snapshot in a separate async call
195592
195654
  this.spawn(this.fetchOrderBookSnapshot, client, message, subscription);
195593
195655
  }
@@ -275531,7 +275593,7 @@ SOFTWARE.
275531
275593
 
275532
275594
  //-----------------------------------------------------------------------------
275533
275595
  // this is updated by vss.js when building
275534
- const version = '4.0.93';
275596
+ const version = '4.0.95';
275535
275597
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
275536
275598
  //-----------------------------------------------------------------------------
275537
275599