ccxt 4.1.71 → 4.1.72

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
@@ -211,13 +211,13 @@ console.log(version, Object.keys(exchanges));
211
211
 
212
212
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
213
213
 
214
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.1.71/dist/ccxt.browser.js
215
- * unpkg: https://unpkg.com/ccxt@4.1.71/dist/ccxt.browser.js
214
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.1.72/dist/ccxt.browser.js
215
+ * unpkg: https://unpkg.com/ccxt@4.1.72/dist/ccxt.browser.js
216
216
 
217
217
  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.
218
218
 
219
219
  ```HTML
220
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.1.71/dist/ccxt.browser.js"></script>
220
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.1.72/dist/ccxt.browser.js"></script>
221
221
  ```
222
222
 
223
223
  Creates a global `ccxt` object:
@@ -7352,6 +7352,8 @@ class Exchange {
7352
7352
  'createLimitOrder': true,
7353
7353
  'createMarketOrder': true,
7354
7354
  'createOrder': true,
7355
+ 'createMarketBuyOrderWithCost': undefined,
7356
+ 'createMarketSellOrderWithCost': undefined,
7355
7357
  'createOrders': undefined,
7356
7358
  'createPostOnlyOrder': undefined,
7357
7359
  'createReduceOnlyOrder': undefined,
@@ -10553,6 +10555,30 @@ class Exchange {
10553
10555
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
10554
10556
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createOrder() is not supported yet');
10555
10557
  }
10558
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
10559
+ /**
10560
+ * @method
10561
+ * @name createMarketBuyWithCost
10562
+ * @description create a market buy order by providing the symbol and cost
10563
+ * @param {string} symbol unified symbol of the market to create an order in
10564
+ * @param {float} cost how much you want to trade in units of the quote currency
10565
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
10566
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
10567
+ */
10568
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createMarketBuyOrderWithCost() is not supported yet');
10569
+ }
10570
+ async createMarketSellOrderWithCost(symbol, cost, params = {}) {
10571
+ /**
10572
+ * @method
10573
+ * @name createMarketSellOrderWithCost
10574
+ * @description create a market buy order by providing the symbol and cost
10575
+ * @param {string} symbol unified symbol of the market to create an order in
10576
+ * @param {float} cost how much you want to trade in units of the quote currency
10577
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
10578
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
10579
+ */
10580
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createMarketSellOrderWithCost() is not supported yet');
10581
+ }
10556
10582
  async createOrders(orders, params = {}) {
10557
10583
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createOrders() is not supported yet');
10558
10584
  }
@@ -28790,15 +28816,17 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
28790
28816
  // "symbol": "XRP-USDT",
28791
28817
  // "orderId": 1514073325788200960,
28792
28818
  // "price": "0.5",
28819
+ // "StopPrice": "0",
28793
28820
  // "origQty": "20",
28794
- // "executedQty": "0",
28795
- // "cummulativeQuoteQty": "0",
28821
+ // "executedQty": "10",
28822
+ // "cummulativeQuoteQty": "5",
28796
28823
  // "status": "PENDING",
28797
28824
  // "type": "LIMIT",
28798
28825
  // "side": "BUY",
28799
28826
  // "time": 1649818185647,
28800
28827
  // "updateTime": 1649818185647,
28801
28828
  // "origQuoteOrderQty": "0"
28829
+ // "fee": "-0.01"
28802
28830
  // }
28803
28831
  //
28804
28832
  //
@@ -28858,9 +28886,24 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
28858
28886
  const amount = this.safeString2(order, 'origQty', 'q');
28859
28887
  const filled = this.safeString2(order, 'executedQty', 'z');
28860
28888
  const statusId = this.safeString2(order, 'status', 'X');
28889
+ let feeCurrencyCode = this.safeString2(order, 'feeAsset', 'N');
28890
+ const feeCost = this.safeStringN(order, ['fee', 'commission', 'n']);
28891
+ if ((feeCurrencyCode === undefined)) {
28892
+ if (market['spot']) {
28893
+ if (side === 'buy') {
28894
+ feeCurrencyCode = market['base'];
28895
+ }
28896
+ else {
28897
+ feeCurrencyCode = market['quote'];
28898
+ }
28899
+ }
28900
+ else {
28901
+ feeCurrencyCode = market['quote'];
28902
+ }
28903
+ }
28861
28904
  const fee = {
28862
- 'currency': this.safeString2(order, 'feeAsset', 'N'),
28863
- 'rate': this.safeStringN(order, ['fee', 'commission', 'n']),
28905
+ 'currency': feeCurrencyCode,
28906
+ 'cost': _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(feeCost),
28864
28907
  };
28865
28908
  const clientOrderId = this.safeString2(order, 'clientOrderId', 'c');
28866
28909
  return this.safeOrder({
@@ -91139,6 +91182,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
91139
91182
  'cancelOrders': true,
91140
91183
  'createDepositAddress': true,
91141
91184
  'createOrder': true,
91185
+ 'createMarketBuyOrderWithCost': true,
91142
91186
  'createOrders': true,
91143
91187
  'createReduceOnlyOrder': true,
91144
91188
  'editOrder': true,
@@ -92977,6 +93021,19 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
92977
93021
  'info': order,
92978
93022
  }, market);
92979
93023
  }
