ccxt 4.1.77 → 4.1.79

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 (59) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.js +508 -177
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/bingx.js +6 -3
  6. package/dist/cjs/src/bitget.js +71 -0
  7. package/dist/cjs/src/bitmart.js +9 -13
  8. package/dist/cjs/src/bybit.js +2 -0
  9. package/dist/cjs/src/coinbase.js +13 -3
  10. package/dist/cjs/src/coinex.js +7 -11
  11. package/dist/cjs/src/cryptocom.js +4 -0
  12. package/dist/cjs/src/gate.js +4 -0
  13. package/dist/cjs/src/hitbtc.js +326 -123
  14. package/dist/cjs/src/idex.js +10 -1
  15. package/dist/cjs/src/mexc.js +33 -5
  16. package/dist/cjs/src/okx.js +5 -9
  17. package/dist/cjs/src/pro/binance.js +10 -2
  18. package/dist/cjs/src/pro/binanceus.js +1 -0
  19. package/dist/cjs/src/pro/gate.js +1 -1
  20. package/dist/cjs/src/upbit.js +5 -5
  21. package/js/ccxt.d.ts +1 -1
  22. package/js/ccxt.js +1 -1
  23. package/js/src/abstract/bybit.d.ts +2 -0
  24. package/js/src/abstract/coinbase.d.ts +1 -0
  25. package/js/src/abstract/cryptocom.d.ts +4 -0
  26. package/js/src/abstract/gate.d.ts +3 -0
  27. package/js/src/abstract/gateio.d.ts +3 -0
  28. package/js/src/abstract/okx.d.ts +2 -0
  29. package/js/src/base/Exchange.d.ts +1 -1
  30. package/js/src/bingx.js +6 -3
  31. package/js/src/bitget.d.ts +5 -4
  32. package/js/src/bitget.js +71 -0
  33. package/js/src/bitmart.js +9 -13
  34. package/js/src/bybit.js +2 -0
  35. package/js/src/coinbase.js +13 -3
  36. package/js/src/coinex.js +7 -11
  37. package/js/src/cryptocom.js +4 -0
  38. package/js/src/gate.js +4 -0
  39. package/js/src/hitbtc.js +326 -123
  40. package/js/src/idex.js +10 -1
  41. package/js/src/mexc.d.ts +1 -0
  42. package/js/src/mexc.js +33 -5
  43. package/js/src/okx.js +5 -9
  44. package/js/src/pro/binance.js +10 -2
  45. package/js/src/pro/binanceus.js +1 -0
  46. package/js/src/pro/gate.js +1 -1
  47. package/js/src/upbit.js +5 -5
  48. package/package.json +1 -1
  49. package/skip-tests.json +2 -1
  50. package/js/src/huobipro.d.ts +0 -4
  51. package/js/src/huobipro.js +0 -20
  52. package/js/src/mexc3.d.ts +0 -4
  53. package/js/src/mexc3.js +0 -17
  54. package/js/src/okex.d.ts +0 -4
  55. package/js/src/okex.js +0 -17
  56. package/js/src/okex5.d.ts +0 -4
  57. package/js/src/okex5.js +0 -17
  58. package/js/src/tidex.d.ts +0 -36
  59. package/js/src/tidex.js +0 -1068
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.77';
175
+ const version = '4.1.79';
176
176
  Exchange["default"].ccxtVersion = version;
