ccxt 4.1.77 → 4.1.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 (55) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.js +500 -176
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/bingx.js +3 -2
  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 +12 -3
  10. package/dist/cjs/src/coinex.js +7 -11
  11. package/dist/cjs/src/gate.js +4 -0
  12. package/dist/cjs/src/hitbtc.js +326 -123
  13. package/dist/cjs/src/idex.js +10 -1
  14. package/dist/cjs/src/mexc.js +33 -5
  15. package/dist/cjs/src/okx.js +5 -9
  16. package/dist/cjs/src/pro/binance.js +10 -2
  17. package/dist/cjs/src/pro/binanceus.js +1 -0
  18. package/dist/cjs/src/pro/gate.js +1 -1
  19. package/dist/cjs/src/upbit.js +5 -5
  20. package/js/ccxt.d.ts +1 -1
  21. package/js/ccxt.js +1 -1
  22. package/js/src/abstract/bybit.d.ts +2 -0
  23. package/js/src/abstract/gate.d.ts +3 -0
  24. package/js/src/abstract/gateio.d.ts +3 -0
  25. package/js/src/abstract/okx.d.ts +2 -0
  26. package/js/src/base/Exchange.d.ts +1 -1
  27. package/js/src/bingx.js +3 -2
  28. package/js/src/bitget.d.ts +5 -4
  29. package/js/src/bitget.js +71 -0
  30. package/js/src/bitmart.js +9 -13
  31. package/js/src/bybit.js +2 -0
  32. package/js/src/coinbase.js +12 -3
  33. package/js/src/coinex.js +7 -11
  34. package/js/src/gate.js +4 -0
  35. package/js/src/hitbtc.js +326 -123
  36. package/js/src/idex.js +10 -1
  37. package/js/src/mexc.d.ts +1 -0
  38. package/js/src/mexc.js +33 -5
  39. package/js/src/okx.js +5 -9
  40. package/js/src/pro/binance.js +10 -2
  41. package/js/src/pro/binanceus.js +1 -0
  42. package/js/src/pro/gate.js +1 -1
  43. package/js/src/upbit.js +5 -5
  44. package/package.json +1 -1
  45. package/skip-tests.json +2 -1
  46. package/js/src/huobipro.d.ts +0 -4
  47. package/js/src/huobipro.js +0 -20
  48. package/js/src/mexc3.d.ts +0 -4
  49. package/js/src/mexc3.js +0 -17
  50. package/js/src/okex.d.ts +0 -4
  51. package/js/src/okex.js +0 -17
  52. package/js/src/okex5.d.ts +0 -4
  53. package/js/src/okex5.js +0 -17
  54. package/js/src/tidex.d.ts +0 -36
  55. 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.78';
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,
@@ -1375,7 +1375,8 @@ 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', ''); // priceChangePercent: '5.66%',
1379
+ percentage = percentage.replace('%', '');
1379
1380
  const ts = this.safeInteger(ticker, 'closeTime');
1380
1381
  const datetime = this.iso8601(ts);
1381
1382
  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
@@ -907,7 +907,11 @@ class coinbase extends coinbase$1 {
907
907
  else {
908
908
  cost = costString;
909
909
  }
910
- const feeCurrencyId = this.safeString(feeObject, 'currency');
910
+ let feeCurrencyId = this.safeString(feeObject, 'currency');
911
+ const feeCost = this.safeNumber(feeObject, 'amount', this.parseNumber(v3FeeCost));
912
+ if ((feeCurrencyId === undefined) && (market !== undefined) && (feeCost !== undefined)) {
913
+ feeCurrencyId = market['quote'];
914
+ }
911
915
  const datetime = this.safeStringN(trade, ['created_at', 'trade_time', 'time']);
912
916
  const side = this.safeStringLower2(trade, 'resource', 'side');
913
917
  const takerOrMaker = this.safeStringLower(trade, 'liquidity_indicator');
@@ -925,7 +929,7 @@ class coinbase extends coinbase$1 {
925
929
  'amount': amountString,
926
930
  'cost': cost,
927
931
  'fee': {
928
- 'cost': this.safeNumber(feeObject, 'amount', this.parseNumber(v3FeeCost)),
932
+ 'cost': feeCost,
929
933
  'currency': this.safeCurrencyCode(feeCurrencyId),
930
934
  },
931
935
  });
@@ -2375,6 +2379,11 @@ class coinbase extends coinbase$1 {
2375
2379
  amount = this.safeString(marketIOC, 'base_size');
2376
2380
  }
2377
2381
  const datetime = this.safeString(order, 'created_time');
2382
+ const totalFees = this.safeString(order, 'total_fees');
2383
+ let currencyFee = undefined;
2384
+ if ((totalFees !== undefined) && (market !== undefined)) {
2385
+ currencyFee = market['quote'];
2386
+ }
2378
2387
  return this.safeOrder({
2379
2388
  'info': order,
2380
2389
  'id': this.safeString(order, 'order_id'),
@@ -2398,7 +2407,7 @@ class coinbase extends coinbase$1 {
2398
2407
  'status': this.parseOrderStatus(this.safeString(order, 'status')),
2399
2408
  'fee': {
2400
2409
  'cost': this.safeString(order, 'total_fees'),
2401
- 'currency': undefined,
2410
+ 'currency': currencyFee,
2402
2411
  },
2403
2412
  'trades': undefined,
2404
2413
  }, 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
  //
@@ -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,