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
@@ -2970,48 +2970,61 @@ export default class Exchange {
2970
2970
  }
2971
2971
  cost = Precise.stringMul(multiplyPrice, amount);
2972
2972
  }
2973
- const parseFee = this.safeValue(trade, 'fee') === undefined;
2974
- const parseFees = this.safeValue(trade, 'fees') === undefined;
2975
- const shouldParseFees = parseFee || parseFees;
2976
- const fees = [];
2977
- const fee = this.safeValue(trade, 'fee');
2973
+ const [resultFee, resultFees] = this.parsedFeeAndFees(trade);
2974
+ trade['fee'] = resultFee;
2975
+ trade['fees'] = resultFees;
2976
+ trade['amount'] = this.parseNumber(amount);
2977
+ trade['price'] = this.parseNumber(price);
2978
+ trade['cost'] = this.parseNumber(cost);
2979
+ return trade;
2980
+ }
2981
+ parsedFeeAndFees(container) {
2982
+ let fee = this.safeDict(container, 'fee');
2983
+ let fees = this.safeList(container, 'fees');
2984
+ const feeDefined = fee !== undefined;
2985
+ const feesDefined = fees !== undefined;
2986
+ // parsing only if at least one of them is defined
2987
+ const shouldParseFees = (feeDefined || feesDefined);
2978
2988
  if (shouldParseFees) {
2989
+ if (feeDefined) {
2990
+ fee = this.parseFeeNumeric(fee);
2991
+ }
2992
+ if (!feesDefined) {
2993
+ // just set it directly, no further processing needed
2994
+ fees = [fee];
2995
+ }
2996
+ // 'fees' were set, so reparse them
2979
2997
  const reducedFees = this.reduceFees ? this.reduceFeesByCurrency(fees) : fees;
2980
2998
  const reducedLength = reducedFees.length;
2981
2999
  for (let i = 0; i < reducedLength; i++) {
2982
- reducedFees[i]['cost'] = this.safeNumber(reducedFees[i], 'cost');
2983
- if ('rate' in reducedFees[i]) {
2984
- reducedFees[i]['rate'] = this.safeNumber(reducedFees[i], 'rate');
2985
- }
3000
+ reducedFees[i] = this.parseFeeNumeric(reducedFees[i]);
2986
3001
  }
2987
- if (!parseFee && (reducedLength === 0)) {
2988
- // copy fee to avoid modification by reference
2989
- const feeCopy = this.deepExtend(fee);
2990
- feeCopy['cost'] = this.safeNumber(feeCopy, 'cost');
2991
- if ('rate' in feeCopy) {
2992
- feeCopy['rate'] = this.safeNumber(feeCopy, 'rate');
2993
- }
2994
- reducedFees.push(feeCopy);
2995
- }
2996
- if (parseFees) {
2997
- trade['fees'] = reducedFees;
3002
+ fees = reducedFees;
3003
+ if (reducedLength === 1) {
3004
+ fee = reducedFees[0];
2998
3005
  }
2999
- if (parseFee && (reducedLength === 1)) {
3000
- trade['fee'] = reducedFees[0];
3001
- }
3002
- const tradeFee = this.safeValue(trade, 'fee');
3003
- if (tradeFee !== undefined) {
3004
- tradeFee['cost'] = this.safeNumber(tradeFee, 'cost');
3005
- if ('rate' in tradeFee) {
3006
- tradeFee['rate'] = this.safeNumber(tradeFee, 'rate');
3007
- }
3008
- trade['fee'] = tradeFee;
3006
+ else if (reducedLength === 0) {
3007
+ fee = undefined;
3009
3008
  }
3010
3009
  }
3011
- trade['amount'] = this.parseNumber(amount);
3012
- trade['price'] = this.parseNumber(price);
3013
- trade['cost'] = this.parseNumber(cost);
3014
- return trade;
3010
+ // in case `fee & fees` are undefined, set `fees` as empty array
3011
+ if (fee === undefined) {
3012
+ fee = {
3013
+ 'cost': undefined,
3014
+ 'currency': undefined,
3015
+ };
3016
+ }
3017
+ if (fees === undefined) {
3018
+ fees = [];
3019
+ }
3020
+ return [fee, fees];
3021
+ }
3022
+ parseFeeNumeric(fee) {
3023
+ fee['cost'] = this.safeNumber(fee, 'cost'); // ensure numeric
3024
+ if ('rate' in fee) {
3025
+ fee['rate'] = this.safeNumber(fee, 'rate');
3026
+ }
3027
+ return fee;
3015
3028
  }
3016
3029
  findNearestCeiling(arr, providedValue) {
3017
3030
  // i.e. findNearestCeiling ([ 10, 30, 50], 23) returns 30
@@ -3085,12 +3098,13 @@ export default class Exchange {
3085
3098
  const reduced = {};
3086
3099
  for (let i = 0; i < fees.length; i++) {
3087
3100
  const fee = fees[i];
3088
- const feeCurrencyCode = this.safeString(fee, 'currency');
3101
+ const code = this.safeString(fee, 'currency');
3102
+ const feeCurrencyCode = code !== undefined ? code : i.toString();
3089
3103
  if (feeCurrencyCode !== undefined) {
3090
3104
  const rate = this.safeString(fee, 'rate');
3091
- const cost = this.safeValue(fee, 'cost');
3092
- if (Precise.stringEq(cost, '0')) {
3093
- // omit zero cost fees
3105
+ const cost = this.safeString(fee, 'cost');
3106
+ if (cost === undefined) {
3107
+ // omit undefined cost, as it does not make sense, however, don't omit '0' costs, as they still make sense
3094
3108
  continue;
3095
3109
  }
3096
3110
  if (!(feeCurrencyCode in reduced)) {
@@ -3102,7 +3116,7 @@ export default class Exchange {
3102
3116
  }
3103
3117
  else {
3104
3118
  reduced[feeCurrencyCode][rateKey] = {
3105
- 'currency': feeCurrencyCode,
3119
+ 'currency': code,
3106
3120
  'cost': cost,
3107
3121
  };
3108
3122
  if (rate !== undefined) {
@@ -3143,7 +3157,15 @@ export default class Exchange {
3143
3157
  change = Precise.stringSub(last, open);
3144
3158
  }
3145
3159
  if (average === undefined) {
3146
- average = Precise.stringDiv(Precise.stringAdd(last, open), '2');
3160
+ let precision = 18;
3161
+ if (market !== undefined && this.isTickPrecision()) {
3162
+ const marketPrecision = this.safeDict(market, 'precision');
3163
+ const precisionPrice = this.safeString(marketPrecision, 'price');
3164
+ if (precisionPrice !== undefined) {
3165
+ precision = this.precisionFromString(precisionPrice);
3166
+ }
3167
+ }
3168
+ average = Precise.stringDiv(Precise.stringAdd(last, open), '2', precision);
3147
3169
  }
3148
3170
  }
3149
3171
  if ((percentage === undefined) && (change !== undefined) && (open !== undefined) && Precise.stringGt(open, '0')) {
package/js/src/binance.js CHANGED
@@ -2800,7 +2800,7 @@ export default class binance extends Exchange {
2800
2800
  'active': depositEnable && withdrawEnable,
2801
2801
  'deposit': depositEnable,
2802
2802
  'withdraw': withdrawEnable,
2803
- 'fee': this.parseNumber(fee),
2803
+ 'fee': withdrawFee,
2804
2804
  'precision': this.parseNumber(precisionTick),
2805
2805
  'limits': {
2806
2806
  'withdraw': {
@@ -2808,7 +2808,7 @@ export default class binance extends Exchange {
2808
2808
  'max': this.safeNumber(networkItem, 'withdrawMax'),
2809
2809
  },
2810
2810
  'deposit': {
2811
- 'min': undefined,
2811
+ 'min': this.safeNumber(networkItem, 'depositDust'),
2812
2812
  'max': undefined,
2813
2813
  },
2814
2814
  },
package/js/src/bingx.js CHANGED
@@ -1212,7 +1212,6 @@ export default class bingx extends Exchange {
1212
1212
  'fee': {
1213
1213
  'cost': this.parseNumber(Precise.stringAbs(this.safeString2(trade, 'commission', 'n'))),
1214
1214
  'currency': currencyCode,
1215
- 'rate': undefined,
1216
1215
  },
1217
1216
  }, market);
1218
1217
  }
package/js/src/bitget.js CHANGED
@@ -1312,6 +1312,7 @@ export default class bitget extends Exchange {
1312
1312
  'JADE': 'Jade Protocol',
1313
1313
  'DEGEN': 'DegenReborn',
1314
1314
  'TONCOIN': 'TON',
1315
+ 'OMNI': 'omni', // conflict with Omni Network
1315
1316
  },
1316
1317
  'options': {
1317
1318
  'timeframes': {
package/js/src/bithumb.js CHANGED
@@ -201,7 +201,7 @@ export default class bithumb extends Exchange {
201
201
  * @method
202
202
  * @name bithumb#fetchMarkets
203
203
  * @description retrieves data on all markets for bithumb
204
- * @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
204
+ * @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
205
205
  * @param {object} [params] extra parameters specific to the exchange API endpoint
206
206
  * @returns {object[]} an array of objects representing market data
207
207
  */
@@ -344,7 +344,7 @@ export default class bithumb extends Exchange {
344
344
  * @method
345
345
  * @name bithumb#fetchBalance
346
346
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
347
- * @see https://apidocs.bithumb.com/reference/%EB%B3%B4%EC%9C%A0%EC%9E%90%EC%82%B0-%EC%A1%B0%ED%9A%8C
347
+ * @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
348
348
  * @param {object} [params] extra parameters specific to the exchange API endpoint
349
349
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
350
350
  */
@@ -360,7 +360,7 @@ export default class bithumb extends Exchange {
360
360
  * @method
361
361
  * @name bithumb#fetchOrderBook
362
362
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
363
- * @see https://apidocs.bithumb.com/reference/%ED%98%B8%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
363
+ * @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
364
364
  * @param {string} symbol unified symbol of the market to fetch the order book for
365
365
  * @param {int} [limit] the maximum amount of order book entries to return
366
366
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -453,7 +453,7 @@ export default class bithumb extends Exchange {
453
453
  * @method
454
454
  * @name bithumb#fetchTickers
455
455
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
456
- * @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
456
+ * @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
457
457
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
458
458
  * @param {object} [params] extra parameters specific to the exchange API endpoint
459
459
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -515,7 +515,7 @@ export default class bithumb extends Exchange {
515
515
  * @method
516
516
  * @name bithumb#fetchTicker
517
517
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
518
- * @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
518
+ * @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
519
519
  * @param {string} symbol unified symbol of the market to fetch the ticker for
520
520
  * @param {object} [params] extra parameters specific to the exchange API endpoint
521
521
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -574,7 +574,7 @@ export default class bithumb extends Exchange {
574
574
  * @method
575
575
  * @name bithumb#fetchOHLCV
576
576
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
577
- * @see https://apidocs.bithumb.com/reference/candlestick-rest-api
577
+ * @see https://apidocs.bithumb.com/v1.2.0/reference/candlestick-rest-api
578
578
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
579
579
  * @param {string} timeframe the length of time each candle represents
580
580
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -699,7 +699,7 @@ export default class bithumb extends Exchange {
699
699
  * @method
700
700
  * @name bithumb#fetchTrades
701
701
  * @description get the list of most recent trades for a particular symbol
702
- * @see https://apidocs.bithumb.com/reference/%EC%B5%9C%EA%B7%BC-%EC%B2%B4%EA%B2%B0-%EB%82%B4%EC%97%AD
702
+ * @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
703
703
  * @param {string} symbol unified symbol of the market to fetch trades for
704
704
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
705
705
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -738,9 +738,9 @@ export default class bithumb extends Exchange {
738
738
  * @method
739
739
  * @name bithumb#createOrder
740
740
  * @description create a trade order
741
- * @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
742
- * @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
743
- * @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
741
+ * @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
742
+ * @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
743
+ * @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
744
744
  * @param {string} symbol unified symbol of the market to create an order in
745
745
  * @param {string} type 'market' or 'limit'
746
746
  * @param {string} side 'buy' or 'sell'
@@ -782,7 +782,7 @@ export default class bithumb extends Exchange {
782
782
  * @method
783
783
  * @name bithumb#fetchOrder
784
784
  * @description fetches information on an order made by the user
785
- * @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
785
+ * @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
786
786
  * @param {string} symbol unified symbol of the market the order was made in
787
787
  * @param {object} [params] extra parameters specific to the exchange API endpoint
788
788
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -941,7 +941,7 @@ export default class bithumb extends Exchange {
941
941
  * @method
942
942
  * @name bithumb#fetchOpenOrders
943
943
  * @description fetch all unfilled currently open orders
944
- * @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
944
+ * @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
945
945
  * @param {string} symbol unified market symbol
946
946
  * @param {int} [since] the earliest time in ms to fetch open orders for
947
947
  * @param {int} [limit] the maximum number of open order structures to retrieve
@@ -990,7 +990,7 @@ export default class bithumb extends Exchange {
990
990
  * @method
991
991
  * @name bithumb#cancelOrder
992
992
  * @description cancels an open order
993
- * @see https://apidocs.bithumb.com/reference/%EC%A3%BC%EB%AC%B8-%EC%B7%A8%EC%86%8C%ED%95%98%EA%B8%B0
993
+ * @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
994
994
  * @param {string} id order id
995
995
  * @param {string} symbol unified symbol of the market the order was made in
996
996
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1034,7 +1034,7 @@ export default class bithumb extends Exchange {
1034
1034
  * @method
1035
1035
  * @name bithumb#withdraw
1036
1036
  * @description make a withdrawal
1037
- * @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
1037
+ * @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
1038
1038
  * @param {string} code unified currency code
1039
1039
  * @param {float} amount the amount to withdraw
1040
1040
  * @param {string} address the address to withdraw to
package/js/src/bitmart.js CHANGED
@@ -2466,6 +2466,7 @@ export default class bitmart extends Exchange {
2466
2466
  * @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
2467
2467
  * @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
2468
2468
  * @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
2469
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
2469
2470
  * @param {string} symbol unified symbol of the market to create an order in
2470
2471
  * @param {string} type 'market', 'limit' or 'trailing' for swap markets only
2471
2472
  * @param {string} side 'buy' or 'sell'
@@ -2719,6 +2720,9 @@ export default class bitmart extends Exchange {
2719
2720
  if (leverage !== undefined) {
2720
2721
  request['leverage'] = this.numberToString(leverage);
2721
2722
  }
2723
+ else if (isTriggerOrder) {
2724
+ request['leverage'] = '1'; // for plan orders leverage is required, if not available default to 1
2725
+ }
2722
2726
  return this.extend(request, params);
2723
2727
  }
2724
2728
  createSpotOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
package/js/src/bitteam.js CHANGED
@@ -1940,7 +1940,6 @@ export default class bitteam extends Exchange {
1940
1940
  const fee = {
1941
1941
  'currency': this.safeCurrencyCode(feeCurrencyId),
1942
1942
  'cost': feeCost,
1943
- 'rate': undefined,
1944
1943
  };
1945
1944
  const intTs = this.parseToInt(timestamp);
1946
1945
  return this.safeTrade({
package/js/src/bybit.js CHANGED
@@ -3789,7 +3789,12 @@ export default class bybit extends Exchange {
3789
3789
  }
3790
3790
  else {
3791
3791
  if (!isTrailingAmountOrder && !isAlternativeEndpoint) {
3792
- request['qty'] = this.amountToPrecision(symbol, amount);
3792
+ if (market['option']) {
3793
+ request['qty'] = this.numberToString(amount);
3794
+ }
3795
+ else {
3796
+ request['qty'] = this.amountToPrecision(symbol, amount);
3797
+ }
3793
3798
  }
3794
3799
  }
3795
3800
  if (isTrailingAmountOrder) {
package/js/src/gate.js CHANGED
@@ -3470,8 +3470,8 @@ export default class gate extends Exchange {
3470
3470
  const side = this.safeString2(trade, 'side', 'type', contractSide);
3471
3471
  const orderId = this.safeString(trade, 'order_id');
3472
3472
  const feeAmount = this.safeString(trade, 'fee');
3473
- const gtFee = this.safeString(trade, 'gt_fee');
3474
- const pointFee = this.safeString(trade, 'point_fee');
3473
+ const gtFee = this.omitZero(this.safeString(trade, 'gt_fee'));
3474
+ const pointFee = this.omitZero(this.safeString(trade, 'point_fee'));
3475
3475
  const fees = [];
3476
3476
  if (feeAmount !== undefined) {
3477
3477
  const feeCurrencyId = this.safeString(trade, 'fee_currency');
package/js/src/kraken.js CHANGED
@@ -1385,7 +1385,7 @@ export default class kraken extends Exchange {
1385
1385
  * @method
1386
1386
  * @name kraken#createMarketOrderWithCost
1387
1387
  * @description create a market order by providing the symbol, side and cost
1388
- * @see https://docs.kraken.com/rest/#tag/Trading/operation/addOrder
1388
+ * @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/addOrder
1389
1389
  * @param {string} symbol unified symbol of the market to create an order in (only USD markets are supported)
1390
1390
  * @param {string} side 'buy' or 'sell'
1391
1391
  * @param {float} cost how much you want to trade in units of the quote currency
@@ -1402,7 +1402,7 @@ export default class kraken extends Exchange {
1402
1402
  * @method
1403
1403
  * @name kraken#createMarketBuyOrderWithCost
1404
1404
  * @description create a market buy order by providing the symbol, side and cost
1405
- * @see https://docs.kraken.com/rest/#tag/Trading/operation/addOrder
1405
+ * @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/addOrder
1406
1406
  * @param {string} symbol unified symbol of the market to create an order in
1407
1407
  * @param {float} cost how much you want to trade in units of the quote currency
1408
1408
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1415,7 +1415,7 @@ export default class kraken extends Exchange {
1415
1415
  /**
1416
1416
  * @method
1417
1417
  * @name kraken#createOrder
1418
- * @see https://docs.kraken.com/rest/#tag/Trading/operation/addOrder
1418
+ * @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/addOrder
1419
1419
  * @description create a trade order
1420
1420
  * @param {string} symbol unified symbol of the market to create an order in
1421
1421
  * @param {string} type 'market' or 'limit'
@@ -1554,6 +1554,8 @@ export default class kraken extends Exchange {
1554
1554
  // "status": "ok",
1555
1555
  // "txid": "OAW2BO-7RWEK-PZY5UO",
1556
1556
  // "originaltxid": "OXL6SS-UPNMC-26WBE7",
1557
+ // "newuserref": 1234,
1558
+ // "olduserref": 123,
1557
1559
  // "volume": "0.00075000",
1558
1560
  // "price": "13500.0",
1559
1561
  // "orders_cancelled": 1,
@@ -1697,7 +1699,7 @@ export default class kraken extends Exchange {
1697
1699
  const txid = this.safeList(order, 'txid');
1698
1700
  id = this.safeString(txid, 0);
1699
1701
  }
1700
- const clientOrderId = this.safeString(order, 'userref');
1702
+ const clientOrderId = this.safeString2(order, 'userref', 'newuserref');
1701
1703
  const rawTrades = this.safeValue(order, 'trades', []);
1702
1704
  const trades = [];
1703
1705
  for (let i = 0; i < rawTrades.length; i++) {
@@ -1853,6 +1855,9 @@ export default class kraken extends Exchange {
1853
1855
  const extendedPostFlags = (flags !== undefined) ? flags + ',post' : 'post';
1854
1856
  request['oflags'] = extendedPostFlags;
1855
1857
  }
1858
+ if ((flags !== undefined) && !('oflags' in request)) {
1859
+ request['oflags'] = flags;
1860
+ }
1856
1861
  params = this.omit(params, ['timeInForce', 'reduceOnly', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingLimitAmount', 'offset']);
1857
1862
  return [request, params];
1858
1863
  }
@@ -1861,7 +1866,7 @@ export default class kraken extends Exchange {
1861
1866
  * @method
1862
1867
  * @name kraken#editOrder
1863
1868
  * @description edit a trade order
1864
- * @see https://docs.kraken.com/rest/#tag/Trading/operation/editOrder
1869
+ * @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/editOrder
1865
1870
  * @param {string} id order id
1866
1871
  * @param {string} symbol unified symbol of the market to create an order in
1867
1872
  * @param {string} type 'market' or 'limit'
@@ -1923,8 +1928,8 @@ export default class kraken extends Exchange {
1923
1928
  await this.loadMarkets();
1924
1929
  const clientOrderId = this.safeValue2(params, 'userref', 'clientOrderId');
1925
1930
  const request = {
1926
- 'trades': true, // whether or not to include trades in output (optional, default false)
1927
- // 'txid': id, // do not comma separate a list of ids - use fetchOrdersByIds instead
1931
+ 'trades': true,
1932
+ 'txid': id, // do not comma separate a list of ids - use fetchOrdersByIds instead
1928
1933
  // 'userref': 'optional', // restrict results to given user reference id (optional)
1929
1934
  };
1930
1935
  let query = params;
@@ -1932,9 +1937,6 @@ export default class kraken extends Exchange {
1932
1937
  request['userref'] = clientOrderId;
1933
1938
  query = this.omit(params, ['userref', 'clientOrderId']);
1934
1939
  }
1935
- else {
1936
- request['txid'] = id;
1937
- }
1938
1940
  const response = await this.privatePostQueryOrders(this.extend(request, query));
1939
1941
  //
1940
1942
  // {
package/js/src/kuna.js CHANGED
@@ -888,7 +888,6 @@ export default class kuna extends Exchange {
888
888
  'fee': {
889
889
  'cost': this.safeString(trade, 'fee'),
890
890
  'currency': this.safeCurrencyCode(this.safeString(trade, 'feeCurrency')),
891
- 'rate': undefined,
892
891
  },
893
892
  }, market);
894
893
  }
@@ -206,7 +206,7 @@ export default class binance extends binanceRest {
206
206
  * @param {object} [params] exchange specific parameters for the bitmex api endpoint
207
207
  * @returns {object} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
208
208
  */
209
- return this.watchLiquidationsForSymbols([symbol], since, limit, params);
209
+ return await this.watchLiquidationsForSymbols([symbol], since, limit, params);
210
210
  }
211
211
  async watchLiquidationsForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
212
212
  /**
@@ -80,6 +80,25 @@ export default class bybit extends bybitRest {
80
80
  },
81
81
  },
82
82
  },
83
+ 'demotrading': {
84
+ 'ws': {
85
+ 'public': {
86
+ 'spot': 'wss://stream.{hostname}/v5/public/spot',
87
+ 'inverse': 'wss://stream.{hostname}/v5/public/inverse',
88
+ 'option': 'wss://stream.{hostname}/v5/public/option',
89
+ 'linear': 'wss://stream.{hostname}/v5/public/linear',
90
+ },
91
+ 'private': {
92
+ 'spot': {
93
+ 'unified': 'wss://stream-demo.{hostname}/v5/private',
94
+ 'nonUnified': 'wss://stream-demo.{hostname}/spot/private/v3',
95
+ },
96
+ 'contract': 'wss://stream-demo.{hostname}/v5/private',
97
+ 'usdc': 'wss://stream-demo.{hostname}/trade/option/usdc/private/v1',
98
+ 'trade': 'wss://stream-demo.bybit.com/v5/trade',
99
+ },
100
+ },
101
+ },
83
102
  },
84
103
  'options': {
85
104
  'watchTicker': {
@@ -117,6 +117,7 @@ export default class paradex extends paradexRest {
117
117
  * @param {object} [params] extra parameters specific to the exchange API endpoint
118
118
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
119
119
  */
120
+ await this.loadMarkets();
120
121
  const market = this.market(symbol);
121
122
  const messageHash = 'order_book.' + market['id'] + '.snapshot@15@100ms';
122
123
  const url = this.urls['api']['ws'];
@@ -226,6 +227,7 @@ export default class paradex extends paradexRest {
226
227
  * @param {object} [params] extra parameters specific to the exchange API endpoint
227
228
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
228
229
  */
230
+ await this.loadMarkets();
229
231
  symbols = this.marketSymbols(symbols);
230
232
  const channel = 'markets_summary';
231
233
  const url = this.urls['api']['ws'];
package/js/src/pro/woo.js CHANGED
@@ -646,7 +646,7 @@ export default class woo extends wooRest {
646
646
  },
647
647
  };
648
648
  const message = this.extend(request, params);
649
- this.watch(url, messageHash, message, messageHash);
649
+ this.watch(url, messageHash, message, messageHash, message);
650
650
  }
651
651
  return await future;
652
652
  }
package/js/src/vertex.js CHANGED
@@ -668,6 +668,13 @@ export default class vertex extends Exchange {
668
668
  let amount = undefined;
669
669
  let side = undefined;
670
670
  let fee = undefined;
671
+ const feeCost = this.convertFromX18(this.safeString(trade, 'fee'));
672
+ if (feeCost !== undefined) {
673
+ fee = {
674
+ 'cost': feeCost,
675
+ 'currency': undefined,
676
+ };
677
+ }
671
678
  const id = this.safeString2(trade, 'trade_id', 'submission_idx');
672
679
  const order = this.safeString(trade, 'digest');
673
680
  const timestamp = this.safeTimestamp(trade, 'timestamp');
@@ -685,10 +692,6 @@ export default class vertex extends Exchange {
685
692
  const subOrder = this.safeDict(trade, 'order', {});
686
693
  price = this.convertFromX18(this.safeString(subOrder, 'priceX18'));
687
694
  amount = this.convertFromX18(this.safeString(trade, 'base_filled'));
688
- fee = {
689
- 'cost': this.convertFromX18(this.safeString(trade, 'fee')),
690
- 'currency': undefined,
691
- };
692
695
  if (Precise.stringLt(amount, '0')) {
693
696
  side = 'sell';
694
697
  }
package/js/src/woo.js CHANGED
@@ -610,6 +610,10 @@ export default class woo extends Exchange {
610
610
  const amount = this.safeString(trade, 'executed_quantity');
611
611
  const order_id = this.safeString(trade, 'order_id');
612
612
  const fee = this.parseTokenAndFeeTemp(trade, 'fee_asset', 'fee');
613
+ const feeCost = this.safeString(fee, 'cost');
614
+ if (feeCost !== undefined) {
615
+ fee['cost'] = feeCost;
616
+ }
613
617
  const cost = Precise.stringMul(price, amount);
614
618
  const side = this.safeStringLower(trade, 'side');
615
619
  const id = this.safeString(trade, 'id');
@@ -683,6 +683,10 @@ export default class woofipro extends Exchange {
683
683
  const amount = this.safeString(trade, 'executed_quantity');
684
684
  const order_id = this.safeString(trade, 'order_id');
685
685
  const fee = this.parseTokenAndFeeTemp(trade, 'fee_asset', 'fee');
686
+ const feeCost = this.safeString(fee, 'cost');
687
+ if (feeCost !== undefined) {
688
+ fee['cost'] = feeCost;
689
+ }
686
690
  const cost = Precise.stringMul(price, amount);
687
691
  const side = this.safeStringLower(trade, 'side');
688
692
  const id = this.safeString(trade, 'id');
package/js/src/xt.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  import Exchange from './abstract/xt.js';
2
2
  import { Currencies, Currency, Dict, FundingHistory, FundingRateHistory, Int, LeverageTier, MarginModification, Market, Num, OHLCV, Order, OrderSide, OrderType, Str, Tickers, Transaction, TransferEntry } from './base/types.js';
3
+ /**
4
+ * @class xt
5
+ * @augments Exchange
6
+ */
3
7
  export default class xt extends Exchange {
4
8
  describe(): any;
5
9
  nonce(): number;
package/js/src/xt.js CHANGED
@@ -11,6 +11,10 @@ import { TICK_SIZE } from './base/functions/number.js';
11
11
  import { ArgumentsRequired, AuthenticationError, BadRequest, BadSymbol, ExchangeError, InsufficientFunds, InvalidOrder, NetworkError, NotSupported, OnMaintenance, PermissionDenied, RateLimitExceeded, RequestTimeout } from './base/errors.js';
12
12
  import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
13
13
  // ---------------------------------------------------------------------------
14
+ /**
15
+ * @class xt
16
+ * @augments Exchange
17
+ */
14
18
  export default class xt extends Exchange {
15
19
  describe() {
16
20
  return this.deepExtend(super.describe(), {
@@ -2105,7 +2109,6 @@ export default class xt extends Exchange {
2105
2109
  'fee': {
2106
2110
  'currency': this.safeCurrencyCode(this.safeString2(trade, 'feeCurrency', 'feeCoin')),
2107
2111
  'cost': this.safeString(trade, 'fee'),
2108
- 'rate': undefined,
2109
2112
  },
2110
2113
  }, market);
2111
2114
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.3.76",
3
+ "version": "4.3.78",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.min.js",
6
6
  "type": "module",