ccxt 4.3.76 → 4.3.78

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.
Files changed (46) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/base/Exchange.js +62 -40
  5. package/dist/cjs/src/binance.js +2 -2
  6. package/dist/cjs/src/bingx.js +0 -1
  7. package/dist/cjs/src/bitget.js +1 -0
  8. package/dist/cjs/src/bithumb.js +14 -14
  9. package/dist/cjs/src/bitmart.js +4 -0
  10. package/dist/cjs/src/bitteam.js +0 -1
  11. package/dist/cjs/src/bybit.js +6 -1
  12. package/dist/cjs/src/gate.js +2 -2
  13. package/dist/cjs/src/kraken.js +12 -10
  14. package/dist/cjs/src/kuna.js +0 -1
  15. package/dist/cjs/src/pro/binance.js +1 -1
  16. package/dist/cjs/src/pro/bybit.js +19 -0
  17. package/dist/cjs/src/pro/paradex.js +2 -0
  18. package/dist/cjs/src/pro/woo.js +1 -1
  19. package/dist/cjs/src/vertex.js +7 -4
  20. package/dist/cjs/src/woo.js +4 -0
  21. package/dist/cjs/src/woofipro.js +4 -0
  22. package/dist/cjs/src/xt.js +4 -1
  23. package/js/ccxt.d.ts +1 -1
  24. package/js/ccxt.js +1 -1
  25. package/js/src/base/Exchange.d.ts +2 -0
  26. package/js/src/base/Exchange.js +62 -40
  27. package/js/src/binance.js +2 -2
  28. package/js/src/bingx.js +0 -1
  29. package/js/src/bitget.js +1 -0
  30. package/js/src/bithumb.js +14 -14
  31. package/js/src/bitmart.js +4 -0
  32. package/js/src/bitteam.js +0 -1
  33. package/js/src/bybit.js +6 -1
  34. package/js/src/gate.js +2 -2
  35. package/js/src/kraken.js +12 -10
  36. package/js/src/kuna.js +0 -1
  37. package/js/src/pro/binance.js +1 -1
  38. package/js/src/pro/bybit.js +19 -0
  39. package/js/src/pro/paradex.js +2 -0
  40. package/js/src/pro/woo.js +1 -1
  41. package/js/src/vertex.js +7 -4
  42. package/js/src/woo.js +4 -0
  43. package/js/src/woofipro.js +4 -0
  44. package/js/src/xt.d.ts +4 -0
  45. package/js/src/xt.js +4 -1
  46. package/package.json +1 -1
package/dist/cjs/ccxt.js CHANGED
@@ -194,7 +194,7 @@ var xt$1 = require('./src/pro/xt.js');
194
194
 
195
195
  //-----------------------------------------------------------------------------
196
196
  // this is updated by vss.js when building
197
- const version = '4.3.76';
197
+ const version = '4.3.78';
198
198
  Exchange["default"].ccxtVersion = version;
199
199
  const exchanges = {
200
200
  'ace': ace,
@@ -2987,48 +2987,61 @@ class Exchange {
2987
2987
  }
2988
2988
  cost = Precise["default"].stringMul(multiplyPrice, amount);
2989
2989
  }
