ccxt 4.1.79 → 4.1.81

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
@@ -172,7 +172,7 @@ var woo$1 = require('./src/pro/woo.js');
172
172
 
173
173
  //-----------------------------------------------------------------------------
174
174
  // this is updated by vss.js when building
175
- const version = '4.1.79';
175
+ const version = '4.1.81';
176
176
  Exchange["default"].ccxtVersion = version;
177
177
  const exchanges = {
178
178
  'ace': ace,
@@ -1223,35 +1223,6 @@ class bingx extends bingx$1 {
1223
1223
  else {
1224
1224
  response = await this.swapV2PublicGetQuoteTicker(this.extend(request, params));
1225
1225
  }
1226
- //
1227
- // {
1228
- // "code": 0,
1229
- // "msg": "",
1230
- // "data": {
1231
- // "symbol": "BTC-USDT",
1232
- // "priceChange": "52.5",
1233
- // "priceChangePercent": "0.31",
1234
- // "lastPrice": "16880.5",
1235
- // "lastQty": "2.2238",
1236
- // "highPrice": "16897.5",
1237
- // "lowPrice": "16726.0",
1238
- // "volume": "245870.1692",
1239
- // "quoteVolume": "4151395117.73",
1240
- // "openPrice": "16832.0",
1241
- // "openTime": 1672026667803,
1242
- // "closeTime": 1672026648425,
1243
- // added some time ago:
1244
- // "firstId": 12345,
1245
- // "lastId": 12349,
1246
- // "count": 5,
1247
- // added 2023-11-10:
1248
- // "bidPrice": 16726.0,
1249
- // "bidQty": 0.05,
1250
- // "askPrice": 16726.0,
1251
- // "askQty": 0.05,
1252
- // }
1253
- // }
1254
- //
1255
1226
  const data = this.safeValue(response, 'data');
1256
1227
  const ticker = this.safeValue(data, 0, data);
1257
1228
  return this.parseTicker(ticker, market);
@@ -1282,37 +1253,6 @@ class bingx extends bingx$1 {
1282
1253
  else {
1283
1254
  response = await this.swapV2PublicGetQuoteTicker(params);
1284
1255
  }
1285
- //
1286
- // {
1287
- // "code": 0,
1288
- // "msg": "",
1289
- // "data": [
1290
- // {
1291
- // "symbol": "BTC-USDT",
1292
- // "priceChange": "52.5",
1293
- // "priceChangePercent": "0.31",
1294
- // "lastPrice": "16880.5",
1295
- // "lastQty": "2.2238",
1296
- // "highPrice": "16897.5",
1297
- // "lowPrice": "16726.0",
1298
- // "volume": "245870.1692",
1299
- // "quoteVolume": "4151395117.73",
1300
- // "openPrice": "16832.0",
1301
- // "openTime": 1672026667803,
1302
- // "closeTime": 1672026648425,
1303
- // added some time ago:
1304
- // "firstId": 12345,
1305
- // "lastId": 12349,
1306
- // "count": 5,
1307
- // added 2023-11-10:
1308
- // "bidPrice": 16726.0,
1309
- // "bidQty": 0.05,
1310
- // "askPrice": 16726.0,
1311
- // "askQty": 0.05,
1312
- // },
1313
- // ]
1314
- // }
1315
- //
1316
1256
  const tickers = this.safeValue(response, 'data');
1317
1257
  return this.parseTickers(tickers, symbols);
1318
1258
  }
@@ -1329,10 +1269,6 @@ class bingx extends bingx$1 {
1329
1269
  // "quoteVolume": "30288466.44",
1330
1270
  // "openTime": "1693081020762",
1331
1271
  // "closeTime": "1693167420762",
1332
- // added some time ago:
1333
- // "firstId": 12345,
1334
- // "lastId": 12349,
1335
- // "count": 5,
1336
1272
  // added 2023-11-10:
1337
1273
  // "bidPrice": 16726.0,
1338
1274
  // "bidQty": 0.05,
@@ -1346,7 +1282,7 @@ class bingx extends bingx$1 {
1346
1282
  // "priceChange": "52.5",
1347
1283
  // "priceChangePercent": "0.31%", // they started to add the percent sign in value
1348
1284
  // "lastPrice": "16880.5",
1349
- // "lastQty": "2.2238",
1285
+ // "lastQty": "2.2238", // only present in swap!
1350
1286
  // "highPrice": "16897.5",
1351
1287
  // "lowPrice": "16726.0",
1352
1288
  // "volume": "245870.1692",
@@ -1354,10 +1290,6 @@ class bingx extends bingx$1 {
1354
1290
  // "openPrice": "16832.0",
1355
1291
  // "openTime": 1672026667803,
1356
1292
  // "closeTime": 1672026648425,
1357
- // added some time ago:
1358
- // "firstId": 12345,
1359
- // "lastId": 12349,
1360
- // "count": 5,
1361
1293
  // added 2023-11-10:
1362
1294
  // "bidPrice": 16726.0,
1363
1295
  // "bidQty": 0.05,
@@ -1367,7 +1299,10 @@ class bingx extends bingx$1 {
1367
1299
  //
1368
1300
  const marketId = this.safeString(ticker, 'symbol');
1369
1301
  const change = this.safeString(ticker, 'priceChange');
1370
- const type = (change === undefined) ? 'spot' : 'swap';
1302
+ const lastQty = this.safeString(ticker, 'lastQty');
1303
+ // in spot markets, lastQty is not present
1304
+ // it's (bad, but) the only way we can check the tickers origin
1305
+ const type = (lastQty === undefined) ? 'spot' : 'swap';
1371
1306
  const symbol = this.safeSymbol(marketId, market, undefined, type);
1372
1307
  const open = this.safeString(ticker, 'openPrice');
1373
1308
  const high = this.safeString(ticker, 'highPrice');
@@ -2974,7 +2909,8 @@ class bingx extends bingx$1 {
2974
2909
  }
2975
2910
  parseTransactionStatus(status) {
2976
2911
  const statuses = {
2977
- '0': 'ok',
2912
+ '0': 'pending',
2913
+ '1': 'ok',
2978
2914
  '10': 'pending',
2979
2915
  '20': 'rejected',
2980
2916
  '30': 'ok',
@@ -3941,6 +3941,7 @@ class bitget extends bitget$1 {
3941
3941
  * @param {string} symbol unified symbol of the market the order was made in
3942
3942
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3943
3943
  * @param {string} [params.marginMode] 'isolated' or 'cross' for spot margin trading
3944
+ * @param {string} [params.planType] *swap only* either profit_plan, loss_plan, normal_plan, pos_profit, pos_loss, moving_plan or track_plan
3944
3945
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3945
3946
  */
3946
3947
  if (symbol === undefined) {
@@ -4337,6 +4338,7 @@ class bitget extends bitget$1 {
4337
4338
  * @param {int} [since] the earliest time in ms to fetch open orders for
4338
4339
  * @param {int} [limit] the maximum number of open order structures to retrieve
4339
4340
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4341
+ * @param {string} [params.isPlan] *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
4340
4342
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
4341
4343
  */
4342
4344
  await this.loadMarkets();
@@ -4581,6 +4583,7 @@ class bitget extends bitget$1 {
4581
4583
  * @param {int} [limit] the max number of closed orders to return
4582
4584
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4583
4585
  * @param {int} [params.until] the latest time in ms to fetch entries for
4586
+ * @param {string} [params.isPlan] *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
4584
4587
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
4585
4588
  */
4586
4589
  await this.loadMarkets();
@@ -4623,6 +4626,7 @@ class bitget extends bitget$1 {
4623
4626
  * @param {int} [limit] the max number of canceled orders to return
4624
4627
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4625
4628
  * @param {int} [params.until] the latest time in ms to fetch entries for
4629
+ * @param {string} [params.isPlan] *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
4626
4630
  * @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
4627
4631
  */
4628
4632
  if (symbol === undefined) {
@@ -446,6 +446,7 @@ class bybit extends bybit$1 {
446
446
  'v5/position/confirm-pending-mmr': 5,
447
447
  // account
448
448
  'v5/account/upgrade-to-uta': 5,
449
+ 'v5/account/quick-repayment': 5,
449
450
  'v5/account/set-margin-mode': 5,
450
451
  'v5/account/set-hedging-mode': 5,
451
452
  'v5/account/mmp-modify': 5,
@@ -2093,8 +2094,9 @@ class bybit extends bybit$1 {
2093
2094
  */
2094
2095
  await this.loadMarkets();
2095
2096
  let market = undefined;
2096
- const parsedSymbols = [];
2097
+ let parsedSymbols = undefined;
2097
2098
  if (symbols !== undefined) {
2099
+ parsedSymbols = [];
2098
2100
  const marketTypeInfo = this.handleMarketTypeAndParams('fetchTickers', undefined, params);
2099
2101
  const defaultType = marketTypeInfo[0]; // don't omit here
2100
2102
  // we can't use marketSymbols here due to the conflicing ids between markets
@@ -1573,7 +1573,19 @@ class currencycom extends currencycom$1 {
1573
1573
  if (limit !== undefined) {
1574
1574
  request['limit'] = limit;
1575
1575
  }
1576
- const response = await this[method](this.extend(request, params));
1576
+ let response = undefined;
1577
+ if (method === 'privateGetV2Deposits') {
1578
+ response = await this.privateGetV2Deposits(this.extend(request, params));
1579
+ }
1580
+ else if (method === 'privateGetV2Withdrawals') {
1581
+ response = await this.privateGetV2Withdrawals(this.extend(request, params));
1582
+ }
1583
+ else if (method === 'privateGetV2Transactions') {
1584
+ response = await this.privateGetV2Transactions(this.extend(request, params));
1585
+ }
1586
+ else {
1587
+ throw new errors.NotSupported(this.id + ' fetchTransactionsByMethod() not support this method');
1588
+ }
1577
1589
  //
1578
1590
  // [
1579
1591
  // {
@@ -30,6 +30,9 @@ class digifinex extends digifinex$1 {
30
30
  'addMargin': true,
31
31
  'cancelOrder': true,
32
32
  'cancelOrders': true,
33
+ 'createMarketBuyOrderWithCost': true,
34
+ 'createMarketOrderWithCost': false,
35
+ 'createMarketSellOrderWithCost': false,
33
36
  'createOrder': true,
34
37
  'createOrders': true,
35
38
  'createPostOnlyOrder': true,
@@ -1562,6 +1565,7 @@ class digifinex extends digifinex$1 {
1562
1565
  * @param {bool} [params.postOnly] true or false
1563
1566
  * @param {bool} [params.reduceOnly] true or false
1564
1567
  * @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
1568
+ * @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
1565
1569
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1566
1570
  */
1567
1571
  await this.loadMarkets();
@@ -1779,16 +1783,27 @@ class digifinex extends digifinex$1 {
1779
1783
  request['type'] = side + suffix;
1780
1784
  // limit orders require the amount in the base currency, market orders require the amount in the quote currency
1781
1785
  let quantity = undefined;
1782
- const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice', true);
1783
- if (createMarketBuyOrderRequiresPrice && isMarketOrder && (side === 'buy')) {
1784
- if (price === undefined) {
1785
- throw new errors.InvalidOrder(this.id + ' createOrder() requires a price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option to false and pass in the cost to spend into the amount parameter');
1786
+ let createMarketBuyOrderRequiresPrice = true;
1787
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrderRequest', 'createMarketBuyOrderRequiresPrice', true);
1788
+ if (isMarketOrder && (side === 'buy')) {
1789
+ const cost = this.safeNumber(params, 'cost');
1790
+ params = this.omit(params, 'cost');
1791
+ if (cost !== undefined) {
1792
+ quantity = this.costToPrecision(symbol, cost);
1793
+ }
1794
+ else if (createMarketBuyOrderRequiresPrice) {
1795
+ if (price === undefined) {
1796
+ throw new errors.InvalidOrder(this.id + ' createOrder() requires a price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
1797
+ }
1798
+ else {
1799
+ const amountString = this.numberToString(amount);
1800
+ const priceString = this.numberToString(price);
1801
+ const costRequest = this.parseNumber(Precise["default"].stringMul(amountString, priceString));
1802
+ quantity = this.costToPrecision(symbol, costRequest);
1803
+ }
1786
1804
  }
1787
1805
  else {
1788
- const amountString = this.numberToString(amount);
1789
- const priceString = this.numberToString(price);
1790
- const cost = this.parseNumber(Precise["default"].stringMul(amountString, priceString));
1791
- quantity = this.priceToPrecision(symbol, cost);
1806
+ quantity = this.costToPrecision(symbol, amount);
1792
1807
  }
1793
1808
  }
1794
1809
  else {
@@ -1807,6 +1822,25 @@ class digifinex extends digifinex$1 {
1807
1822
  params = this.omit(params, ['postOnly']);
1808
1823
  return this.extend(request, params);
1809
1824
  }
1825
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
1826
+ /**
1827
+ * @method
1828
+ * @name digifinex#createMarketBuyOrderWithCost
1829
+ * @description create a market buy order by providing the symbol and cost
1830
+ * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#create-new-order
1831
+ * @param {string} symbol unified symbol of the market to create an order in
1832
+ * @param {float} cost how much you want to trade in units of the quote currency
1833
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1834
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1835
+ */
1836
+ await this.loadMarkets();
1837
+ const market = this.market(symbol);
1838
+ if (!market['spot']) {
1839
+ throw new errors.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
1840
+ }
1841
+ params['createMarketBuyOrderRequiresPrice'] = false;
1842
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
1843
+ }
1810
1844
  async cancelOrder(id, symbol = undefined, params = {}) {
1811
1845
  /**
1812
1846
  * @method
@@ -150,9 +150,9 @@ class mexc extends mexc$1 {
150
150
  'get': {
151
151
  'ping': 1,
152
152
  'time': 1,
153
- 'exchangeInfo': 1,
153
+ 'exchangeInfo': 10,
154
154
  'depth': 1,
155
- 'trades': 1,
155
+ 'trades': 5,
156
156
  'historicalTrades': 1,
157
157
  'aggTrades': 1,
158
158
  'klines': 1,
@@ -165,17 +165,18 @@ class mexc extends mexc$1 {
165
165
  },
166
166
  'private': {
167
167
  'get': {
168
- 'order': 1,
169
- 'openOrders': 1,
170
- 'allOrders': 1,
168
+ 'order': 2,
169
+ 'openOrders': 3,
170
+ 'allOrders': 10,
171
171
  'account': 10,
172
- 'myTrades': 1,
172
+ 'myTrades': 10,
173
173
  'sub-account/list': 1,
174
174
  'sub-account/apiKey': 1,
175
- 'capital/config/getall': 1,
175
+ 'capital/config/getall': 10,
176
176
  'capital/deposit/hisrec': 1,
177
177
  'capital/withdraw/history': 1,
178
- 'capital/deposit/address': 1,
178
+ 'capital/withdraw/address': 10,
179
+ 'capital/deposit/address': 10,
179
180
  'capital/transfer': 1,
180
181
  'capital/transfer/tranId': 1,
181
182
  'capital/transfer/internal': 1,
@@ -219,7 +220,7 @@ class mexc extends mexc$1 {
219
220
  'capital/transfer/internal': 1,
220
221
  'capital/deposit/address': 1,
221
222
  'capital/sub-account/universalTransfer': 1,
222
- 'capital/convert': 1,
223
+ 'capital/convert': 10,
223
224
  'mxDeduct/enable': 1,
224
225
  'userDataStream': 1,
225
226
  },
@@ -430,14 +430,22 @@ class probit extends probit$1 {
430
430
  }
431
431
  const precision = this.parsePrecision(this.safeString(network, 'precision'));
432
432
  const withdrawFee = this.safeValue(network, 'withdrawal_fee', []);
433
- const networkfee = this.safeValue(withdrawFee, 0, {});
433
+ let networkFee = this.safeValue(withdrawFee, 0, {});
434
+ for (let k = 0; k < withdrawFee.length; k++) {
435
+ const withdrawPlatform = withdrawFee[k];
436
+ const feeCurrencyId = this.safeString(withdrawPlatform, 'currency_id');
437
+ if (feeCurrencyId === id) {
438
+ networkFee = withdrawPlatform;
439
+ break;
440
+ }
441
+ }
434
442
  networkList[networkCode] = {
435
443
  'id': networkId,
436
444
  'network': networkCode,
437
445
  'active': currentActive,
438
446
  'deposit': currentDeposit,
439
447
  'withdraw': currentWithdraw,
440
- 'fee': this.safeNumber(networkfee, 'amount'),
448
+ 'fee': this.safeNumber(networkFee, 'amount'),
441
449
  'precision': this.parseNumber(precision),
442
450
  'limits': {
443
451
  'withdraw': {