ccxt 4.2.27 → 4.2.28

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
@@ -210,13 +210,13 @@ console.log(version, Object.keys(exchanges));
210
210
 
211
211
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
212
212
 
213
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.27/dist/ccxt.browser.js
214
- * unpkg: https://unpkg.com/ccxt@4.2.27/dist/ccxt.browser.js
213
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.28/dist/ccxt.browser.js
214
+ * unpkg: https://unpkg.com/ccxt@4.2.28/dist/ccxt.browser.js
215
215
 
216
216
  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.
217
217
 
218
218
  ```HTML
219
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.27/dist/ccxt.browser.js"></script>
219
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.28/dist/ccxt.browser.js"></script>
220
220
  ```
221
221
 
222
222
  Creates a global `ccxt` object:
@@ -27991,6 +27991,10 @@ class binanceusdm extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
27991
27991
 
27992
27992
 
27993
27993
  // ---------------------------------------------------------------------------
27994
+ /**
27995
+ * @class bingx
27996
+ * @augments Exchange
27997
+ */
27994
27998
  class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
27995
27999
  describe() {
27996
28000
  return this.deepExtend(super.describe(), {
@@ -31934,6 +31938,7 @@ class bit2c extends _abstract_bit2c_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
31934
31938
  'future': false,
31935
31939
  'option': false,
31936
31940
  'addMargin': false,
31941
+ 'cancelAllOrders': false,
31937
31942
  'cancelOrder': true,
31938
31943
  'closeAllPositions': false,
31939
31944
  'closePosition': false,
@@ -32857,6 +32862,7 @@ class bitbank extends _abstract_bitbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
32857
32862
  'future': false,
32858
32863
  'option': false,
32859
32864
  'addMargin': false,
32865
+ 'cancelAllOrders': false,
32860
32866
  'cancelOrder': true,
32861
32867
  'closeAllPositions': false,
32862
32868
  'closePosition': false,
@@ -33893,6 +33899,7 @@ class bitbns extends _abstract_bitbns_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
33893
33899
  'swap': false,
33894
33900
  'future': false,
33895
33901
  'option': undefined,
33902
+ 'cancelAllOrders': false,
33896
33903
  'cancelOrder': true,
33897
33904
  'createOrder': true,
33898
33905
  'fetchBalance': true,
@@ -36866,6 +36873,7 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
36866
36873
  'fetchTradingFees': true,
36867
36874
  'fetchTransactionFees': undefined,
36868
36875
  'fetchTransactions': 'emulated',
36876
+ 'setMargin': true,
36869
36877
  'withdraw': true,
36870
36878
  },
36871
36879
  'timeframes': {
@@ -37616,6 +37624,11 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
37616
37624
  const result = { 'info': response };
37617
37625
  for (let i = 0; i < response.length; i++) {
37618
37626
  const balance = response[i];
37627
+ const account = this.account();
37628
+ const interest = this.safeString(balance, 3);
37629
+ if (interest !== '0') {
37630
+ account['debt'] = interest;
37631
+ }
37619
37632
  const type = this.safeString(balance, 0);
37620
37633
  const currencyId = this.safeStringLower(balance, 1, '');
37621
37634
  const start = currencyId.length - 2;
@@ -37624,7 +37637,6 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
37624
37637
  const derivativeCondition = (!isDerivative || isDerivativeCode);
37625
37638
  if ((accountType === type) && derivativeCondition) {
37626
37639
  const code = this.safeCurrencyCode(currencyId);
37627
- const account = this.account();
37628
37640
  account['total'] = this.safeString(balance, 2);
37629
37641
  account['free'] = this.safeString(balance, 4);
37630
37642
  result[code] = account;
@@ -40059,6 +40071,49 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
40059
40071
  'datetime': this.iso8601(timestamp),
40060
40072
  });
40061
40073
  }
40074
+ async setMargin(symbol, amount, params = {}) {
40075
+ /**
40076
+ * @method
40077
+ * @name bitfinex2#setMargin
40078
+ * @description either adds or reduces margin in a swap position in order to set the margin to a specific value
40079
+ * @see https://docs.bitfinex.com/reference/rest-auth-deriv-pos-collateral-set
40080
+ * @param {string} symbol unified market symbol of the market to set margin in
40081
+ * @param {float} amount the amount to set the margin to
40082
+ * @param {object} [params] parameters specific to the exchange API endpoint
40083
+ * @returns {object} A [margin structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#add-margin-structure}
40084
+ */
40085
+ await this.loadMarkets();
40086
+ const market = this.market(symbol);
40087
+ if (!market['swap']) {
40088
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' setMargin() only support swap markets');
40089
+ }
40090
+ const request = {
40091
+ 'symbol': market['id'],
40092
+ 'collateral': this.parseToNumeric(amount),
40093
+ };
40094
+ const response = await this.privatePostAuthWDerivCollateralSet(this.extend(request, params));
40095
+ //
40096
+ // [
40097
+ // [
40098
+ // 1
40099
+ // ]
40100
+ // ]
40101
+ //
40102
+ const data = this.safeValue(response, 0);
40103
+ return this.parseMarginModification(data, market);
40104
+ }
40105
+ parseMarginModification(data, market = undefined) {
40106
+ const marginStatusRaw = data[0];
40107
+ const marginStatus = (marginStatusRaw === 1) ? 'ok' : 'failed';
40108
+ return {
40109
+ 'info': data,
40110
+ 'type': undefined,
40111
+ 'amount': undefined,
40112
+ 'code': undefined,
40113
+ 'symbol': market['symbol'],
40114
+ 'status': marginStatus,
40115
+ };
40116
+ }
40062
40117
  }