177
177
  const exchanges = {
178
178
  'ace': ace,
@@ -29,7 +29,7 @@ class bingx extends bingx$1 {
29
29
  'cancelAllOrders': true,
30
30
  'cancelOrder': true,
31
31
  'cancelOrders': true,
32
- 'closeAllPosition': true,
32
+ 'closeAllPositions': true,
33
33
  'closePosition': false,
34
34
  'createMarketBuyOrderWithCost': true,
35
35
  'createMarketOrderWithCost': true,
@@ -1344,7 +1344,7 @@ class bingx extends bingx$1 {
1344
1344
  // {
1345
1345
  // "symbol": "BTC-USDT",
1346
1346
  // "priceChange": "52.5",
1347
- // "priceChangePercent": "0.31",
1347
+ // "priceChangePercent": "0.31%", // they started to add the percent sign in value
1348
1348
  // "lastPrice": "16880.5",
1349
1349
  // "lastQty": "2.2238",
1350
1350
  // "highPrice": "16897.5",
@@ -1375,7 +1375,10 @@ class bingx extends bingx$1 {
1375
1375
  const close = this.safeString(ticker, 'lastPrice');
1376
1376
  const quoteVolume = this.safeString(ticker, 'quoteVolume');
1377
1377
  const baseVolume = this.safeString(ticker, 'volume');
1378
- const percentage = this.safeString(ticker, 'priceChangePercent');
1378
+ let percentage = this.safeString(ticker, 'priceChangePercent');
1379
+ if (percentage !== undefined) {
1380
+ percentage = percentage.replace('%', '');
1381
+ }
1379
1382
  const ts = this.safeInteger(ticker, 'closeTime');
1380
1383
  const datetime = this.iso8601(ts);
1381
1384
  const bid = this.safeString(ticker, 'bidPrice');
@@ -35,6 +35,8 @@ class bitget extends bitget$1 {
35
35
  'cancelAllOrders': true,
36
36
  'cancelOrder': true,
37
37
  'cancelOrders': true,
38
+ 'closeAllPositions': true,
39
+ 'closePosition': false,
38
40
  'createOrder': true,
39
41
  'createOrders': true,
40
42
  'createReduceOnlyOrder': false,
@@ -5447,6 +5449,14 @@ class bitget extends bitget$1 {
5447
5449
  // "utime": "1689300238205"
5448
5450
  // }
5449
5451
  //
5452
+ // closeAllPositions
5453
+ //
5454
+ // {
5455
+ // "symbol": "XRPUSDT_UMCBL",
5456
+ // "orderId": "1111861847410757635",
5457
+ // "clientOid": "1111861847410757637"
5458
+ // }
5459
+ //
5450
5460
  const marketId = this.safeString(position, 'symbol');
5451
5461
  market = this.safeMarket(marketId, market);
5452
5462
  const symbol = market['symbol'];
@@ -6997,6 +7007,67 @@ class bitget extends bitget$1 {
6997
7007
  'info': info,
6998
7008
  };
6999
7009
  }
7010
+ async closeAllPositions(params = {}) {
7011
+ /**
7012
+ * @method
7013
+ * @name bitget#closePositions
7014
+ * @description closes open positions for a market
7015
+ * @see https://bitgetlimited.github.io/apidoc/en/mix/#close-all-position
7016
+ * @param {object} [params] extra parameters specific to the okx api endpoint
7017
+ * @param {string} [params.subType] 'linear' or 'inverse'
7018
+ * @param {string} [params.settle] *required and only valid when params.subType === "linear"* 'USDT' or 'USDC'
7019
+ * @returns {[object]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
7020
+ */
7021
+ await this.loadMarkets();
7022
+ let subType = undefined;
7023
+ let settle = undefined;
7024
+ [subType, params] = this.handleSubTypeAndParams('closeAllPositions', undefined, params);
7025
+ settle = this.safeString(params, 'settle', 'USDT');
7026
+ params = this.omit(params, ['settle']);
7027
+ const productType = this.safeString(params, 'productType');
7028
+ const request = {};
7029
+ if (productType === undefined) {
7030
+ const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
7031
+ let localProductType = undefined;
7032
+ if (subType === 'inverse') {
7033
+ localProductType = 'dmcbl';
7034
+ }
7035
+ else {
7036
+ if (settle === 'USDT') {
7037
+ localProductType = 'umcbl';
7038
+ }
7039
+ else if (settle === 'USDC') {
7040
+ localProductType = 'cmcbl';
7041
+ }
7042
+ }
7043
+ if (sandboxMode) {
7044
+ localProductType = 's' + localProductType;
7045
+ }
7046
+ request['productType'] = localProductType;
7047
+ }
7048
+ const response = await this.privateMixPostMixV1OrderCloseAllPositions(this.extend(request, params));
7049
+ //
7050
+ // {
7051
+ // "code": "00000",
7052
+ // "msg": "success",
7053
+ // "requestTime": 1700814442466,
7054
+ // "data": {
7055
+ // "orderInfo": [
7056
+ // {
7057
+ // "symbol": "XRPUSDT_UMCBL",
7058
+ // "orderId": "1111861847410757635",
7059
+ // "clientOid": "1111861847410757637"
7060
+ // },
7061
+ // ],
7062
+ // "failure": [],
7063
+ // "result": true
7064
+ // }
7065
+ // }
7066
+ //
7067
+ const data = this.safeValue(response, 'data', {});
7068
+ const orderInfo = this.safeValue(data, 'orderInfo', []);
7069
+ return this.parsePositions(orderInfo, undefined, params);
7070
+ }
7000
7071
  handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
7001
7072
  if (!response) {
7002
7073
  return undefined; // fallback to default error handler
@@ -3338,19 +3338,15 @@ class bitmart extends bitmart$1 {
3338
3338
  };
3339
3339
  }
3340
3340
  async fetchIsolatedBorrowRate(symbol, params = {}) {
3341
- //
3342
- // @method
3343
- // @name bitmart#fetchIsolatedBorrowRate
3344
- // @description fetch the rate of interest to borrow a currency for margin trading
3345
- // @see https://developer-pro.bitmart.com/en/spot/#get-trading-pair-borrowing-rate-and-amount-keyed
3346
- // @param {string} symbol unified symbol of the market to fetch the borrow rate for
3347
- // @param {object} [params] extra parameters specific to the exchange API endpoint
3348
- // <<<<<<< HEAD
3349
- // @returns {object} a [borrow rate structure]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
3350
- // =======
3351
- // @returns {object} an [isolated borrow rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
3352
- // >>>>>>> 3215552206edf1cda1ae63d2063535e19973dbe5
3353
- //
3341
+ /**
3342
+ * @method
3343
+ * @name bitmart#fetchIsolatedBorrowRate
3344
+ * @description fetch the rate of interest to borrow a currency for margin trading
3345
+ * @see https://developer-pro.bitmart.com/en/spot/#get-trading-pair-borrowing-rate-and-amount-keyed
3346
+ * @param {string} symbol unified symbol of the market to fetch the borrow rate for
3347
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3348
+ * @returns {object} an [isolated borrow rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
3349
+ */
3354
3350
  await this.loadMarkets();
3355
3351
  const market = this.market(symbol);
3356
3352
  const request = {
@@ -344,6 +344,8 @@ class bybit extends bybit$1 {
344
344
  'v5/lending/account': 5,
345
345
  // broker
346
346
  'v5/broker/earning-record': 5,
347
+ 'v5/broker/earnings-info': 5,
348
+ 'v5/broker/account-info': 5,
347
349
  },
348
350
  'post': {
349
351
  // Legacy option USDC
@@ -201,6 +201,7 @@ class coinbase extends coinbase$1 {
201
201
  'brokerage/product_book',
202
202
  'brokerage/best_bid_ask',
203
203
  'brokerage/convert/trade/{trade_id}',
204
+ 'brokerage/time',
204
205
  ],
205
206
  'post': [
206
207
  'brokerage/orders',
@@ -907,7 +908,11 @@ class coinbase extends coinbase$1 {
907
908
  else {
908
909
  cost = costString;
909
910
  }
910
- const feeCurrencyId = this.safeString(feeObject, 'currency');
911
+ let feeCurrencyId = this.safeString(feeObject, 'currency');
912
+ const feeCost = this.safeNumber(feeObject, 'amount', this.parseNumber(v3FeeCost));
913
+ if ((feeCurrencyId === undefined) && (market !== undefined) && (feeCost !== undefined)) {
914
+ feeCurrencyId = market['quote'];
915
+ }
911
916
  const datetime = this.safeStringN(trade, ['created_at', 'trade_time', 'time']);
912
917
  const side = this.safeStringLower2(trade, 'resource', 'side');
913
918
  const takerOrMaker = this.safeStringLower(trade, 'liquidity_indicator');
@@ -925,7 +930,7 @@ class coinbase extends coinbase$1 {
925
930
  'amount': amountString,
926
931
  'cost': cost,
927
932
  'fee': {
928
- 'cost': this.safeNumber(feeObject, 'amount', this.parseNumber(v3FeeCost)),
933
+ 'cost': feeCost,
929
934
  'currency': this.safeCurrencyCode(feeCurrencyId),
930
935
  },
931
936
  });
@@ -2375,6 +2380,11 @@ class coinbase extends coinbase$1 {
2375
2380
  amount = this.safeString(marketIOC, 'base_size');
2376
2381
  }
2377
2382
  const datetime = this.safeString(order, 'created_time');
2383
+ const totalFees = this.safeString(order, 'total_fees');
2384
+ let currencyFee = undefined;
2385
+ if ((totalFees !== undefined) && (market !== undefined)) {
2386
+ currencyFee = market['quote'];
2387
+ }
2378
2388
  return this.safeOrder({
2379
2389
  'info': order,
2380
2390
  'id': this.safeString(order, 'order_id'),
@@ -2398,7 +2408,7 @@ class coinbase extends coinbase$1 {
2398
2408
  'status': this.parseOrderStatus(this.safeString(order, 'status')),
2399
2409
  'fee': {
2400
2410
  'cost': this.safeString(order, 'total_fees'),
2401
- 'currency': undefined,
2411
+ 'currency': currencyFee,
2402
2412
  },
2403
2413
  'trades': undefined,
2404
2414
  }, market);
@@ -4822,17 +4822,13 @@ class coinex extends coinex$1 {
4822
4822
  return this.parseIsolatedBorrowRate(data, market);
4823
4823
  }
4824
4824
  async fetchIsolatedBorrowRates(params = {}) {
4825
- //
4826
- // @method
4827
- // @name coinex#fetchIsolatedBorrowRates
4828
- // @description fetch the borrow interest rates of all currencies
4829
- // @param {object} [params] extra parameters specific to the exchange API endpoint
4830
- // <<<<<<< HEAD
4831
- // @returns {object} a list of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
4832
- // =======
4833
- // @returns {object} a list of [isolated borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
4834
- // >>>>>>> 3215552206edf1cda1ae63d2063535e19973dbe5
4835
- //
4825
+ /**
4826
+ * @method
4827
+ * @name coinex#fetchIsolatedBorrowRates
4828
+ * @description fetch the borrow interest rates of all currencies
4829
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4830
+ * @returns {object} a list of [isolated borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
4831
+ */
4836
4832
  await this.loadMarkets();
4837
4833
  const response = await this.privateGetMarginConfig(params);
4838
4834
  //
@@ -203,6 +203,9 @@ class cryptocom extends cryptocom$1 {
203
203
  'private/get-currency-networks': 10 / 3,
204
204
  'private/get-deposit-history': 10 / 3,
205
205
  'private/get-deposit-address': 10 / 3,
206
+ 'private/export/create-export-request': 10 / 3,
207
+ 'private/export/get-export-requests': 10 / 3,
208
+ 'private/export/download-export-output': 10 / 3,
206
209
  'private/get-account-summary': 10 / 3,
207
210
  'private/create-order': 2 / 3,
208
211
  'private/cancel-order': 2 / 3,
@@ -221,6 +224,7 @@ class cryptocom extends cryptocom$1 {
221
224
  'private/otc/accept-quote': 100,
222
225
  'private/otc/get-quote-history': 10 / 3,
223
226
  'private/otc/get-trade-history': 10 / 3,
227
+ 'private/otc/create-order': 10 / 3,
224
228
  },
225
229
  },
226
230
  },
@@ -45,6 +45,7 @@ class gate extends gate$1 {
45
45
  'spot': 'https://api.gateio.ws/api/v4',
46
46
  'options': 'https://api.gateio.ws/api/v4',
47
47
  'subAccounts': 'https://api.gateio.ws/api/v4',
48
+ 'portfolio': 'https://api.gateio.ws/api/v4',
48
49
  'rebate': 'https://api.gateio.ws/api/v4',
49
50
  'earn': 'https://api.gateio.ws/api/v4',
50
51
  'account': 'https://api.gateio.ws/api/v4',
@@ -482,10 +483,13 @@ class gate extends gate$1 {
482
483
  },
483
484
  'earn': {
484
485
  'get': {
486
+ 'uni/currencies': 20 / 15,
487
+ 'uni/currencies/{currency}': 20 / 15,
485
488
  'uni/lends': 20 / 15,
486
489
  'uni/lend_records': 20 / 15,
487
490
  'uni/interests/{currency}': 20 / 15,
488
491
  'uni/interest_records': 20 / 15,
492
+ 'uni/interest_status/{currency}': 20 / 15,
489
493
  },
490
494
  'post': {
491
495
  'uni/lends': 20 / 15,