2990
- const parseFee = this.safeValue(trade, 'fee') === undefined;
2991
- const parseFees = this.safeValue(trade, 'fees') === undefined;
2992
- const shouldParseFees = parseFee || parseFees;
2993
- const fees = [];
2994
- const fee = this.safeValue(trade, 'fee');
2990
+ const [resultFee, resultFees] = this.parsedFeeAndFees(trade);
2991
+ trade['fee'] = resultFee;
2992
+ trade['fees'] = resultFees;
2993
+ trade['amount'] = this.parseNumber(amount);
2994
+ trade['price'] = this.parseNumber(price);
2995
+ trade['cost'] = this.parseNumber(cost);
2996
+ return trade;
2997
+ }
2998
+ parsedFeeAndFees(container) {
2999
+ let fee = this.safeDict(container, 'fee');
3000
+ let fees = this.safeList(container, 'fees');
3001
+ const feeDefined = fee !== undefined;
3002
+ const feesDefined = fees !== undefined;
3003
+ // parsing only if at least one of them is defined
3004
+ const shouldParseFees = (feeDefined || feesDefined);
2995
3005
  if (shouldParseFees) {
3006
+ if (feeDefined) {
3007
+ fee = this.parseFeeNumeric(fee);
3008
+ }
3009
+ if (!feesDefined) {
3010
+ // just set it directly, no further processing needed
3011
+ fees = [fee];
3012
+ }
3013
+ // 'fees' were set, so reparse them
2996
3014
  const reducedFees = this.reduceFees ? this.reduceFeesByCurrency(fees) : fees;
2997
3015
  const reducedLength = reducedFees.length;
2998
3016
  for (let i = 0; i < reducedLength; i++) {
2999
- reducedFees[i]['cost'] = this.safeNumber(reducedFees[i], 'cost');
3000
- if ('rate' in reducedFees[i]) {
3001
- reducedFees[i]['rate'] = this.safeNumber(reducedFees[i], 'rate');
3002
- }
3017
+ reducedFees[i] = this.parseFeeNumeric(reducedFees[i]);
3003
3018
  }
3004
- if (!parseFee && (reducedLength === 0)) {
3005
- // copy fee to avoid modification by reference
3006
- const feeCopy = this.deepExtend(fee);
3007
- feeCopy['cost'] = this.safeNumber(feeCopy, 'cost');
3008
- if ('rate' in feeCopy) {
3009
- feeCopy['rate'] = this.safeNumber(feeCopy, 'rate');
3010
- }
3011
- reducedFees.push(feeCopy);
3012
- }
3013
- if (parseFees) {
3014
- trade['fees'] = reducedFees;
3019
+ fees = reducedFees;
3020
+ if (reducedLength === 1) {
3021
+ fee = reducedFees[0];
3015
3022
  }
3016
- if (parseFee && (reducedLength === 1)) {
3017
- trade['fee'] = reducedFees[0];
3018
- }
3019
- const tradeFee = this.safeValue(trade, 'fee');
3020
- if (tradeFee !== undefined) {
3021
- tradeFee['cost'] = this.safeNumber(tradeFee, 'cost');
3022
- if ('rate' in tradeFee) {
3023
- tradeFee['rate'] = this.safeNumber(tradeFee, 'rate');
3024
- }
3025
- trade['fee'] = tradeFee;
3023
+ else if (reducedLength === 0) {
3024
+ fee = undefined;
3026
3025
  }
3027
3026
  }
3028
- trade['amount'] = this.parseNumber(amount);
3029
- trade['price'] = this.parseNumber(price);
3030
- trade['cost'] = this.parseNumber(cost);
3031
- return trade;
3027
+ // in case `fee & fees` are undefined, set `fees` as empty array
3028
+ if (fee === undefined) {
3029
+ fee = {
3030
+ 'cost': undefined,
3031
+ 'currency': undefined,
3032
+ };
3033
+ }
3034
+ if (fees === undefined) {
3035
+ fees = [];
3036
+ }
3037
+ return [fee, fees];
3038
+ }
3039
+ parseFeeNumeric(fee) {
3040
+ fee['cost'] = this.safeNumber(fee, 'cost'); // ensure numeric
3041
+ if ('rate' in fee) {
3042
+ fee['rate'] = this.safeNumber(fee, 'rate');
3043
+ }
3044
+ return fee;
3032
3045
  }
3033
3046
  findNearestCeiling(arr, providedValue) {
3034
3047
  // i.e. findNearestCeiling ([ 10, 30, 50], 23) returns 30
@@ -3102,12 +3115,13 @@ class Exchange {
3102
3115
  const reduced = {};
3103
3116
  for (let i = 0; i < fees.length; i++) {
3104
3117
  const fee = fees[i];
3105
- const feeCurrencyCode = this.safeString(fee, 'currency');
3118
+ const code = this.safeString(fee, 'currency');
3119
+ const feeCurrencyCode = code !== undefined ? code : i.toString();
3106
3120
  if (feeCurrencyCode !== undefined) {
3107
3121
  const rate = this.safeString(fee, 'rate');
3108
- const cost = this.safeValue(fee, 'cost');
3109
- if (Precise["default"].stringEq(cost, '0')) {
3110
- // omit zero cost fees
3122
+ const cost = this.safeString(fee, 'cost');
3123
+ if (cost === undefined) {
3124
+ // omit undefined cost, as it does not make sense, however, don't omit '0' costs, as they still make sense
3111
3125
  continue;
3112
3126
  }
3113
3127
  if (!(feeCurrencyCode in reduced)) {
@@ -3119,7 +3133,7 @@ class Exchange {
3119
3133
  }
3120
3134
  else {
3121
3135
  reduced[feeCurrencyCode][rateKey] = {
3122
- 'currency': feeCurrencyCode,
3136
+ 'currency': code,
3123
3137
  'cost': cost,
3124
3138
  };
3125
3139
  if (rate !== undefined) {
@@ -3160,7 +3174,15 @@ class Exchange {
3160
3174
  change = Precise["default"].stringSub(last, open);
3161
3175
  }
3162
3176
  if (average === undefined) {
3163
- average = Precise["default"].stringDiv(Precise["default"].stringAdd(last, open), '2');
3177
+ let precision = 18;
3178
+ if (market !== undefined && this.isTickPrecision()) {
3179
+ const marketPrecision = this.safeDict(market, 'precision');
3180
+ const precisionPrice = this.safeString(marketPrecision, 'price');
3181
+ if (precisionPrice !== undefined) {
3182
+ precision = this.precisionFromString(precisionPrice);
3183
+ }
3184
+ }
3185
+ average = Precise["default"].stringDiv(Precise["default"].stringAdd(last, open), '2', precision);
3164
3186
  }
3165
3187
  }
3166
3188
  if ((percentage === undefined) && (change !== undefined) && (open !== undefined) && Precise["default"].stringGt(open, '0')) {
@@ -2797,7 +2797,7 @@ class binance extends binance$1 {
2797
2797
  'active': depositEnable && withdrawEnable,
2798
2798
  'deposit': depositEnable,
2799
2799
  'withdraw': withdrawEnable,
2800
- 'fee': this.parseNumber(fee),
2800
+ 'fee': withdrawFee,
2801
2801
  'precision': this.parseNumber(precisionTick),
2802
2802
  'limits': {
2803
2803
  'withdraw': {
@@ -2805,7 +2805,7 @@ class binance extends binance$1 {
2805
2805
  'max': this.safeNumber(networkItem, 'withdrawMax'),
2806
2806
  },
2807
2807
  'deposit': {
2808
- 'min': undefined,
2808
+ 'min': this.safeNumber(networkItem, 'depositDust'),
2809
2809
  'max': undefined,
2810
2810
  },
2811
2811
  },
@@ -1209,7 +1209,6 @@ class bingx extends bingx$1 {
1209
1209
  'fee': {
1210
1210
  'cost': this.parseNumber(Precise["default"].stringAbs(this.safeString2(trade, 'commission', 'n'))),
1211
1211
  'currency': currencyCode,
1212
- 'rate': undefined,
1213
1212
  },
1214
1213
  }, market);
1215
1214
  }
@@ -1309,6 +1309,7 @@ class bitget extends bitget$1 {
1309
1309
  'JADE': 'Jade Protocol',
1310
1310
  'DEGEN': 'DegenReborn',
1311
1311
  'TONCOIN': 'TON',
1312
+ 'OMNI': 'omni', // conflict with Omni Network
1312
1313
  },
1313
1314
  'options': {
1314
1315
  'timeframes': {
@@ -198,7 +198,7 @@ class bithumb extends bithumb$1 {
198
198
  * @method
199
199
  * @name bithumb#fetchMarkets
200
200
  * @description retrieves data on all markets for bithumb
201
- * @see https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all
201
+ * @see https://apidocs.bithumb.com/v1.2.0/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all
202
202
  * @param {object} [params] extra parameters specific to the exchange API endpoint
203
203
  * @returns {object[]} an array of objects representing market data
204
204
  */
@@ -341,7 +341,7 @@ class bithumb extends bithumb$1 {
341
341
  * @method
342
342
  * @name bithumb#fetchBalance
343
343
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
344
- * @see https://apidocs.bithumb.com/reference/%EB%B3%B4%EC%9C%A0%EC%9E%90%EC%82%B0-%EC%A1%B0%ED%9A%8C
344
+ * @see https://apidocs.bithumb.com/v1.2.0/reference/%EB%B3%B4%EC%9C%A0%EC%9E%90%EC%82%B0-%EC%A1%B0%ED%9A%8C
345
345
  * @param {object} [params] extra parameters specific to the exchange API endpoint
346
346
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
347
347
  */
@@ -357,7 +357,7 @@ class bithumb extends bithumb$1 {
357
357
  * @method
358
358
  * @name bithumb#fetchOrderBook
359
359
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
360
- * @see https://apidocs.bithumb.com/reference/%ED%98%B8%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
360
+ * @see https://apidocs.bithumb.com/v1.2.0/reference/%ED%98%B8%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
361
361
  * @param {string} symbol unified symbol of the market to fetch the order book for
362
362
  * @param {int} [limit] the maximum amount of order book entries to return
363
363
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -450,7 +450,7 @@ class bithumb extends bithumb$1 {
450
450
  * @method
451
451
  * @name bithumb#fetchTickers
452
452
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
453
- * @see https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all
453
+ * @see https://apidocs.bithumb.com/v1.2.0/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all
454
454
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
455
455
  * @param {object} [params] extra parameters specific to the exchange API endpoint
456
456
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -512,7 +512,7 @@ class bithumb extends bithumb$1 {
512
512
  * @method
513
513
  * @name bithumb#fetchTicker
514
514
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
515
- * @see https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
515
+ * @see https://apidocs.bithumb.com/v1.2.0/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
516
516
  * @param {string} symbol unified symbol of the market to fetch the ticker for
517
517
  * @param {object} [params] extra parameters specific to the exchange API endpoint
518
518
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -571,7 +571,7 @@ class bithumb extends bithumb$1 {
571
571
  * @method
572
572
  * @name bithumb#fetchOHLCV
573
573
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
574
- * @see https://apidocs.bithumb.com/reference/candlestick-rest-api
574
+ * @see https://apidocs.bithumb.com/v1.2.0/reference/candlestick-rest-api
575
575
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
576
576
  * @param {string} timeframe the length of time each candle represents
577
577
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -696,7 +696,7 @@ class bithumb extends bithumb$1 {
696
696
  * @method
697
697
  * @name bithumb#fetchTrades
698
698
  * @description get the list of most recent trades for a particular symbol
699
- * @see https://apidocs.bithumb.com/reference/%EC%B5%9C%EA%B7%BC-%EC%B2%B4%EA%B2%B0-%EB%82%B4%EC%97%AD
699
+ * @see https://apidocs.bithumb.com/v1.2.0/reference/%EC%B5%9C%EA%B7%BC-%EC%B2%B4%EA%B2%B0-%EB%82%B4%EC%97%AD
700
700
  * @param {string} symbol unified symbol of the market to fetch trades for
701
701
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
702
702
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -735,9 +735,9 @@ class bithumb extends bithumb$1 {
735
735
  * @method
736
736
  * @name bithumb#createOrder
737
737
  * @description create a trade order
738
- * @see https://apidocs.bithumb.com/reference/%EC%A7%80%EC%A0%95%EA%B0%80-%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0
739
- * @see https://apidocs.bithumb.com/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EC%88%98%ED%95%98%EA%B8%B0
740
- * @see https://apidocs.bithumb.com/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EB%8F%84%ED%95%98%EA%B8%B0
738
+ * @see https://apidocs.bithumb.com/v1.2.0/reference/%EC%A7%80%EC%A0%95%EA%B0%80-%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0
739
+ * @see https://apidocs.bithumb.com/v1.2.0/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EC%88%98%ED%95%98%EA%B8%B0
740
+ * @see https://apidocs.bithumb.com/v1.2.0/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EB%8F%84%ED%95%98%EA%B8%B0
741
741
  * @param {string} symbol unified symbol of the market to create an order in
742
742
  * @param {string} type 'market' or 'limit'
743
743
  * @param {string} side 'buy' or 'sell'
@@ -779,7 +779,7 @@ class bithumb extends bithumb$1 {
779
779
  * @method
780
780
  * @name bithumb#fetchOrder
781
781
  * @description fetches information on an order made by the user
782
- * @see https://apidocs.bithumb.com/reference/%EA%B1%B0%EB%9E%98-%EC%A3%BC%EB%AC%B8%EB%82%B4%EC%97%AD-%EC%83%81%EC%84%B8-%EC%A1%B0%ED%9A%8C
782
+ * @see https://apidocs.bithumb.com/v1.2.0/reference/%EA%B1%B0%EB%9E%98-%EC%A3%BC%EB%AC%B8%EB%82%B4%EC%97%AD-%EC%83%81%EC%84%B8-%EC%A1%B0%ED%9A%8C
783
783
  * @param {string} symbol unified symbol of the market the order was made in
784
784
  * @param {object} [params] extra parameters specific to the exchange API endpoint
785
785
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -938,7 +938,7 @@ class bithumb extends bithumb$1 {
938
938
  * @method
939
939
  * @name bithumb#fetchOpenOrders
940
940
  * @description fetch all unfilled currently open orders
941
- * @see https://apidocs.bithumb.com/reference/%EA%B1%B0%EB%9E%98-%EC%A3%BC%EB%AC%B8%EB%82%B4%EC%97%AD-%EC%A1%B0%ED%9A%8C
941
+ * @see https://apidocs.bithumb.com/v1.2.0/reference/%EA%B1%B0%EB%9E%98-%EC%A3%BC%EB%AC%B8%EB%82%B4%EC%97%AD-%EC%A1%B0%ED%9A%8C
942
942
  * @param {string} symbol unified market symbol
943
943
  * @param {int} [since] the earliest time in ms to fetch open orders for
944
944
  * @param {int} [limit] the maximum number of open order structures to retrieve
@@ -987,7 +987,7 @@ class bithumb extends bithumb$1 {
987
987
  * @method
988
988
  * @name bithumb#cancelOrder
989
989
  * @description cancels an open order
990
- * @see https://apidocs.bithumb.com/reference/%EC%A3%BC%EB%AC%B8-%EC%B7%A8%EC%86%8C%ED%95%98%EA%B8%B0
990
+ * @see https://apidocs.bithumb.com/v1.2.0/reference/%EC%A3%BC%EB%AC%B8-%EC%B7%A8%EC%86%8C%ED%95%98%EA%B8%B0
991
991
  * @param {string} id order id
992
992
  * @param {string} symbol unified symbol of the market the order was made in
993
993
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1031,7 +1031,7 @@ class bithumb extends bithumb$1 {
1031
1031
  * @method
1032
1032
  * @name bithumb#withdraw
1033
1033
  * @description make a withdrawal
1034
- * @see https://apidocs.bithumb.com/reference/%EC%BD%94%EC%9D%B8-%EC%B6%9C%EA%B8%88%ED%95%98%EA%B8%B0-%EA%B0%9C%EC%9D%B8
1034
+ * @see https://apidocs.bithumb.com/v1.2.0/reference/%EC%BD%94%EC%9D%B8-%EC%B6%9C%EA%B8%88%ED%95%98%EA%B8%B0-%EA%B0%9C%EC%9D%B8
1035
1035
  * @param {string} code unified currency code
1036
1036
  * @param {float} amount the amount to withdraw
1037
1037
  * @param {string} address the address to withdraw to
@@ -2463,6 +2463,7 @@ class bitmart extends bitmart$1 {
2463
2463
  * @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
2464
2464
  * @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
2465
2465
  * @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
2466
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
2466
2467
  * @param {string} symbol unified symbol of the market to create an order in
2467
2468
  * @param {string} type 'market', 'limit' or 'trailing' for swap markets only
2468
2469
  * @param {string} side 'buy' or 'sell'
@@ -2716,6 +2717,9 @@ class bitmart extends bitmart$1 {
2716
2717
  if (leverage !== undefined) {
2717
2718
  request['leverage'] = this.numberToString(leverage);
2718
2719
  }
2720
+ else if (isTriggerOrder) {
2721
+ request['leverage'] = '1'; // for plan orders leverage is required, if not available default to 1
2722
+ }
2719
2723
  return this.extend(request, params);
2720
2724
  }
2721
2725
  createSpotOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
@@ -1937,7 +1937,6 @@ class bitteam extends bitteam$1 {
1937
1937
  const fee = {
1938
1938
  'currency': this.safeCurrencyCode(feeCurrencyId),
1939
1939
  'cost': feeCost,
1940
- 'rate': undefined,
1941
1940
  };
1942
1941
  const intTs = this.parseToInt(timestamp);
1943
1942
  return this.safeTrade({
@@ -3786,7 +3786,12 @@ class bybit extends bybit$1 {
3786
3786
  }
3787
3787
  else {
3788
3788
  if (!isTrailingAmountOrder && !isAlternativeEndpoint) {
3789
- request['qty'] = this.amountToPrecision(symbol, amount);
3789
+ if (market['option']) {
3790
+ request['qty'] = this.numberToString(amount);
3791
+ }
3792
+ else {
3793
+ request['qty'] = this.amountToPrecision(symbol, amount);
3794
+ }
3790
3795
  }
3791
3796
  }
3792
3797
  if (isTrailingAmountOrder) {
@@ -3467,8 +3467,8 @@ class gate extends gate$1 {
3467
3467
  const side = this.safeString2(trade, 'side', 'type', contractSide);
3468
3468
  const orderId = this.safeString(trade, 'order_id');
3469
3469
  const feeAmount = this.safeString(trade, 'fee');
3470
- const gtFee = this.safeString(trade, 'gt_fee');
3471
- const pointFee = this.safeString(trade, 'point_fee');
3470
+ const gtFee = this.omitZero(this.safeString(trade, 'gt_fee'));
3471
+ const pointFee = this.omitZero(this.safeString(trade, 'point_fee'));
3472
3472
  const fees = [];
3473
3473
  if (feeAmount !== undefined) {
3474
3474
  const feeCurrencyId = this.safeString(trade, 'fee_currency');
@@ -1382,7 +1382,7 @@ class kraken extends kraken$1 {
1382
1382
  * @method
1383
1383
  * @name kraken#createMarketOrderWithCost
1384
1384
  * @description create a market order by providing the symbol, side and cost
1385
- * @see https://docs.kraken.com/rest/#tag/Trading/operation/addOrder
1385
+ * @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/addOrder
1386
1386
  * @param {string} symbol unified symbol of the market to create an order in (only USD markets are supported)
1387
1387
  * @param {string} side 'buy' or 'sell'
1388
1388
  * @param {float} cost how much you want to trade in units of the quote currency
@@ -1399,7 +1399,7 @@ class kraken extends kraken$1 {
1399
1399
  * @method
1400
1400
  * @name kraken#createMarketBuyOrderWithCost
1401
1401
  * @description create a market buy order by providing the symbol, side and cost
1402
- * @see https://docs.kraken.com/rest/#tag/Trading/operation/addOrder
1402
+ * @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/addOrder
1403
1403
  * @param {string} symbol unified symbol of the market to create an order in
1404
1404
  * @param {float} cost how much you want to trade in units of the quote currency
1405
1405
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1412,7 +1412,7 @@ class kraken extends kraken$1 {
1412
1412
  /**
1413
1413
  * @method
1414
1414
  * @name kraken#createOrder
1415
- * @see https://docs.kraken.com/rest/#tag/Trading/operation/addOrder
1415
+ * @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/addOrder
1416
1416
  * @description create a trade order
1417
1417
  * @param {string} symbol unified symbol of the market to create an order in
1418
1418
  * @param {string} type 'market' or 'limit'
@@ -1551,6 +1551,8 @@ class kraken extends kraken$1 {
1551
1551
  // "status": "ok",
1552
1552
  // "txid": "OAW2BO-7RWEK-PZY5UO",
1553
1553
  // "originaltxid": "OXL6SS-UPNMC-26WBE7",
1554
+ // "newuserref": 1234,
1555
+ // "olduserref": 123,
1554
1556
  // "volume": "0.00075000",
1555
1557
  // "price": "13500.0",
1556
1558
  // "orders_cancelled": 1,
@@ -1694,7 +1696,7 @@ class kraken extends kraken$1 {
1694
1696
  const txid = this.safeList(order, 'txid');
1695
1697
  id = this.safeString(txid, 0);
1696
1698
  }
1697
- const clientOrderId = this.safeString(order, 'userref');
1699
+ const clientOrderId = this.safeString2(order, 'userref', 'newuserref');
1698
1700
  const rawTrades = this.safeValue(order, 'trades', []);
1699
1701
  const trades = [];
1700
1702
  for (let i = 0; i < rawTrades.length; i++) {
@@ -1850,6 +1852,9 @@ class kraken extends kraken$1 {
1850
1852
  const extendedPostFlags = (flags !== undefined) ? flags + ',post' : 'post';
1851
1853
  request['oflags'] = extendedPostFlags;
1852
1854
  }
1855
+ if ((flags !== undefined) && !('oflags' in request)) {
1856
+ request['oflags'] = flags;
1857
+ }
1853
1858
  params = this.omit(params, ['timeInForce', 'reduceOnly', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingLimitAmount', 'offset']);
1854
1859
  return [request, params];
1855
1860
  }
@@ -1858,7 +1863,7 @@ class kraken extends kraken$1 {
1858
1863
  * @method
1859
1864
  * @name kraken#editOrder
1860
1865
  * @description edit a trade order
1861
- * @see https://docs.kraken.com/rest/#tag/Trading/operation/editOrder
1866
+ * @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/editOrder
1862
1867
  * @param {string} id order id
1863
1868
  * @param {string} symbol unified symbol of the market to create an order in
1864
1869
  * @param {string} type 'market' or 'limit'
@@ -1920,8 +1925,8 @@ class kraken extends kraken$1 {
1920
1925
  await this.loadMarkets();
1921
1926
  const clientOrderId = this.safeValue2(params, 'userref', 'clientOrderId');
1922
1927
  const request = {
1923
- 'trades': true, // whether or not to include trades in output (optional, default false)
1924
- // 'txid': id, // do not comma separate a list of ids - use fetchOrdersByIds instead
1928
+ 'trades': true,
1929
+ 'txid': id, // do not comma separate a list of ids - use fetchOrdersByIds instead
1925
1930
  // 'userref': 'optional', // restrict results to given user reference id (optional)
1926
1931
  };
1927
1932
  let query = params;
@@ -1929,9 +1934,6 @@ class kraken extends kraken$1 {
1929
1934
  request['userref'] = clientOrderId;
1930
1935
  query = this.omit(params, ['userref', 'clientOrderId']);
1931
1936
  }
1932
- else {
1933
- request['txid'] = id;
1934
- }
1935
1937
  const response = await this.privatePostQueryOrders(this.extend(request, query));
1936
1938
  //
1937
1939
  // {
@@ -885,7 +885,6 @@ class kuna extends kuna$1 {
885
885
  'fee': {
886
886
  'cost': this.safeString(trade, 'fee'),
887
887
  'currency': this.safeCurrencyCode(this.safeString(trade, 'feeCurrency')),
888
- 'rate': undefined,
889
888
  },
890
889
  }, market);
891
890
  }
@@ -203,7 +203,7 @@ class binance extends binance$1 {
203
203
  * @param {object} [params] exchange specific parameters for the bitmex api endpoint
204
204
  * @returns {object} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
205
205
  */
206
- return this.watchLiquidationsForSymbols([symbol], since, limit, params);
206
+ return await this.watchLiquidationsForSymbols([symbol], since, limit, params);
207
207
  }
208
208
  async watchLiquidationsForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
209
209
  /**
@@ -77,6 +77,25 @@ class bybit extends bybit$1 {
77
77
  },
78
78
  },
79
79
  },
80
+ 'demotrading': {
81
+ 'ws': {
82
+ 'public': {
83
+ 'spot': 'wss://stream.{hostname}/v5/public/spot',
84
+ 'inverse': 'wss://stream.{hostname}/v5/public/inverse',
85
+ 'option': 'wss://stream.{hostname}/v5/public/option',
86
+ 'linear': 'wss://stream.{hostname}/v5/public/linear',
87
+ },
88
+ 'private': {
89
+ 'spot': {
90
+ 'unified': 'wss://stream-demo.{hostname}/v5/private',
91
+ 'nonUnified': 'wss://stream-demo.{hostname}/spot/private/v3',
92
+ },
93
+ 'contract': 'wss://stream-demo.{hostname}/v5/private',
94
+ 'usdc': 'wss://stream-demo.{hostname}/trade/option/usdc/private/v1',
95
+ 'trade': 'wss://stream-demo.bybit.com/v5/trade',
96
+ },
97
+ },
98
+ },
80
99
  },
81
100
  'options': {
82
101
  'watchTicker': {
@@ -114,6 +114,7 @@ class paradex extends paradex$1 {
114
114
  * @param {object} [params] extra parameters specific to the exchange API endpoint
115
115
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
116
116
  */
117
+ await this.loadMarkets();
117
118
  const market = this.market(symbol);
118
119
  const messageHash = 'order_book.' + market['id'] + '.snapshot@15@100ms';
119
120
  const url = this.urls['api']['ws'];
@@ -223,6 +224,7 @@ class paradex extends paradex$1 {
223
224
  * @param {object} [params] extra parameters specific to the exchange API endpoint
224
225
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
225
226
  */
227
+ await this.loadMarkets();
226
228
  symbols = this.marketSymbols(symbols);
227
229
  const channel = 'markets_summary';
228
230
  const url = this.urls['api']['ws'];
@@ -643,7 +643,7 @@ class woo extends woo$1 {
643
643
  },
644
644
  };
645
645
  const message = this.extend(request, params);
646
- this.watch(url, messageHash, message, messageHash);
646
+ this.watch(url, messageHash, message, messageHash, message);
647
647
  }
648
648
  return await future;
649
649
  }
@@ -665,6 +665,13 @@ class vertex extends vertex$1 {
665
665
  let amount = undefined;
666
666
  let side = undefined;
667
667
  let fee = undefined;
668
+ const feeCost = this.convertFromX18(this.safeString(trade, 'fee'));
669
+ if (feeCost !== undefined) {
670
+ fee = {
671
+ 'cost': feeCost,
672
+ 'currency': undefined,
673
+ };
674
+ }
668
675
  const id = this.safeString2(trade, 'trade_id', 'submission_idx');
669
676
  const order = this.safeString(trade, 'digest');
670
677
  const timestamp = this.safeTimestamp(trade, 'timestamp');
@@ -682,10 +689,6 @@ class vertex extends vertex$1 {
682
689
  const subOrder = this.safeDict(trade, 'order', {});
683
690
  price = this.convertFromX18(this.safeString(subOrder, 'priceX18'));
684
691
  amount = this.convertFromX18(this.safeString(trade, 'base_filled'));
685
- fee = {
686
- 'cost': this.convertFromX18(this.safeString(trade, 'fee')),
687
- 'currency': undefined,
688
- };
689
692
  if (Precise["default"].stringLt(amount, '0')) {
690
693
  side = 'sell';
691
694
  }
@@ -607,6 +607,10 @@ class woo extends woo$1 {
607
607
  const amount = this.safeString(trade, 'executed_quantity');
608
608
  const order_id = this.safeString(trade, 'order_id');
609
609
  const fee = this.parseTokenAndFeeTemp(trade, 'fee_asset', 'fee');
610
+ const feeCost = this.safeString(fee, 'cost');
611
+ if (feeCost !== undefined) {
612
+ fee['cost'] = feeCost;
613
+ }
610
614
  const cost = Precise["default"].stringMul(price, amount);
611
615
  const side = this.safeStringLower(trade, 'side');
612
616
  const id = this.safeString(trade, 'id');
@@ -680,6 +680,10 @@ class woofipro extends woofipro$1 {
680
680
  const amount = this.safeString(trade, 'executed_quantity');
681
681
  const order_id = this.safeString(trade, 'order_id');
682
682
  const fee = this.parseTokenAndFeeTemp(trade, 'fee_asset', 'fee');
683
+ const feeCost = this.safeString(fee, 'cost');
684
+ if (feeCost !== undefined) {
685
+ fee['cost'] = feeCost;
686
+ }
683
687
  const cost = Precise["default"].stringMul(price, amount);
684
688
  const side = this.safeStringLower(trade, 'side');
685
689
  const id = this.safeString(trade, 'id');
@@ -8,6 +8,10 @@ var sha256 = require('./static_dependencies/noble-hashes/sha256.js');
8
8
 
9
9
  // ---------------------------------------------------------------------------
10
10
  // ---------------------------------------------------------------------------
11
+ /**
12
+ * @class xt
13
+ * @augments Exchange
14
+ */
11
15
  class xt extends xt$1 {
12
16
  describe() {
13
17
  return this.deepExtend(super.describe(), {
@@ -2102,7 +2106,6 @@ class xt extends xt$1 {
2102
2106
  'fee': {
2103
2107
  'currency': this.safeCurrencyCode(this.safeString2(trade, 'feeCurrency', 'feeCoin')),
2104
2108
  'cost': this.safeString(trade, 'fee'),
2105
- 'rate': undefined,
2106
2109
  },
2107
2110
  }, market);
2108
2111
  }
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, LeverageTiers } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending } from './src/base/errors.js';
7
- declare const version = "4.3.75";
7
+ declare const version = "4.3.77";
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, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.3.76';
41
+ const version = '4.3.78';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -844,6 +844,8 @@ export default class Exchange {
844
844
  };
845
845
  safeLiquidation(liquidation: Dict, market?: Market): Liquidation;
846
846
  safeTrade(trade: Dict, market?: Market): Trade;
847
+ parsedFeeAndFees(container: any): Dictionary<any>[];
848
+ parseFeeNumeric(fee: any): any;
847
849
  findNearestCeiling(arr: number[], providedValue: number): number;
848
850
  invertFlatStringDictionary(dict: any): {};
849
851
  reduceFeesByCurrency(fees: any): any[];