ccxt 4.3.48 → 4.3.50

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/dist/cjs/ccxt.js CHANGED
@@ -188,7 +188,7 @@ var woofipro$1 = require('./src/pro/woofipro.js');
188
188
 
189
189
  //-----------------------------------------------------------------------------
190
190
  // this is updated by vss.js when building
191
- const version = '4.3.48';
191
+ const version = '4.3.50';
192
192
  Exchange["default"].ccxtVersion = version;
193
193
  const exchanges = {
194
194
  'ace': ace,
@@ -1017,14 +1017,11 @@ class ace extends ace$1 {
1017
1017
  let auth = 'ACE_SIGN' + this.secret;
1018
1018
  const data = this.extend({
1019
1019
  'apiKey': this.apiKey,
1020
- 'timeStamp': nonce,
1020
+ 'timeStamp': this.numberToString(nonce),
1021
1021
  }, params);
1022
- const dataKeys = Object.keys(data);
1023
- const sortedDataKeys = this.sortBy(dataKeys, 0, false, '');
1024
- for (let i = 0; i < sortedDataKeys.length; i++) {
1025
- const key = sortedDataKeys[i];
1026
- auth += this.safeString(data, key);
1027
- }
1022
+ const sortedData = this.keysort(data);
1023
+ const values = Object.values(sortedData);
1024
+ auth += values.join('');
1028
1025
  const signature = this.hash(this.encode(auth), sha256.sha256, 'hex');
1029
1026
  data['signKey'] = signature;
1030
1027
  headers = {
@@ -1180,7 +1180,7 @@ class binance extends binance$1 {
1180
1180
  'BCC': 'BCC',
1181
1181
  'YOYO': 'YOYOW',
1182
1182
  },
1183
- 'precisionMode': number.DECIMAL_PLACES,
1183
+ 'precisionMode': number.TICK_SIZE,
1184
1184
  // exchange-specific options
1185
1185
  'options': {
1186
1186
  'sandboxMode': false,
@@ -2783,7 +2783,7 @@ class binance extends binance$1 {
2783
2783
  'deposit': depositEnable,
2784
2784
  'withdraw': withdrawEnable,
2785
2785
  'fee': this.parseNumber(fee),
2786
- 'precision': minPrecision,
2786
+ 'precision': this.parseNumber(precisionTick),
2787
2787
  'limits': {
2788
2788
  'withdraw': {
2789
2789
  'min': this.safeNumber(networkItem, 'withdrawMin'),
@@ -2798,15 +2798,11 @@ class binance extends binance$1 {
2798
2798
  }
2799
2799
  const trading = this.safeBool(entry, 'trading');
2800
2800
  const active = (isWithdrawEnabled && isDepositEnabled && trading);
2801
- let maxDecimalPlaces = undefined;
2802
- if (minPrecision !== undefined) {
2803
- maxDecimalPlaces = parseInt(this.numberToString(this.precisionFromString(minPrecision)));
2804
- }
2805
2801
  result[code] = {
2806
2802
  'id': id,
2807
2803
  'name': name,
2808
2804
  'code': code,
2809
- 'precision': maxDecimalPlaces,
2805
+ 'precision': this.parseNumber(minPrecision),
2810
2806
  'info': entry,
2811
2807
  'active': active,
2812
2808
  'deposit': isDepositEnabled,
@@ -3191,10 +3187,10 @@ class binance extends binance$1 {
3191
3187
  'strike': parsedStrike,
3192
3188
  'optionType': this.safeStringLower(market, 'side'),
3193
3189
  'precision': {
3194
- 'amount': this.safeInteger2(market, 'quantityPrecision', 'quantityScale'),
3195
- 'price': this.safeInteger2(market, 'pricePrecision', 'priceScale'),
3196
- 'base': this.safeInteger(market, 'baseAssetPrecision'),
3197
- 'quote': this.safeInteger(market, 'quotePrecision'),
3190
+ 'amount': this.parseNumber(this.parsePrecision(this.safeString2(market, 'quantityPrecision', 'quantityScale'))),
3191
+ 'price': this.parseNumber(this.parsePrecision(this.safeString2(market, 'pricePrecision', 'priceScale'))),
3192
+ 'base': this.parseNumber(this.parsePrecision(this.safeString(market, 'baseAssetPrecision'))),
3193
+ 'quote': this.parseNumber(this.parsePrecision(this.safeString(market, 'quotePrecision'))),
3198
3194
  },
3199
3195
  'limits': {
3200
3196
  'leverage': {
@@ -3227,12 +3223,11 @@ class binance extends binance$1 {
3227
3223
  'min': this.safeNumber(filter, 'minPrice'),
3228
3224
  'max': this.safeNumber(filter, 'maxPrice'),
3229
3225
  };
3230
- entry['precision']['price'] = this.precisionFromString(filter['tickSize']);
3226
+ entry['precision']['price'] = this.safeNumber(filter, 'tickSize');
3231
3227
  }
3232
3228
  if ('LOT_SIZE' in filtersByType) {
3233
3229
  const filter = this.safeDict(filtersByType, 'LOT_SIZE', {});
3234
- const stepSize = this.safeString(filter, 'stepSize');
3235
- entry['precision']['amount'] = this.precisionFromString(stepSize);
3230
+ entry['precision']['amount'] = this.safeNumber(filter, 'stepSize');
3236
3231
  entry['limits']['amount'] = {
3237
3232
  'min': this.safeNumber(filter, 'minQty'),
3238
3233
  'max': this.safeNumber(filter, 'maxQty'),
@@ -9578,7 +9573,7 @@ class binance extends binance$1 {
9578
9573
  const rightSide = Precise["default"].stringSub(Precise["default"].stringMul(Precise["default"].stringDiv('1', entryPriceSignString), size), walletBalance);
9579
9574
  liquidationPriceStringRaw = Precise["default"].stringDiv(leftSide, rightSide);
9580
9575
  }
9581
- const pricePrecision = market['precision']['price'];
9576
+ const pricePrecision = this.precisionFromString(this.safeString(market['precision'], 'price'));
9582
9577
  const pricePrecisionPlusOne = pricePrecision + 1;
9583
9578
  const pricePrecisionPlusOneString = pricePrecisionPlusOne.toString();
9584
9579
  // round half up
@@ -9751,8 +9746,7 @@ class binance extends binance$1 {
9751
9746
  }
9752
9747
  const inner = Precise["default"].stringMul(liquidationPriceString, onePlusMaintenanceMarginPercentageString);
9753
9748
  const leftSide = Precise["default"].stringAdd(inner, entryPriceSignString);
9754
- const pricePrecision = this.safeInteger(precision, 'price');
9755
- const quotePrecision = this.safeInteger(precision, 'quote', pricePrecision);
9749
+ const quotePrecision = this.precisionFromString(this.safeString2(precision, 'quote', 'price'));
9756
9750
  if (quotePrecision !== undefined) {
9757
9751
  collateralString = Precise["default"].stringDiv(Precise["default"].stringMul(leftSide, contractsAbs), '1', quotePrecision);
9758
9752
  }
@@ -9770,7 +9764,7 @@ class binance extends binance$1 {
9770
9764
  }
9771
9765
  const leftSide = Precise["default"].stringMul(contractsAbs, contractSizeString);
9772
9766
  const rightSide = Precise["default"].stringSub(Precise["default"].stringDiv('1', entryPriceSignString), Precise["default"].stringDiv(onePlusMaintenanceMarginPercentageString, liquidationPriceString));
9773
- const basePrecision = this.safeInteger(precision, 'base');
9767
+ const basePrecision = this.precisionFromString(this.safeString(precision, 'base'));
9774
9768
  if (basePrecision !== undefined) {
9775
9769
  collateralString = Precise["default"].stringDiv(Precise["default"].stringMul(leftSide, rightSide), '1', basePrecision);
9776
9770
  }
@@ -12921,7 +12915,7 @@ class binance extends binance$1 {
12921
12915
  'deposit': undefined,
12922
12916
  'withdraw': undefined,
12923
12917
  'fee': undefined,
12924
- 'precision': this.safeInteger(entry, 'fraction'),
12918
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(entry, 'fraction'))),
12925
12919
  'limits': {
12926
12920
  'amount': {
12927
12921
  'min': undefined,
@@ -4151,6 +4151,7 @@ class bitget extends bitget$1 {
4151
4151
  * @param {string} [params.trailingTriggerPrice] *swap and future only* the price to trigger a trailing stop order, default uses the price argument
4152
4152
  * @param {string} [params.triggerType] *swap and future only* 'fill_price', 'mark_price' or 'index_price'
4153
4153
  * @param {boolean} [params.oneWayMode] *swap and future only* required to set this to true in one_way_mode and you can leave this as undefined in hedge_mode, can adjust the mode using the setPositionMode() method
4154
+ * @param {bool} [params.reduceOnly] true or false whether the order is reduce-only
4154
4155
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
4155
4156
  */
4156
4157
  await this.loadMarkets();
@@ -1002,7 +1002,19 @@ class bitso extends bitso$1 {
1002
1002
  const request = {
1003
1003
  'oid': id,
1004
1004
  };
1005
- return await this.privateDeleteOrdersOid(this.extend(request, params));
1005
+ const response = await this.privateDeleteOrdersOid(this.extend(request, params));
1006
+ //
1007
+ // {
1008
+ // "success": true,
1009
+ // "payload": ["yWTQGxDMZ0VimZgZ"]
1010
+ // }
1011
+ //
1012
+ const payload = this.safeList(response, 'payload', []);
1013
+ const orderId = this.safeString(payload, 0);
1014
+ return this.safeOrder({
1015
+ 'info': response,
1016
+ 'id': orderId,
1017
+ });
1006
1018
  }
1007
1019
  async cancelOrders(ids, symbol = undefined, params = {}) {
1008
1020
  /**
@@ -3993,10 +3993,10 @@ class htx extends htx$1 {
3993
3993
  'status': '0', // support multiple query seperated by ',',such as '3,4,5', 0: all. 3. Have sumbmitted the orders; 4. Orders partially matched; 5. Orders cancelled with partially matched; 6. Orders fully matched; 7. Orders cancelled;
3994
3994
  };
3995
3995
  let response = undefined;
3996
- const stop = this.safeValue(params, 'stop');
3996
+ const stop = this.safeBool2(params, 'stop', 'trigger');
3997
3997
  const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
3998
3998
  const trailing = this.safeBool(params, 'trailing', false);
3999
- params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
3999
+ params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger']);
4000
4000
  if (stop || stopLossTakeProfit || trailing) {
4001
4001
  if (limit !== undefined) {
4002
4002
  request['page_size'] = limit;
@@ -4368,10 +4368,10 @@ class htx extends htx$1 {
4368
4368
  request['page_size'] = limit;
4369
4369
  }
4370
4370
  request['contract_code'] = market['id'];
4371
- const stop = this.safeValue(params, 'stop');
4371
+ const stop = this.safeBool2(params, 'stop', 'trigger');
4372
4372
  const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
4373
4373
  const trailing = this.safeBool(params, 'trailing', false);
4374
- params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
4374
+ params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger']);
4375
4375
  if (market['linear']) {
4376
4376
  let marginMode = undefined;
4377
4377
  [marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
@@ -5751,10 +5751,10 @@ class htx extends htx$1 {
5751
5751
  else {
5752
5752
  request['contract_code'] = market['id'];
5753
5753
  }
5754
- const stop = this.safeValue(params, 'stop');
5754
+ const stop = this.safeBool2(params, 'stop', 'trigger');
5755
5755
  const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
5756
5756
  const trailing = this.safeBool(params, 'trailing', false);
5757
- params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
5757
+ params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger']);
5758
5758
  if (market['linear']) {
5759
5759
  let marginMode = undefined;
5760
5760
  [marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
@@ -5917,9 +5917,9 @@ class htx extends htx$1 {
5917
5917
  else {
5918
5918
  request['contract_code'] = market['id'];
5919
5919
  }
5920
- const stop = this.safeValue(params, 'stop');
5920
+ const stop = this.safeBool2(params, 'stop', 'trigger');
5921
5921
  const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
5922
- params = this.omit(params, ['stop', 'stopLossTakeProfit']);
5922
+ params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trigger']);
5923
5923
  if (market['linear']) {
5924
5924
  let marginMode = undefined;
5925
5925
  [marginMode, params] = this.handleMarginModeAndParams('cancelOrders', params);
@@ -6076,10 +6076,10 @@ class htx extends htx$1 {
6076
6076
  request['symbol'] = market['settleId'];
6077
6077
  }
6078
6078
  request['contract_code'] = market['id'];
6079
- const stop = this.safeValue(params, 'stop');
6079
+ const stop = this.safeBool2(params, 'stop', 'trigger');
6080
6080
  const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
6081
6081
  const trailing = this.safeBool(params, 'trailing', false);
6082
- params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing']);
6082
+ params = this.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger']);
6083
6083
  if (market['linear']) {
6084
6084
  let marginMode = undefined;
6085
6085
  [marginMode, params] = this.handleMarginModeAndParams('cancelAllOrders', params);
@@ -1213,7 +1213,8 @@ class hyperliquid extends hyperliquid$1 {
1213
1213
  * @param {string} [params.vaultAddress] the vault address for order
1214
1214
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1215
1215
  */
1216
- return await this.cancelOrders([id], symbol, params);
1216
+ const orders = await this.cancelOrders([id], symbol, params);
1217
+ return this.safeDict(orders, 0);
1217
1218
  }
1218
1219
  async cancelOrders(ids, symbol = undefined, params = {}) {
1219
1220
  /**
@@ -1292,7 +1293,18 @@ class hyperliquid extends hyperliquid$1 {
1292
1293
  // }
1293
1294
  // }
1294
1295
  //
1295
- return response;
1296
+ const innerResponse = this.safeDict(response, 'response');
1297
+ const data = this.safeDict(innerResponse, 'data');
1298
+ const statuses = this.safeList(data, 'statuses');
1299
+ const orders = [];
1300
+ for (let i = 0; i < statuses.length; i++) {
1301
+ const status = statuses[i];
1302
+ orders.push(this.safeOrder({
1303
+ 'info': status,
1304
+ 'status': status,
1305
+ }));
1306
+ }
1307
+ return orders;
1296
1308
  }
1297
1309
  async cancelOrdersForSymbols(orders, params = {}) {
1298
1310
  /**
@@ -1713,6 +1713,7 @@ class kraken extends kraken$1 {
1713
1713
  'filled': filled,
1714
1714
  'average': average,
1715
1715
  'remaining': undefined,
1716
+ 'reduceOnly': this.safeBool2(order, 'reduceOnly', 'reduce_only'),
1716
1717
  'fee': fee,
1717
1718
  'trades': trades,
1718
1719
  }, market);
@@ -2122,7 +2123,7 @@ class kraken extends kraken$1 {
2122
2123
  * @method
2123
2124
  * @name kraken#cancelOrder
2124
2125
  * @description cancels an open order
2125
- * @see https://docs.kraken.com/rest/#tag/Trading/operation/cancelOrder
2126
+ * @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelOrder
2126
2127
  * @param {string} id order id
2127
2128
  * @param {string} symbol unified symbol of the market the order was made in
2128
2129
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2163,7 +2164,7 @@ class kraken extends kraken$1 {
2163
2164
  * @method
2164
2165
  * @name kraken#cancelOrders
2165
2166
  * @description cancel multiple orders
2166
- * @see https://docs.kraken.com/rest/#tag/Trading/operation/cancelOrderBatch
2167
+ * @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelOrderBatch
2167
2168
  * @param {string[]} ids open orders transaction ID (txid) or user reference (userref)
2168
2169
  * @param {string} symbol unified market symbol
2169
2170
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2192,7 +2193,7 @@ class kraken extends kraken$1 {
2192
2193
  * @method
2193
2194
  * @name kraken#cancelAllOrders
2194
2195
  * @description cancel all open orders
2195
- * @see https://docs.kraken.com/rest/#tag/Trading/operation/cancelAllOrders
2196
+ * @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelAllOrders
2196
2197
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
2197
2198
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2198
2199
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -1875,7 +1875,7 @@ class krakenfutures extends krakenfutures$1 {
1875
1875
  'type': this.parseOrderType(type),
1876
1876
  'timeInForce': timeInForce,
1877
1877
  'postOnly': type === 'post',
1878
- 'reduceOnly': this.safeValue(details, 'reduceOnly'),
1878
+ 'reduceOnly': this.safeBool2(details, 'reduceOnly', 'reduce_only'),
1879
1879
  'side': this.safeString(details, 'side'),
1880
1880
  'price': price,
1881
1881
  'stopPrice': this.safeString(details, 'triggerPrice'),
@@ -2509,9 +2509,9 @@ class kucoin extends kucoin$1 {
2509
2509
  await this.loadMarkets();
2510
2510
  let lowercaseStatus = status.toLowerCase();
2511
2511
  const until = this.safeInteger(params, 'until');
2512
- const stop = this.safeBool(params, 'stop', false);
2512
+ const stop = this.safeBool2(params, 'stop', 'trigger', false);
2513
2513
  const hf = this.safeBool(params, 'hf', false);
2514
- params = this.omit(params, ['stop', 'hf', 'until']);
2514
+ params = this.omit(params, ['stop', 'hf', 'until', 'trigger']);
2515
2515
  const [marginMode, query] = this.handleMarginModeAndParams('fetchOrdersByStatus', params);
2516
2516
  if (lowercaseStatus === 'open') {
2517
2517
  lowercaseStatus = 'active';
@@ -2688,7 +2688,7 @@ class kucoin extends kucoin$1 {
2688
2688
  await this.loadMarkets();
2689
2689
  const request = {};
2690
2690
  const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
2691
- const stop = this.safeBool(params, 'stop', false);
2691
+ const stop = this.safeBool2(params, 'stop', 'trigger', false);
2692
2692
  const hf = this.safeBool(params, 'hf', false);
2693
2693
  let market = undefined;
2694
2694
  if (symbol !== undefined) {
@@ -2700,7 +2700,7 @@ class kucoin extends kucoin$1 {
2700
2700
  }
2701
2701
  request['symbol'] = market['id'];
2702
2702
  }
2703
- params = this.omit(params, ['stop', 'hf', 'clientOid', 'clientOrderId']);
2703
+ params = this.omit(params, ['stop', 'hf', 'clientOid', 'clientOrderId', 'trigger']);
2704
2704
  let response = undefined;
2705
2705
  if (clientOrderId !== undefined) {
2706
2706
  request['clientOid'] = clientOrderId;
@@ -1765,7 +1765,7 @@ class kucoinfutures extends kucoinfutures$1 {
1765
1765
  if (paginate) {
1766
1766
  return await this.fetchPaginatedCallDynamic('fetchOrdersByStatus', symbol, since, limit, params);
1767
1767
  }
1768
- const stop = this.safeValue2(params, 'stop', 'trigger');
1768
+ const stop = this.safeBool2(params, 'stop', 'trigger');
1769
1769
  const until = this.safeInteger(params, 'until');
1770
1770
  params = this.omit(params, ['stop', 'until', 'trigger']);
1771
1771
  if (status === 'closed') {
@@ -69,6 +69,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
69
69
  * @param {object} [params] extra parameters specific to the exchange API endpoint
70
70
  * @returns {object} subscription to a websocket channel
71
71
  */
72
+ await this.loadMarkets();
72
73
  this.checkRequiredCredentials();
73
74
  let market = undefined;
74
75
  let messageHash = name;
@@ -117,6 +118,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
117
118
  * @param {object} [params] extra parameters specific to the exchange API endpoint
118
119
  * @returns {object} subscription to a websocket channel
119
120
  */
121
+ await this.loadMarkets();
120
122
  this.checkRequiredCredentials();
121
123
  if (this.isEmpty(symbols)) {
122
124
  symbols = this.symbols;
@@ -160,6 +162,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
160
162
  * @param {object} [params] extra parameters specific to the exchange API endpoint
161
163
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
162
164
  */
165
+ await this.loadMarkets();
163
166
  return await this.subscribe('RISK', [symbol], params);
164
167
  }
165
168
  async watchFundingRates(symbols, params = {}) {
@@ -172,6 +175,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
172
175
  * @param {object} [params] extra parameters specific to the exchange API endpoint
173
176
  * @returns {object} a dictionary of [funding rates structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexe by market symbols
174
177
  */
178
+ await this.loadMarkets();
175
179
  const fundingRate = await this.subscribeMultiple('RISK', symbols, params);
176
180
  const symbol = this.safeString(fundingRate, 'symbol');
177
181
  if (this.newUpdates) {
@@ -191,6 +195,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
191
195
  * @param {object} [params] extra parameters specific to the exchange API endpoint
192
196
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
193
197
  */
198
+ await this.loadMarkets();
194
199
  let channel = undefined;
195
200
  [channel, params] = this.handleOptionAndParams(params, 'watchTicker', 'channel', 'LEVEL1');
196
201
  return await this.subscribe(channel, [symbol], params);
@@ -225,8 +225,8 @@ class gate extends gate$1 {
225
225
  */
226
226
  await this.loadMarkets();
227
227
  const market = (symbol === undefined) ? undefined : this.market(symbol);
228
- const stop = this.safeValue2(params, 'is_stop_order', 'stop', false);
229
- params = this.omit(params, ['is_stop_order', 'stop']);
228
+ const stop = this.safeValueN(params, ['is_stop_order', 'stop', 'trigger'], false);
229
+ params = this.omit(params, ['is_stop_order', 'stop', 'trigger']);
230
230
  const [type, query] = this.handleMarketTypeAndParams('cancelOrder', market, params);
231
231
  const [request, requestParams] = (type === 'spot' || type === 'margin') ? this.spotOrderPrepareRequest(market, stop, query) : this.prepareRequest(market, type, query);
232
232
  const messageType = this.getTypeByMarket(market);
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, TransferEntries, LeverageTiers } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
7
- declare const version = "4.3.47";
7
+ declare const version = "4.3.49";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.3.48';
41
+ const version = '4.3.50';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
package/js/src/ace.js CHANGED
@@ -1020,14 +1020,11 @@ export default class ace extends Exchange {
1020
1020
  let auth = 'ACE_SIGN' + this.secret;
1021
1021
  const data = this.extend({
1022
1022
  'apiKey': this.apiKey,
1023
- 'timeStamp': nonce,
1023
+ 'timeStamp': this.numberToString(nonce),
1024
1024
  }, params);
1025
- const dataKeys = Object.keys(data);
1026
- const sortedDataKeys = this.sortBy(dataKeys, 0, false, '');
1027
- for (let i = 0; i < sortedDataKeys.length; i++) {
1028
- const key = sortedDataKeys[i];
1029
- auth += this.safeString(data, key);
1030
- }
1025
+ const sortedData = this.keysort(data);
1026
+ const values = Object.values(sortedData);
1027
+ auth += values.join('');
1031
1028
  const signature = this.hash(this.encode(auth), sha256, 'hex');
1032
1029
  data['signKey'] = signature;
1033
1030
  headers = {
package/js/src/binance.js CHANGED
@@ -8,7 +8,7 @@
8
8
  import Exchange from './abstract/binance.js';
9
9
  import { ExchangeError, ArgumentsRequired, OperationFailed, OperationRejected, InsufficientFunds, OrderNotFound, InvalidOrder, DDoSProtection, InvalidNonce, AuthenticationError, RateLimitExceeded, PermissionDenied, NotSupported, BadRequest, BadSymbol, AccountSuspended, OrderImmediatelyFillable, OnMaintenance, BadResponse, RequestTimeout, OrderNotFillable, MarginModeAlreadySet, MarketClosed } from './base/errors.js';
10
10
  import { Precise } from './base/Precise.js';
11
- import { TRUNCATE, DECIMAL_PLACES } from './base/functions/number.js';
11
+ import { TRUNCATE, TICK_SIZE } from './base/functions/number.js';
12
12
  import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
13
13
  import { rsa } from './base/functions/rsa.js';
14
14
  import { eddsa } from './base/functions/crypto.js';
@@ -1183,7 +1183,7 @@ export default class binance extends Exchange {
1183
1183
  'BCC': 'BCC',
1184
1184
  'YOYO': 'YOYOW',
1185
1185
  },
1186
- 'precisionMode': DECIMAL_PLACES,
1186
+ 'precisionMode': TICK_SIZE,
1187
1187
  // exchange-specific options
1188
1188
  'options': {
1189
1189
  'sandboxMode': false,
@@ -2786,7 +2786,7 @@ export default class binance extends Exchange {
2786
2786
  'deposit': depositEnable,
2787
2787
  'withdraw': withdrawEnable,
2788
2788
  'fee': this.parseNumber(fee),
2789
- 'precision': minPrecision,
2789
+ 'precision': this.parseNumber(precisionTick),
2790
2790
  'limits': {
2791
2791
  'withdraw': {
2792
2792
  'min': this.safeNumber(networkItem, 'withdrawMin'),
@@ -2801,15 +2801,11 @@ export default class binance extends Exchange {
2801
2801
  }
2802
2802
  const trading = this.safeBool(entry, 'trading');
2803
2803
  const active = (isWithdrawEnabled && isDepositEnabled && trading);
2804
- let maxDecimalPlaces = undefined;
2805
- if (minPrecision !== undefined) {
2806
- maxDecimalPlaces = parseInt(this.numberToString(this.precisionFromString(minPrecision)));
2807
- }
2808
2804
  result[code] = {
2809
2805
  'id': id,
2810
2806
  'name': name,
2811
2807
  'code': code,
2812
- 'precision': maxDecimalPlaces,
2808
+ 'precision': this.parseNumber(minPrecision),
2813
2809
  'info': entry,
2814
2810
  'active': active,
2815
2811
  'deposit': isDepositEnabled,
@@ -3194,10 +3190,10 @@ export default class binance extends Exchange {
3194
3190
  'strike': parsedStrike,
3195
3191
  'optionType': this.safeStringLower(market, 'side'),
3196
3192
  'precision': {
3197
- 'amount': this.safeInteger2(market, 'quantityPrecision', 'quantityScale'),
3198
- 'price': this.safeInteger2(market, 'pricePrecision', 'priceScale'),
3199
- 'base': this.safeInteger(market, 'baseAssetPrecision'),
3200
- 'quote': this.safeInteger(market, 'quotePrecision'),
3193
+ 'amount': this.parseNumber(this.parsePrecision(this.safeString2(market, 'quantityPrecision', 'quantityScale'))),
3194
+ 'price': this.parseNumber(this.parsePrecision(this.safeString2(market, 'pricePrecision', 'priceScale'))),
3195
+ 'base': this.parseNumber(this.parsePrecision(this.safeString(market, 'baseAssetPrecision'))),
3196
+ 'quote': this.parseNumber(this.parsePrecision(this.safeString(market, 'quotePrecision'))),
3201
3197
  },
3202
3198
  'limits': {
3203
3199
  'leverage': {
@@ -3230,12 +3226,11 @@ export default class binance extends Exchange {
3230
3226
  'min': this.safeNumber(filter, 'minPrice'),
3231
3227
  'max': this.safeNumber(filter, 'maxPrice'),
3232
3228
  };
3233
- entry['precision']['price'] = this.precisionFromString(filter['tickSize']);
3229
+ entry['precision']['price'] = this.safeNumber(filter, 'tickSize');
3234
3230
  }
3235
3231
  if ('LOT_SIZE' in filtersByType) {
3236
3232
  const filter = this.safeDict(filtersByType, 'LOT_SIZE', {});
3237
- const stepSize = this.safeString(filter, 'stepSize');
3238
- entry['precision']['amount'] = this.precisionFromString(stepSize);
3233
+ entry['precision']['amount'] = this.safeNumber(filter, 'stepSize');
3239
3234
  entry['limits']['amount'] = {
3240
3235
  'min': this.safeNumber(filter, 'minQty'),
3241
3236
  'max': this.safeNumber(filter, 'maxQty'),
@@ -9581,7 +9576,7 @@ export default class binance extends Exchange {
9581
9576
  const rightSide = Precise.stringSub(Precise.stringMul(Precise.stringDiv('1', entryPriceSignString), size), walletBalance);
9582
9577
  liquidationPriceStringRaw = Precise.stringDiv(leftSide, rightSide);
9583
9578
  }
9584
- const pricePrecision = market['precision']['price'];
9579
+ const pricePrecision = this.precisionFromString(this.safeString(market['precision'], 'price'));
9585
9580
  const pricePrecisionPlusOne = pricePrecision + 1;
9586
9581
  const pricePrecisionPlusOneString = pricePrecisionPlusOne.toString();
9587
9582
  // round half up
@@ -9754,8 +9749,7 @@ export default class binance extends Exchange {
9754
9749
  }
9755
9750
  const inner = Precise.stringMul(liquidationPriceString, onePlusMaintenanceMarginPercentageString);
9756
9751
  const leftSide = Precise.stringAdd(inner, entryPriceSignString);
9757
- const pricePrecision = this.safeInteger(precision, 'price');
9758
- const quotePrecision = this.safeInteger(precision, 'quote', pricePrecision);
9752
+ const quotePrecision = this.precisionFromString(this.safeString2(precision, 'quote', 'price'));
9759
9753
  if (quotePrecision !== undefined) {
9760
9754
  collateralString = Precise.stringDiv(Precise.stringMul(leftSide, contractsAbs), '1', quotePrecision);
9761
9755
  }
@@ -9773,7 +9767,7 @@ export default class binance extends Exchange {
9773
9767
  }
9774
9768
  const leftSide = Precise.stringMul(contractsAbs, contractSizeString);
9775
9769
  const rightSide = Precise.stringSub(Precise.stringDiv('1', entryPriceSignString), Precise.stringDiv(onePlusMaintenanceMarginPercentageString, liquidationPriceString));
9776
- const basePrecision = this.safeInteger(precision, 'base');
9770
+ const basePrecision = this.precisionFromString(this.safeString(precision, 'base'));
9777
9771
  if (basePrecision !== undefined) {
9778
9772
  collateralString = Precise.stringDiv(Precise.stringMul(leftSide, rightSide), '1', basePrecision);
9779
9773
  }
@@ -12924,7 +12918,7 @@ export default class binance extends Exchange {
12924
12918
  'deposit': undefined,
12925
12919
  'withdraw': undefined,
12926
12920
  'fee': undefined,
12927
- 'precision': this.safeInteger(entry, 'fraction'),
12921
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(entry, 'fraction'))),
12928
12922
  'limits': {
12929
12923
  'amount': {
12930
12924
  'min': undefined,
package/js/src/bitget.js CHANGED
@@ -4154,6 +4154,7 @@ export default class bitget extends Exchange {
4154
4154
  * @param {string} [params.trailingTriggerPrice] *swap and future only* the price to trigger a trailing stop order, default uses the price argument
4155
4155
  * @param {string} [params.triggerType] *swap and future only* 'fill_price', 'mark_price' or 'index_price'
4156
4156
  * @param {boolean} [params.oneWayMode] *swap and future only* required to set this to true in one_way_mode and you can leave this as undefined in hedge_mode, can adjust the mode using the setPositionMode() method
4157
+ * @param {bool} [params.reduceOnly] true or false whether the order is reduce-only
4157
4158
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
4158
4159
  */
4159
4160
  await this.loadMarkets();
package/js/src/bitso.d.ts CHANGED
@@ -38,7 +38,7 @@ export default class bitso extends Exchange {
38
38
  fetchTradingFees(params?: {}): Promise<TradingFees>;
39
39
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
40
40
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
41
- cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
41
+ cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
42
42
  cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<any[]>;
43
43
  cancelAllOrders(symbol?: Str, params?: {}): Promise<any[]>;
44
44
  parseOrderStatus(status: Str): string;
package/js/src/bitso.js CHANGED
@@ -1005,7 +1005,19 @@ export default class bitso extends Exchange {
1005
1005
  const request = {
1006
1006
  'oid': id,
1007
1007
  };
1008
- return await this.privateDeleteOrdersOid(this.extend(request, params));
1008
+ const response = await this.privateDeleteOrdersOid(this.extend(request, params));
1009
+ //
1010
+ // {
1011
+ // "success": true,
1012
+ // "payload": ["yWTQGxDMZ0VimZgZ"]
1013
+ // }
1014
+ //
1015
+ const payload = this.safeList(response, 'payload', []);
1016
+ const orderId = this.safeString(payload, 0);
1017
+ return this.safeOrder({
1018
+ 'info': response,
1019
+ 'id': orderId,
1020
+ });
1009
1021
  }
1010
1022
  async cancelOrders(ids, symbol = undefined, params = {}) {
1011
1023
  /**
@@ -76,7 +76,7 @@ export default class coinbase extends Exchange {
76
76
  parseOrderStatus(status: Str): string;
77
77
  parseOrderType(type: Str): string;
78
78
  parseTimeInForce(timeInForce: Str): string;
79
- cancelOrder(id: string, symbol?: Str, params?: {}): Promise<import("./base/types.js").Dictionary<any>>;
79
+ cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
80
80
  cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<Order[]>;
81
81
  editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
82
82
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;