40063
40118
 
40064
40119
 
@@ -40102,6 +40157,7 @@ class bitflyer extends _abstract_bitflyer_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
40102
40157
  'swap': undefined,
40103
40158
  'future': undefined,
40104
40159
  'option': false,
40160
+ 'cancelAllOrders': undefined,
40105
40161
  'cancelOrder': true,
40106
40162
  'createOrder': true,
40107
40163
  'fetchBalance': true,
@@ -41155,6 +41211,7 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
41155
41211
  'future': false,
41156
41212
  'option': false,
41157
41213
  'addMargin': false,
41214
+ 'cancelAllOrders': true,
41158
41215
  'cancelOrder': true,
41159
41216
  'createOrder': true,
41160
41217
  'createReduceOnlyOrder': false,
@@ -41808,6 +41865,34 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
41808
41865
  'trades': undefined,
41809
41866
  }, market);
41810
41867
  }
41868
+ async cancelAllOrders(symbol = undefined, params = {}) {
41869
+ /**
41870
+ * @method
41871
+ * @name bitforex#cancelAllOrders
41872
+ * @see https://github.com/githubdev2020/API_Doc_en/wiki/Cancle-all-orders
41873
+ * @description cancel all open orders in a market
41874
+ * @param {string} symbol unified market symbol of the market to cancel orders in
41875
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
41876
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
41877
+ */
41878
+ if (symbol === undefined) {
41879
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' cancelAllOrders () requires a symbol argument');
41880
+ }
41881
+ await this.loadMarkets();
41882
+ const market = this.market(symbol);
41883
+ const request = {
41884
+ 'symbol': market['id'],
41885
+ };
41886
+ const response = await this.privatePostApiV1TradeCancelAllOrder(this.extend(request, params));
41887
+ //
41888
+ // {
41889
+ // 'data': True,
41890
+ // 'success': True,
41891
+ // 'time': '1706542995252'
41892
+ // }
41893
+ //
41894
+ return response;
41895
+ }
41811
41896
  async fetchOrder(id, symbol = undefined, params = {}) {
41812
41897
  /**
41813
41898
  * @method
@@ -165329,6 +165414,10 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
165329
165414
 
165330
165415
 
165331
165416
  // ---------------------------------------------------------------------------
165417
+ /**
165418
+ * @class kucoinfutures
165419
+ * @augments Exchange
165420
+ */
165332
165421
  class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
165333
165422
  describe() {
165334
165423
  return this.deepExtend(super.describe(), {
@@ -299348,7 +299437,7 @@ SOFTWARE.
299348
299437
 
299349
299438
  //-----------------------------------------------------------------------------
299350
299439
  // this is updated by vss.js when building
299351
- const version = '4.2.27';
299440
+ const version = '4.2.28';
299352
299441
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
299353
299442
  //-----------------------------------------------------------------------------
299354
299443