ccxt 4.3.53 → 4.3.54

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
@@ -190,7 +190,7 @@ var woofipro$1 = require('./src/pro/woofipro.js');
190
190
 
191
191
  //-----------------------------------------------------------------------------
192
192
  // this is updated by vss.js when building
193
- const version = '4.3.53';
193
+ const version = '4.3.54';
194
194
  Exchange["default"].ccxtVersion = version;
195
195
  const exchanges = {
196
196
  'ace': ace,
@@ -701,7 +701,7 @@ class bingx extends bingx$1 {
701
701
  'limits': {
702
702
  'leverage': {
703
703
  'min': undefined,
704
- 'max': this.safeInteger(market, 'maxLongLeverage'),
704
+ 'max': undefined,
705
705
  },
706
706
  'amount': {
707
707
  'min': this.safeNumber2(market, 'minQty', 'tradeMinQuantity'),
@@ -2941,14 +2941,41 @@ class phemex extends phemex$1 {
2941
2941
  let response = undefined;
2942
2942
  if (market['settle'] === 'USDT') {
2943
2943
  response = await this.privateDeleteGOrdersAll(this.extend(request, params));
2944
+ //
2945
+ // {
2946
+ // code: '0',
2947
+ // msg: '',
2948
+ // data: '1'
2949
+ // }
2950
+ //
2944
2951
  }
2945
2952
  else if (market['swap']) {
2946
2953
  response = await this.privateDeleteOrdersAll(this.extend(request, params));
2954
+ //
2955
+ // {
2956
+ // code: '0',
2957
+ // msg: '',
2958
+ // data: '1'
2959
+ // }
2960
+ //
2947
2961
  }
2948
2962
  else {
2949
2963
  response = await this.privateDeleteSpotOrdersAll(this.extend(request, params));
2964
+ //
2965
+ // {
2966
+ // code: '0',
2967
+ // msg: '',
2968
+ // data: {
2969
+ // total: '1'
2970
+ // }
2971
+ // }
2972
+ //
2950
2973
  }
2951
- return response;
2974
+ return [
2975
+ this.safeOrder({
2976
+ 'info': response,
2977
+ }),
2978
+ ];
2952
2979
  }
2953
2980
  async fetchOrder(id, symbol = undefined, params = {}) {
2954
2981
  /**
@@ -1288,7 +1288,8 @@ class poloniex extends poloniex$1 {
1288
1288
  // }
1289
1289
  //
1290
1290
  response = this.extend(response, {
1291
- 'type': side,
1291
+ 'type': type,
1292
+ 'side': side,
1292
1293
  });
1293
1294
  return this.parseOrder(response, market);
1294
1295
  }
@@ -3730,7 +3730,7 @@ class binance extends binance$1 {
3730
3730
  rejected = true;
3731
3731
  // private endpoint uses id as messageHash
3732
3732
  client.reject(e, id);
3733
- // public endpoint stores messageHash in subscriptios
3733
+ // public endpoint stores messageHash in subscriptions
3734
3734
  const subscriptionKeys = Object.keys(client.subscriptions);
3735
3735
  for (let i = 0; i < subscriptionKeys.length; i++) {
3736
3736
  const subscriptionHash = subscriptionKeys[i];
@@ -132,7 +132,7 @@ class bybit extends bybit$1 {
132
132
  this.options['requestId'] = requestId;
133
133
  return requestId;
134
134
  }
135
- getUrlByMarketType(symbol = undefined, isPrivate = false, method = undefined, params = {}) {
135
+ async getUrlByMarketType(symbol = undefined, isPrivate = false, method = undefined, params = {}) {
136
136
  const accessibility = isPrivate ? 'private' : 'public';
137
137
  let isUsdcSettled = undefined;
138
138
  let isSpot = undefined;
@@ -152,7 +152,15 @@ class bybit extends bybit$1 {
152
152
  }
153
153
  isSpot = (type === 'spot');
154
154
  if (isPrivate) {
155
- url = (isUsdcSettled) ? url[accessibility]['usdc'] : url[accessibility]['contract'];
155
+ const unified = await this.isUnifiedEnabled();
156
+ const isUnifiedMargin = this.safeBool(unified, 0, false);
157
+ const isUnifiedAccount = this.safeBool(unified, 1, false);
158
+ if (isUsdcSettled && !isUnifiedMargin && !isUnifiedAccount) {
159
+ url = url[accessibility]['usdc'];
160
+ }
161
+ else {
162
+ url = url[accessibility]['contract'];
163
+ }
156
164
  }
157
165
  else {
158
166
  if (isSpot) {
@@ -319,7 +327,7 @@ class bybit extends bybit$1 {
319
327
  const market = this.market(symbol);
320
328
  symbol = market['symbol'];
321
329
  const messageHash = 'ticker:' + symbol;
322
- const url = this.getUrlByMarketType(symbol, false, 'watchTicker', params);
330
+ const url = await this.getUrlByMarketType(symbol, false, 'watchTicker', params);
323
331
  params = this.cleanParams(params);
324
332
  const options = this.safeValue(this.options, 'watchTicker', {});
325
333
  let topic = this.safeString(options, 'name', 'tickers');
@@ -344,7 +352,7 @@ class bybit extends bybit$1 {
344
352
  await this.loadMarkets();
345
353
  symbols = this.marketSymbols(symbols, undefined, false);
346
354
  const messageHashes = [];
347
- const url = this.getUrlByMarketType(symbols[0], false, 'watchTickers', params);
355
+ const url = await this.getUrlByMarketType(symbols[0], false, 'watchTickers', params);
348
356
  params = this.cleanParams(params);
349
357
  const options = this.safeValue(this.options, 'watchTickers', {});
350
358
  const topic = this.safeString(options, 'name', 'tickers');
@@ -525,7 +533,7 @@ class bybit extends bybit$1 {
525
533
  await this.loadMarkets();
526
534
  const market = this.market(symbol);
527
535
  symbol = market['symbol'];
528
- const url = this.getUrlByMarketType(symbol, false, 'watchOHLCV', params);
536
+ const url = await this.getUrlByMarketType(symbol, false, 'watchOHLCV', params);
529
537
  params = this.cleanParams(params);
530
538
  let ohlcv = undefined;
531
539
  const timeframeId = this.safeString(this.timeframes, timeframe, timeframe);
@@ -643,7 +651,7 @@ class bybit extends bybit$1 {
643
651
  throw new errors.ArgumentsRequired(this.id + ' watchOrderBookForSymbols() requires a non-empty array of symbols');
644
652
  }
645
653
  symbols = this.marketSymbols(symbols);
646
- const url = this.getUrlByMarketType(symbols[0], false, 'watchOrderBook', params);
654
+ const url = await this.getUrlByMarketType(symbols[0], false, 'watchOrderBook', params);
647
655
  params = this.cleanParams(params);
648
656
  const market = this.market(symbols[0]);
649
657
  if (limit === undefined) {
@@ -775,7 +783,7 @@ class bybit extends bybit$1 {
775
783
  throw new errors.ArgumentsRequired(this.id + ' watchTradesForSymbols() requires a non-empty array of symbols');
776
784
  }
777
785
  params = this.cleanParams(params);
778
- const url = this.getUrlByMarketType(symbols[0], false, 'watchTrades', params);
786
+ const url = await this.getUrlByMarketType(symbols[0], false, 'watchTrades', params);
779
787
  const topics = [];
780
788
  const messageHashes = [];
781
789
  for (let i = 0; i < symbols.length; i++) {
@@ -938,7 +946,7 @@ class bybit extends bybit$1 {
938
946
  symbol = this.symbol(symbol);
939
947
  messageHash += ':' + symbol;
940
948
  }
941
- const url = this.getUrlByMarketType(symbol, true, method, params);
949
+ const url = await this.getUrlByMarketType(symbol, true, method, params);
942
950
  await this.authenticate(url);
943
951
  const topicByMarket = {
944
952
  'spot': 'ticketInfo',
@@ -1067,7 +1075,7 @@ class bybit extends bybit$1 {
1067
1075
  messageHash = '::' + symbols.join(',');
1068
1076
  }
1069
1077
  const firstSymbol = this.safeString(symbols, 0);
1070
- const url = this.getUrlByMarketType(firstSymbol, true, method, params);
1078
+ const url = await this.getUrlByMarketType(firstSymbol, true, method, params);
1071
1079
  messageHash = 'positions' + messageHash;
1072
1080
  const client = this.client(url);
1073
1081
  await this.authenticate(url);
@@ -1218,7 +1226,7 @@ class bybit extends bybit$1 {
1218
1226
  await this.loadMarkets();
1219
1227
  const market = this.market(symbol);
1220
1228
  symbol = market['symbol'];
1221
- const url = this.getUrlByMarketType(symbol, false, 'watchLiquidations', params);
1229
+ const url = await this.getUrlByMarketType(symbol, false, 'watchLiquidations', params);
1222
1230
  params = this.cleanParams(params);
1223
1231
  const messageHash = 'liquidations::' + symbol;
1224
1232
  const topic = 'liquidation.' + market['id'];
@@ -1302,7 +1310,7 @@ class bybit extends bybit$1 {
1302
1310
  symbol = this.symbol(symbol);
1303
1311
  messageHash += ':' + symbol;
1304
1312
  }
1305
- const url = this.getUrlByMarketType(symbol, true, method, params);
1313
+ const url = await this.getUrlByMarketType(symbol, true, method, params);
1306
1314
  await this.authenticate(url);
1307
1315
  const topicsByMarket = {
1308
1316
  'spot': ['order', 'stopOrder'],
@@ -1614,7 +1622,7 @@ class bybit extends bybit$1 {
1614
1622
  const unified = await this.isUnifiedEnabled();
1615
1623
  const isUnifiedMargin = this.safeBool(unified, 0, false);
1616
1624
  const isUnifiedAccount = this.safeBool(unified, 1, false);
1617
- const url = this.getUrlByMarketType(undefined, true, method, params);
1625
+ const url = await this.getUrlByMarketType(undefined, true, method, params);
1618
1626
  await this.authenticate(url);
1619
1627
  const topicByMarket = {
1620
1628
  'spot': 'outboundAccountInfo',
@@ -156,6 +156,7 @@ class kucoin extends kucoin$1 {
156
156
  * @method
157
157
  * @name kucoin#watchTicker
158
158
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
159
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/market-snapshot
159
160
  * @param {string} symbol unified symbol of the market to fetch the ticker for
160
161
  * @param {object} [params] extra parameters specific to the exchange API endpoint
161
162
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -388,6 +389,7 @@ class kucoin extends kucoin$1 {
388
389
  * @method
389
390
  * @name kucoin#watchOHLCV
390
391
  * @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
392
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/klines
391
393
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
392
394
  * @param {string} timeframe the length of time each candle represents
393
395
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -456,6 +458,7 @@ class kucoin extends kucoin$1 {
456
458
  * @method
457
459
  * @name kucoin#watchTrades
458
460
  * @description get the list of most recent trades for a particular symbol
461
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/match-execution-data
459
462
  * @param {string} symbol unified symbol of the market to fetch trades for
460
463
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
461
464
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -469,6 +472,7 @@ class kucoin extends kucoin$1 {
469
472
  * @method
470
473
  * @name kucoin#watchTrades
471
474
  * @description get the list of most recent trades for a particular symbol
475
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/match-execution-data
472
476
  * @param {string} symbol unified symbol of the market to fetch trades for
473
477
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
474
478
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -803,6 +807,8 @@ class kucoin extends kucoin$1 {
803
807
  * @method
804
808
  * @name kucoin#watchOrders
805
809
  * @description watches information on multiple orders made by the user
810
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/private-channels/private-order-change
811
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/private-channels/stop-order-event
806
812
  * @param {string} symbol unified market symbol of the market orders were made in
807
813
  * @param {int} [since] the earliest time in ms to fetch orders for
808
814
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -939,6 +945,10 @@ class kucoin extends kucoin$1 {
939
945
  //
940
946
  const messageHash = 'orders';
941
947
  const data = this.safeValue(message, 'data');
948
+ const tradeId = this.safeString(data, 'tradeId');
949
+ if (tradeId !== undefined) {
950
+ this.handleMyTrade(client, message);
951
+ }
942
952
  const parsed = this.parseWsOrder(data);
943
953
  const symbol = this.safeString(parsed, 'symbol');
944
954
  const orderId = this.safeString(parsed, 'id');
@@ -968,6 +978,7 @@ class kucoin extends kucoin$1 {
968
978
  * @method
969
979
  * @name kucoin#watchMyTrades
970
980
  * @description watches information on multiple trades made by the user
981
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/private-channels/private-order-change
971
982
  * @param {string} symbol unified market symbol of the market trades were made in
972
983
  * @param {int} [since] the earliest time in ms to fetch trades for
973
984
  * @param {int} [limit] the maximum number of trade structures to retrieve
@@ -976,7 +987,7 @@ class kucoin extends kucoin$1 {
976
987
  */
977
988
  await this.loadMarkets();
978
989
  const url = await this.negotiate(true);
979
- const topic = '/spot/tradeFills';
990
+ const topic = '/spotMarket/tradeOrders';
980
991
  const request = {
981
992
  'privateChannel': true,
982
993
  };
@@ -993,6 +1004,34 @@ class kucoin extends kucoin$1 {
993
1004
  return this.filterBySymbolSinceLimit(trades, symbol, since, limit, true);
994
1005
  }
995
1006
  handleMyTrade(client, message) {
1007
+ //
1008
+ // {
1009
+ // "type": "message",
1010
+ // "topic": "/spotMarket/tradeOrders",
1011
+ // "subject": "orderChange",
1012
+ // "channelType": "private",
1013
+ // "data": {
1014
+ // "symbol": "KCS-USDT",
1015
+ // "orderType": "limit",
1016
+ // "side": "sell",
1017
+ // "orderId": "5efab07953bdea00089965fa",
1018
+ // "liquidity": "taker",
1019
+ // "type": "match",
1020
+ // "feeType": "takerFee",
1021
+ // "orderTime": 1670329987026,
1022
+ // "size": "0.1",
1023
+ // "filledSize": "0.1",
1024
+ // "price": "0.938",
1025
+ // "matchPrice": "0.96738",
1026
+ // "matchSize": "0.1",
1027
+ // "tradeId": "5efab07a4ee4c7000a82d6d9",
1028
+ // "clientOid": "1593487481000313",
1029
+ // "remainSize": "0",
1030
+ // "status": "match",
1031
+ // "ts": 1670329987311000000
1032
+ // }
1033
+ // }
1034
+ //
996
1035
  if (this.myTrades === undefined) {
997
1036
  const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
998
1037
  this.myTrades = new Cache.ArrayCacheBySymbolById(limit);
@@ -1007,19 +1046,26 @@ class kucoin extends kucoin$1 {
1007
1046
  }
1008
1047
  parseWsTrade(trade, market = undefined) {
1009
1048
  //
1010
- // {
1011
- // "fee": 0.00262148,
1012
- // "feeCurrency": "USDT",
1013
- // "feeRate": 0.001,
1014
- // "orderId": "62417436b29df8000183df2f",
1015
- // "orderType": "market",
1016
- // "price": 131.074,
1017
- // "side": "sell",
1018
- // "size": 0.02,
1019
- // "symbol": "LTC-USDT",
1020
- // "time": "1648456758734571745",
1021
- // "tradeId": "624174362e113d2f467b3043"
1022
- // }
1049
+ // {
1050
+ // "symbol": "KCS-USDT",
1051
+ // "orderType": "limit",
1052
+ // "side": "sell",
1053
+ // "orderId": "5efab07953bdea00089965fa",
1054
+ // "liquidity": "taker",
1055
+ // "type": "match",
1056
+ // "feeType": "takerFee",
1057
+ // "orderTime": 1670329987026,
1058
+ // "size": "0.1",
1059
+ // "filledSize": "0.1",
1060
+ // "price": "0.938",
1061
+ // "matchPrice": "0.96738",
1062
+ // "matchSize": "0.1",
1063
+ // "tradeId": "5efab07a4ee4c7000a82d6d9",
1064
+ // "clientOid": "1593487481000313",
1065
+ // "remainSize": "0",
1066
+ // "status": "match",
1067
+ // "ts": 1670329987311000000
1068
+ // }
1023
1069
  //
1024
1070
  const marketId = this.safeString(trade, 'symbol');
1025
1071
  market = this.safeMarket(marketId, market, '-');
@@ -1030,15 +1076,7 @@ class kucoin extends kucoin$1 {
1030
1076
  const price = this.safeString(trade, 'price');
1031
1077
  const amount = this.safeString(trade, 'size');
1032
1078
  const order = this.safeString(trade, 'orderId');
1033
- const timestamp = this.safeIntegerProduct(trade, 'time', 0.000001);
1034
- const feeCurrency = market['quote'];
1035
- const feeRate = this.safeString(trade, 'feeRate');
1036
- const feeCost = this.safeString(trade, 'fee');
1037
- const fee = {
1038
- 'cost': feeCost,
1039
- 'rate': feeRate,
1040
- 'currency': feeCurrency,
1041
- };
1079
+ const timestamp = this.safeIntegerProduct(trade, 'ts', 0.000001);
1042
1080
  return this.safeTrade({
1043
1081
  'info': trade,
1044
1082
  'timestamp': timestamp,
@@ -1047,12 +1085,12 @@ class kucoin extends kucoin$1 {
1047
1085
  'id': tradeId,
1048
1086
  'order': order,
1049
1087
  'type': type,
1050
- 'takerOrMaker': undefined,
1088
+ 'takerOrMaker': this.safeString(trade, 'liquidity'),
1051
1089
  'side': side,
1052
1090
  'price': price,
1053
1091
  'amount': amount,
1054
1092
  'cost': undefined,
1055
- 'fee': fee,
1093
+ 'fee': undefined,
1056
1094
  }, market);
1057
1095
  }
1058
1096
  async watchBalance(params = {}) {
@@ -1060,6 +1098,7 @@ class kucoin extends kucoin$1 {
1060
1098
  * @method
1061
1099
  * @name kucoin#watchBalance
1062
1100
  * @description watch balance and get the amount of funds available for trading or funds locked in orders
1101
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/private-channels/account-balance-change
1063
1102
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1064
1103
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
1065
1104
  */
@@ -1158,7 +1197,6 @@ class kucoin extends kucoin$1 {
1158
1197
  'trade.l3match': this.handleTrade,
1159
1198
  'trade.candles.update': this.handleOHLCV,
1160
1199
  'account.balance': this.handleBalance,
1161
- '/spot/tradeFills': this.handleMyTrade,
1162
1200
  'orderChange': this.handleOrder,
1163
1201
  'stopOrder': this.handleOrder,
1164
1202
  };
@@ -322,7 +322,7 @@ class vertex extends vertex$1 {
322
322
  // "ask_qty": "1000" // quantity at the lowest ask
323
323
  // }
324
324
  //
325
- const timestamp = Precise["default"].stringDiv(this.safeString(ticker, 'timestamp'), '1000000');
325
+ const timestamp = this.safeIntegerProduct(ticker, 'timestamp', 0.000001);
326
326
  return this.safeTicker({
327
327
  'symbol': this.safeSymbol(undefined, market),
328
328
  'timestamp': timestamp,
@@ -42,7 +42,7 @@ class woo extends woo$1 {
42
42
  'createMarketBuyOrderWithCost': true,
43
43
  'createMarketOrder': false,
44
44
  'createMarketOrderWithCost': false,
45
- 'createMarketSellOrderWithCost': false,
45
+ 'createMarketSellOrderWithCost': true,
46
46
  'createOrder': true,
47
47
  'createOrderWithTakeProfitAndStopLoss': true,
48
48
  'createReduceOnlyOrder': true,
@@ -850,8 +850,25 @@ class woo extends woo$1 {
850
850
  if (!market['spot']) {
851
851
  throw new errors.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
852
852
  }
853
- params['createMarketBuyOrderRequiresPrice'] = false;
854
- return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
853
+ return await this.createOrder(symbol, 'market', 'buy', cost, 1, params);
854
+ }
855
+ async createMarketSellOrderWithCost(symbol, cost, params = {}) {
856
+ /**
857
+ * @method
858
+ * @name woo#createMarketSellOrderWithCost
859
+ * @description create a market sell order by providing the symbol and cost
860
+ * @see https://docs.woo.org/#send-order
861
+ * @param {string} symbol unified symbol of the market to create an order in
862
+ * @param {float} cost how much you want to trade in units of the quote currency
863
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
864
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
865
+ */
866
+ await this.loadMarkets();
867
+ const market = this.market(symbol);
868
+ if (!market['spot']) {
869
+ throw new errors.NotSupported(this.id + ' createMarketSellOrderWithCost() supports spot orders only');
870
+ }
871
+ return await this.createOrder(symbol, 'market', 'sell', cost, 1, params);
855
872
  }
856
873
  async createTrailingAmountOrder(symbol, type, side, amount, price = undefined, trailingAmount = undefined, trailingTriggerPrice = undefined, params = {}) {
857
874
  /**
@@ -974,33 +991,24 @@ class woo extends woo$1 {
974
991
  if (reduceOnly) {
975
992
  request[reduceOnlyKey] = reduceOnly;
976
993
  }
977
- if (price !== undefined) {
994
+ if (!isMarket && price !== undefined) {
978
995
  request[priceKey] = this.priceToPrecision(symbol, price);
979
996
  }
980
997
  if (isMarket && !isStop) {
981
998
  // for market buy it requires the amount of quote currency to spend
982
- if (market['spot'] && orderSide === 'BUY') {
999
+ const cost = this.safeString2(params, 'cost', 'order_amount');
1000
+ params = this.omit(params, ['cost', 'order_amount']);
1001
+ const isPriceProvided = price !== undefined;
1002
+ if (market['spot'] && (isPriceProvided || (cost !== undefined))) {
983
1003
  let quoteAmount = undefined;
984
- let createMarketBuyOrderRequiresPrice = true;
985
- [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
986
- const cost = this.safeNumber2(params, 'cost', 'order_amount');
987
- params = this.omit(params, ['cost', 'order_amount']);
988
1004
  if (cost !== undefined) {
989
1005
  quoteAmount = this.costToPrecision(symbol, cost);
990
1006
  }
991
- else if (createMarketBuyOrderRequiresPrice) {
992
- if (price === undefined) {
993
- throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend (quote quantity) in the amount argument');
994
- }
995
- else {
996
- const amountString = this.numberToString(amount);
997
- const priceString = this.numberToString(price);
998
- const costRequest = Precise["default"].stringMul(amountString, priceString);
999
- quoteAmount = this.costToPrecision(symbol, costRequest);
1000
- }
1001
- }
1002
1007
  else {
1003
- quoteAmount = this.costToPrecision(symbol, amount);
1008
+ const amountString = this.numberToString(amount);
1009
+ const priceString = this.numberToString(price);
1010
+ const costRequest = Precise["default"].stringMul(amountString, priceString);
1011
+ quoteAmount = this.costToPrecision(symbol, costRequest);
1004
1012
  }
1005
1013
  request['order_amount'] = quoteAmount;
1006
1014
  }
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.52";
7
+ declare const version = "4.3.53";
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.53';
41
+ const version = '4.3.54';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
package/js/src/bingx.js CHANGED
@@ -704,7 +704,7 @@ export default class bingx extends Exchange {
704
704
  'limits': {
705
705
  'leverage': {
706
706
  'min': undefined,
707
- 'max': this.safeInteger(market, 'maxLongLeverage'),
707
+ 'max': undefined,
708
708
  },
709
709
  'amount': {
710
710
  'min': this.safeNumber2(market, 'minQty', 'tradeMinQuantity'),
@@ -41,7 +41,7 @@ export default class phemex extends Exchange {
41
41
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
42
42
  editOrder(id: string, symbol: string, type?: OrderType, side?: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
43
43
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
44
- cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
44
+ cancelAllOrders(symbol?: Str, params?: {}): Promise<Order[]>;
45
45
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
46
46
  fetchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
47
47
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
package/js/src/phemex.js CHANGED
@@ -2944,14 +2944,41 @@ export default class phemex extends Exchange {
2944
2944
  let response = undefined;
2945
2945
  if (market['settle'] === 'USDT') {
2946
2946
  response = await this.privateDeleteGOrdersAll(this.extend(request, params));
2947
+ //
2948
+ // {
2949
+ // code: '0',
2950
+ // msg: '',
2951
+ // data: '1'
2952
+ // }
2953
+ //
2947
2954
  }
2948
2955
  else if (market['swap']) {
2949
2956
  response = await this.privateDeleteOrdersAll(this.extend(request, params));
2957
+ //
2958
+ // {
2959
+ // code: '0',
2960
+ // msg: '',
2961
+ // data: '1'
2962
+ // }
2963
+ //
2950
2964
  }
2951
2965
  else {
2952
2966
  response = await this.privateDeleteSpotOrdersAll(this.extend(request, params));
2967
+ //
2968
+ // {
2969
+ // code: '0',
2970
+ // msg: '',
2971
+ // data: {
2972
+ // total: '1'
2973
+ // }
2974
+ // }
2975
+ //
2953
2976
  }
2954
- return response;
2977
+ return [
2978
+ this.safeOrder({
2979
+ 'info': response,
2980
+ }),
2981
+ ];
2955
2982
  }
2956
2983
  async fetchOrder(id, symbol = undefined, params = {}) {
2957
2984
  /**
@@ -1291,7 +1291,8 @@ export default class poloniex extends Exchange {
1291
1291
  // }
1292
1292
  //
1293
1293
  response = this.extend(response, {
1294
- 'type': side,
1294
+ 'type': type,
1295
+ 'side': side,
1295
1296
  });
1296
1297
  return this.parseOrder(response, market);
1297
1298
  }
@@ -3733,7 +3733,7 @@ export default class binance extends binanceRest {
3733
3733
  rejected = true;
3734
3734
  // private endpoint uses id as messageHash
3735
3735
  client.reject(e, id);
3736
- // public endpoint stores messageHash in subscriptios
3736
+ // public endpoint stores messageHash in subscriptions
3737
3737
  const subscriptionKeys = Object.keys(client.subscriptions);
3738
3738
  for (let i = 0; i < subscriptionKeys.length; i++) {
3739
3739
  const subscriptionHash = subscriptionKeys[i];
@@ -4,7 +4,7 @@ import Client from '../base/ws/Client.js';
4
4
  export default class bybit extends bybitRest {
5
5
  describe(): any;
6
6
  requestId(): any;
7
- getUrlByMarketType(symbol?: Str, isPrivate?: boolean, method?: Str, params?: {}): any;
7
+ getUrlByMarketType(symbol?: Str, isPrivate?: boolean, method?: Str, params?: {}): Promise<any>;
8
8
  cleanParams(params: any): any;
9
9
  createOrderWs(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
10
10
  editOrderWs(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;