93024
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
93025
+ /**
93026
+ * @method
93027
+ * @name coinex#createMarketBuyWithCost
93028
+ * @description create a market buy order by providing the symbol and cost
93029
+ * @param {string} symbol unified symbol of the market to create an order in
93030
+ * @param {float} cost how much you want to trade in units of the quote currency
93031
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
93032
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
93033
+ */
93034
+ params['createMarketBuyOrderRequiresPrice'] = false;
93035
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
93036
+ }
92980
93037
  createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
92981
93038
  const market = this.market(symbol);
92982
93039
  const swap = market['swap'];
@@ -93077,16 +93134,20 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
93077
93134
  else {
93078
93135
  request['type'] = side;
93079
93136
  if ((type === 'market') && (side === 'buy')) {
93080
- if (this.options['createMarketBuyOrderRequiresPrice']) {
93081
- if (price === undefined) {
93082
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + " createOrder() requires the price argument with market buy orders to calculate total order cost (amount to spend), where cost = amount * price. Supply a price argument to createOrder() call if you want the cost to be calculated for you from price and amount, or, alternatively, add .options['createMarketBuyOrderRequiresPrice'] = false to supply the cost in the amount argument (the exchange-specific behaviour)");
93137
+ let createMarketBuyOrderRequiresPrice = true;
93138
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
93139
+ const cost = this.safeNumber(params, 'cost');
93140
+ params = this.omit(params, 'cost');
93141
+ if (createMarketBuyOrderRequiresPrice) {
93142
+ if ((price === undefined) && (cost === undefined)) {
93143
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
93083
93144
  }
93084
93145
  else {
93085
- const amountString = this.amountToPrecision(symbol, amount);
93086
- const priceString = this.priceToPrecision(symbol, price);
93087
- const costString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString);
93088
- const costNumber = this.parseNumber(costString);
93089
- request['amount'] = this.costToPrecision(symbol, costNumber);
93146
+ const amountString = this.numberToString(amount);
93147
+ const priceString = this.numberToString(price);
93148
+ const quoteAmount = this.parseToNumeric(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString));
93149
+ const costRequest = (cost !== undefined) ? cost : quoteAmount;
93150
+ request['amount'] = this.costToPrecision(symbol, costRequest);
93090
93151
  }
93091
93152
  }
93092
93153
  else {
@@ -125358,7 +125419,14 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
125358
125419
  'PEND': 'pending',
125359
125420
  'REQUEST': 'pending',
125360
125421
  'DMOVE': 'pending',
125361
- 'CANCEL': 'failed',
125422
+ 'MANUAL': 'pending',
125423
+ 'VERIFY': 'pending',
125424
+ 'PROCES': 'pending',
125425
+ 'EXTPEND': 'pending',
125426
+ 'SPLITPEND': 'pending',
125427
+ 'CANCEL': 'canceled',
125428
+ 'FAIL': 'failed',
125429
+ 'INVALID': 'failed',
125362
125430
  'DONE': 'ok',
125363
125431
  'BCODE': 'ok', // GateCode withdrawal
125364
125432
  };
@@ -173940,7 +174008,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
173940
174008
  }
173941
174009
  createSpotOrderRequest(market, type, side, amount, price = undefined, marginMode = undefined, params = {}) {
173942
174010
  const symbol = market['symbol'];
173943
- const orderSide = (side === 'buy') ? 'BUY' : 'SELL';
174011
+ const orderSide = side.toUpperCase();
173944
174012
  const request = {
173945
174013
  'symbol': market['id'],
173946
174014
  'side': orderSide,
@@ -173959,10 +174027,10 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
173959
174027
  const amountString = this.numberToString(amount);
173960
174028
  const priceString = this.numberToString(price);
173961
174029
  const quoteAmount = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString);
173962
- amount = this.parseNumber(quoteAmount);
174030
+ amount = quoteAmount;
173963
174031
  }
173964
174032
  }
173965
- request['quoteOrderQty'] = amount;
174033
+ request['quoteOrderQty'] = this.costToPrecision(symbol, amount);
173966
174034
  }
173967
174035
  else {
173968
174036
  request['quantity'] = this.amountToPrecision(symbol, amount);
@@ -174162,7 +174230,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
174162
174230
  ordersRequests.push(orderRequest);
174163
174231
  }
174164
174232
  const request = {
174165
- 'batchOrders': ordersRequests,
174233
+ 'batchOrders': this.json(ordersRequests),
174166
174234
  };
174167
174235
  const response = await this.spotPrivatePostBatchOrders(request);
174168
174236
  //
@@ -206989,6 +207057,9 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
206989
207057
  return this.filterBySymbolsSinceLimit(cache, symbols, since, limit, true);
206990
207058
  }
206991
207059
  setPositionsCache(client, type, symbols = undefined) {
207060
+ if (type === 'spot') {
207061
+ return;
207062
+ }
206992
207063
  if (this.positions === undefined) {
206993
207064
  this.positions = {};
206994
207065
  }
@@ -288480,7 +288551,7 @@ SOFTWARE.
288480
288551
 
288481
288552
  //-----------------------------------------------------------------------------
288482
288553
  // this is updated by vss.js when building
288483
- const version = '4.1.71';
288554
+ const version = '4.1.72';
288484
288555
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
288485
288556
  //-----------------------------------------------------------------------------
288486
288557