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
@@ -1588,7 +1588,16 @@ class idex extends idex$1 {
1588
1588
  // ]
1589
1589
  const method = params['method'];
1590
1590
  params = this.omit(params, 'method');
1591
- const response = await this[method](this.extend(request, params));
1591
+ let response = undefined;
1592
+ if (method === 'privateGetDeposits') {
1593
+ response = await this.privateGetDeposits(this.extend(request, params));
1594
+ }
1595
+ else if (method === 'privateGetWithdrawals') {
1596
+ response = await this.privateGetWithdrawals(this.extend(request, params));
1597
+ }
1598
+ else {
1599
+ throw new errors.NotSupported(this.id + ' fetchTransactionsHelper() not support this method');
1600
+ }
1592
1601
  return this.parseTransactions(response, currency, since, limit);
1593
1602
  }
1594
1603
  parseTransactionStatus(status) {
@@ -37,6 +37,9 @@ class mexc extends mexc$1 {
37
37
  'closeAllPositions': false,
38
38
  'closePosition': false,
39
39
  'createDepositAddress': true,
40
+ 'createMarketBuyOrderWithCost': true,
41
+ 'createMarketOrderWithCost': false,
42
+ 'createMarketSellOrderWithCost': false,
40
43
  'createOrder': true,
41
44
  'createOrders': true,
42
45
  'createReduceOnlyOrder': true,
@@ -2059,11 +2062,33 @@ class mexc extends mexc$1 {
2059
2062
  }
2060
2063
  return this.parseTickers(tickers, symbols);
2061
2064
  }
2065
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
2066
+ /**
2067
+ * @method
2068
+ * @name mexc#createMarketBuyOrderWithCost
2069
+ * @description create a market buy order by providing the symbol and cost
2070
+ * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order
2071
+ * @param {string} symbol unified symbol of the market to create an order in
2072
+ * @param {float} cost how much you want to trade in units of the quote currency
2073
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2074
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2075
+ */
2076
+ await this.loadMarkets();
2077
+ const market = this.market(symbol);
2078
+ if (!market['spot']) {
2079
+ throw new errors.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
2080
+ }
2081
+ params['createMarketBuyOrderRequiresPrice'] = false;
2082
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
2083
+ }
2062
2084
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
2063
2085
  /**
2064
2086
  * @method
2065
2087
  * @name mexc3#createOrder
2066
2088
  * @description create a trade order
2089
+ * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order
2090
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#order-under-maintenance
2091
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#trigger-order-under-maintenance
2067
2092
  * @param {string} symbol unified symbol of the market to create an order in
2068
2093
  * @param {string} type 'market' or 'limit'
2069
2094
  * @param {string} side 'buy' or 'sell'
@@ -2092,13 +2117,16 @@ class mexc extends mexc$1 {
2092
2117
  'type': type.toUpperCase(),
2093
2118
  };
2094
2119
  if (orderSide === 'BUY' && type === 'market') {
2095
- const quoteOrderQty = this.safeNumber(params, 'quoteOrderQty');
2096
- if (quoteOrderQty !== undefined) {
2097
- amount = quoteOrderQty;
2120
+ let createMarketBuyOrderRequiresPrice = true;
2121
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
2122
+ const cost = this.safeNumber2(params, 'cost', 'quoteOrderQty');
2123
+ params = this.omit(params, 'cost');
2124
+ if (cost !== undefined) {
2125
+ amount = cost;
2098
2126
  }
2099
- else if (this.options['createMarketBuyOrderRequiresPrice']) {
2127
+ else if (createMarketBuyOrderRequiresPrice) {
2100
2128
  if (price === undefined) {
2101
- throw new errors.InvalidOrder(this.id + " createOrder() requires the price argument with market buy orders to calculate total order cost (amount to spend), where cost = amount * price. Supply a price argument to createOrder() call if you want the cost to be calculated for you from price and amount, or, alternatively, add .options['createMarketBuyOrderRequiresPrice'] = false to supply the cost in the amount argument (the exchange-specific behaviour)");
2129
+ 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 in the amount argument');
2102
2130
  }
2103
2131
  else {
2104
2132
  const amountString = this.numberToString(amount);
@@ -288,6 +288,7 @@ class okx extends okx$1 {
288
288
  'asset/convert/currencies': 5 / 3,
289
289
  'asset/convert/currency-pair': 5 / 3,
290
290
  'asset/convert/history': 5 / 3,
291
+ 'asset/monthly-statement': 2,
291
292
  // account
292
293
  'account/balance': 2,
293
294
  'account/positions': 2,
@@ -421,6 +422,7 @@ class okx extends okx$1 {
421
422
  'asset/convert-dust-assets': 10,
422
423
  'asset/convert/estimate-quote': 1,
423
424
  'asset/convert/trade': 1,
425
+ 'asset/monthly-statement': 1,
424
426
  // account
425
427
  'account/set-position-mode': 4,
426
428
  'account/set-leverage': 1,
@@ -1054,14 +1056,7 @@ class okx extends okx$1 {
1054
1056
  'commonCurrencies': {
1055
1057
  // the exchange refers to ERC20 version of Aeternity (AEToken)
1056
1058
  'AE': 'AET',
1057
- 'BOX': 'DefiBox',
1058
- 'HOT': 'Hydro Protocol',
1059
- 'HSR': 'HC',
1060
- 'MAG': 'Maggie',
1061
- 'SBTC': 'Super Bitcoin',
1062
- 'TRADE': 'Unitrade',
1063
- 'YOYO': 'YOYOW',
1064
- 'WIN': 'WinToken', // https://github.com/ccxt/ccxt/issues/5701
1059
+ 'WIN': 'WINTOKEN', // https://github.com/ccxt/ccxt/issues/5701
1065
1060
  },
1066
1061
  });
1067
1062
  }
@@ -3087,6 +3082,7 @@ class okx extends okx$1 {
3087
3082
  * @param {string[]} ids order ids
3088
3083
  * @param {string} symbol unified market symbol
3089
3084
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3085
+ * @param {boolean} [params.trigger] whether the order is a stop/trigger order
3090
3086
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
3091
3087
  */
3092
3088
  // TODO : the original endpoint signature differs, according to that you can skip individual symbol and assign ids in batch. At this moment, `params` is not being used too.
@@ -3101,7 +3097,7 @@ class okx extends okx$1 {
3101
3097
  let method = this.safeString(params, 'method', defaultMethod);
3102
3098
  const clientOrderIds = this.parseIds(this.safeValue2(params, 'clOrdId', 'clientOrderId'));
3103
3099
  const algoIds = this.parseIds(this.safeValue(params, 'algoId'));
3104
- const stop = this.safeValue(params, 'stop');
3100
+ const stop = this.safeValue2(params, 'stop', 'trigger');
3105
3101
  if (stop) {
3106
3102
  method = 'privatePostTradeCancelAlgos';
3107
3103
  }
@@ -1646,18 +1646,26 @@ class binance extends binance$1 {
1646
1646
  const url = this.urls['api']['ws']['ws'];
1647
1647
  const requestId = this.requestId(url);
1648
1648
  const messageHash = requestId.toString();
1649
+ const sor = this.safeValue2(params, 'sor', 'SOR', false);
1650
+ params = this.omit(params, 'sor', 'SOR');
1649
1651
  const payload = this.createOrderRequest(symbol, type, side, amount, price, params);
1650
1652
  let returnRateLimits = false;
1651
1653
  [returnRateLimits, params] = this.handleOptionAndParams(params, 'createOrderWs', 'returnRateLimits', false);
1652
1654
  payload['returnRateLimits'] = returnRateLimits;
1655
+ const test = this.safeValue(params, 'test', false);
1656
+ params = this.omit(params, 'test');
1653
1657
  const message = {
1654
1658
  'id': messageHash,
1655
1659
  'method': 'order.place',
1656
1660
  'params': this.signParams(this.extend(payload, params)),
1657
1661
  };
1658
- const test = this.safeValue(params, 'test', false);
1659
1662
  if (test) {
1660
- message['method'] = 'order.test';
1663
+ if (sor) {
1664
+ message['method'] = 'sor.order.test';
1665
+ }
1666
+ else {
1667
+ message['method'] = 'order.test';
1668
+ }
1661
1669
  }
1662
1670
  const subscription = {
1663
1671
  'method': this.handleOrderWs,
@@ -18,6 +18,7 @@ class binanceus extends binance {
18
18
  'spot': 'wss://stream.binance.us:9443/ws',
19
19
  },
20
20
  'web': 'https://www.binance.us',
21
+ 'sapi': 'https://api.binance.us/sapi/v1',
21
22
  'wapi': 'https://api.binance.us/wapi/v3',
22
23
  'public': 'https://api.binance.us/api/v1',
23
24
  'private': 'https://api.binance.us/api/v3',
@@ -283,7 +283,7 @@ class gate extends gate$1 {
283
283
  const marketId = market['id'];
284
284
  const url = this.getUrlByMarket(market);
285
285
  const messageType = this.getTypeByMarket(market);
286
- const [topic, query] = this.handleOptionAndParams(params, 'watchTicker', 'method', 'tickers');
286
+ const [topic, query] = this.handleOptionAndParams(params, 'watchTicker', 'name', 'tickers');
287
287
  const channel = messageType + '.' + topic;
288
288
  const messageHash = 'ticker:' + symbol;
289
289
  const payload = [marketId];
@@ -1710,6 +1710,7 @@ class upbit extends upbit$1 {
1710
1710
  /**
1711
1711
  * @method
1712
1712
  * @name upbit#withdraw
1713
+ * @see https://docs.upbit.com/reference/디지털자산-출금하기
1713
1714
  * @see https://docs.upbit.com/reference/%EC%9B%90%ED%99%94-%EC%B6%9C%EA%B8%88%ED%95%98%EA%B8%B0
1714
1715
  * @description make a withdrawal
1715
1716
  * @param {string} code unified currency code
@@ -1720,14 +1721,14 @@ class upbit extends upbit$1 {
1720
1721
  * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1721
1722
  */
1722
1723
  [tag, params] = this.handleWithdrawTagAndParams(tag, params);
1723
- this.checkAddress(address);
1724
1724
  await this.loadMarkets();
1725
1725
  const currency = this.currency(code);
1726
1726
  const request = {
1727
1727
  'amount': amount,
1728
1728
  };
1729
- let method = 'privatePostWithdraws';
1729
+ let response = undefined;
1730
1730
  if (code !== 'KRW') {
1731
+ this.checkAddress(address);
1731
1732
  // 2023-05-23 Change to required parameters for digital assets
1732
1733
  const network = this.safeStringUpper2(params, 'network', 'net_type');
1733
1734
  if (network === undefined) {
@@ -1735,18 +1736,17 @@ class upbit extends upbit$1 {
1735
1736
  }
1736
1737
  params = this.omit(params, ['network']);
1737
1738
  request['net_type'] = network;
1738
- method += 'Coin';
1739
1739
  request['currency'] = currency['id'];
1740
1740
  request['address'] = address;
1741
1741
  if (tag !== undefined) {
1742
1742
  request['secondary_address'] = tag;
1743
1743
  }
1744
1744
  params = this.omit(params, 'network');
1745
+ response = await this.privatePostWithdrawsCoin(this.extend(request, params));
1745
1746
  }
1746
1747
  else {
1747
- method += 'Krw';
1748
+ response = await this.privatePostWithdrawsKrw(this.extend(request, params));
1748
1749
  }
1749
- const response = await this[method](this.extend(request, params));
1750
1750
  //
1751
1751
  // {
1752
1752
  // "type": "withdraw",
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 { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
7
- declare const version = "4.1.76";
7
+ declare const version = "4.1.77";
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, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.1.77';
41
+ const version = '4.1.78';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -168,6 +168,8 @@ interface Exchange {
168
168
  privateGetV5LendingHistoryOrder(params?: {}): Promise<implicitReturnType>;
169
169
  privateGetV5LendingAccount(params?: {}): Promise<implicitReturnType>;
170
170
  privateGetV5BrokerEarningRecord(params?: {}): Promise<implicitReturnType>;
171
+ privateGetV5BrokerEarningsInfo(params?: {}): Promise<implicitReturnType>;
172
+ privateGetV5BrokerAccountInfo(params?: {}): Promise<implicitReturnType>;
171
173
  privatePostOptionUsdcOpenapiPrivateV1PlaceOrder(params?: {}): Promise<implicitReturnType>;
172
174
  privatePostOptionUsdcOpenapiPrivateV1ReplaceOrder(params?: {}): Promise<implicitReturnType>;
173
175
  privatePostOptionUsdcOpenapiPrivateV1CancelOrder(params?: {}): Promise<implicitReturnType>;
@@ -216,10 +216,13 @@ interface Exchange {
216
216
  privateOptionsPostOrders(params?: {}): Promise<implicitReturnType>;
217
217
  privateOptionsDeleteOrders(params?: {}): Promise<implicitReturnType>;
218
218
  privateOptionsDeleteOrdersOrderId(params?: {}): Promise<implicitReturnType>;
219
+ privateEarnGetUniCurrencies(params?: {}): Promise<implicitReturnType>;
220
+ privateEarnGetUniCurrenciesCurrency(params?: {}): Promise<implicitReturnType>;
219
221
  privateEarnGetUniLends(params?: {}): Promise<implicitReturnType>;
220
222
  privateEarnGetUniLendRecords(params?: {}): Promise<implicitReturnType>;
221
223
  privateEarnGetUniInterestsCurrency(params?: {}): Promise<implicitReturnType>;
222
224
  privateEarnGetUniInterestRecords(params?: {}): Promise<implicitReturnType>;
225
+ privateEarnGetUniInterestStatusCurrency(params?: {}): Promise<implicitReturnType>;
223
226
  privateEarnPostUniLends(params?: {}): Promise<implicitReturnType>;
224
227
  privateEarnPutUniInterestReinvest(params?: {}): Promise<implicitReturnType>;
225
228
  privateEarnPatchUniLends(params?: {}): Promise<implicitReturnType>;
@@ -216,10 +216,13 @@ interface gate {
216
216
  privateOptionsPostOrders(params?: {}): Promise<implicitReturnType>;
217
217
  privateOptionsDeleteOrders(params?: {}): Promise<implicitReturnType>;
218
218
  privateOptionsDeleteOrdersOrderId(params?: {}): Promise<implicitReturnType>;
219
+ privateEarnGetUniCurrencies(params?: {}): Promise<implicitReturnType>;
220
+ privateEarnGetUniCurrenciesCurrency(params?: {}): Promise<implicitReturnType>;
219
221
  privateEarnGetUniLends(params?: {}): Promise<implicitReturnType>;
220
222
  privateEarnGetUniLendRecords(params?: {}): Promise<implicitReturnType>;
221
223
  privateEarnGetUniInterestsCurrency(params?: {}): Promise<implicitReturnType>;
222
224
  privateEarnGetUniInterestRecords(params?: {}): Promise<implicitReturnType>;
225
+ privateEarnGetUniInterestStatusCurrency(params?: {}): Promise<implicitReturnType>;
223
226
  privateEarnPostUniLends(params?: {}): Promise<implicitReturnType>;
224
227
  privateEarnPutUniInterestReinvest(params?: {}): Promise<implicitReturnType>;
225
228
  privateEarnPatchUniLends(params?: {}): Promise<implicitReturnType>;
@@ -109,6 +109,7 @@ interface Exchange {
109
109
  privateGetAssetConvertCurrencies(params?: {}): Promise<implicitReturnType>;
110
110
  privateGetAssetConvertCurrencyPair(params?: {}): Promise<implicitReturnType>;
111
111
  privateGetAssetConvertHistory(params?: {}): Promise<implicitReturnType>;
112
+ privateGetAssetMonthlyStatement(params?: {}): Promise<implicitReturnType>;
112
113
  privateGetAccountBalance(params?: {}): Promise<implicitReturnType>;
113
114
  privateGetAccountPositions(params?: {}): Promise<implicitReturnType>;
114
115
  privateGetAccountPositionsHistory(params?: {}): Promise<implicitReturnType>;
@@ -228,6 +229,7 @@ interface Exchange {
228
229
  privatePostAssetConvertDustAssets(params?: {}): Promise<implicitReturnType>;
229
230
  privatePostAssetConvertEstimateQuote(params?: {}): Promise<implicitReturnType>;
230
231
  privatePostAssetConvertTrade(params?: {}): Promise<implicitReturnType>;
232
+ privatePostAssetMonthlyStatement(params?: {}): Promise<implicitReturnType>;
231
233
  privatePostAccountSetPositionMode(params?: {}): Promise<implicitReturnType>;
232
234
  privatePostAccountSetLeverage(params?: {}): Promise<implicitReturnType>;
233
235
  privatePostAccountPositionMarginBalance(params?: {}): Promise<implicitReturnType>;
@@ -792,7 +792,7 @@ export default class Exchange {
792
792
  fetchOpenInterest(symbol: string, params?: {}): Promise<OpenInterest>;
793
793
  fetchFundingRateHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
794
794
  fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
795
- closePosition(symbol: string, side?: OrderSide, marginMode?: string, params?: {}): Promise<Position>;
795
+ closePosition(symbol: string, side?: OrderSide, marginMode?: string, params?: {}): Promise<Order>;
796
796
  closeAllPositions(params?: {}): Promise<Position[]>;
797
797
  parseLastPrice(price: any, market?: Market): any;
798
798
  fetchDepositAddress(code: string, params?: {}): Promise<any>;
package/js/src/bingx.js CHANGED
@@ -32,7 +32,7 @@ export default class bingx extends Exchange {
32
32
  'cancelAllOrders': true,
33
33
  'cancelOrder': true,
34
34
  'cancelOrders': true,
35
- 'closeAllPosition': true,
35
+ 'closeAllPositions': true,
36
36
  'closePosition': false,
37
37
  'createMarketBuyOrderWithCost': true,
38
38
  'createMarketOrderWithCost': true,
@@ -1378,7 +1378,8 @@ export default class bingx extends Exchange {
1378
1378
  const close = this.safeString(ticker, 'lastPrice');
1379
1379
  const quoteVolume = this.safeString(ticker, 'quoteVolume');
1380
1380
  const baseVolume = this.safeString(ticker, 'volume');
1381
- const percentage = this.safeString(ticker, 'priceChangePercent');
1381
+ let percentage = this.safeString(ticker, 'priceChangePercent', ''); // priceChangePercent: '5.66%',
1382
+ percentage = percentage.replace('%', '');
1382
1383
  const ts = this.safeInteger(ticker, 'closeTime');
1383
1384
  const datetime = this.iso8601(ts);
1384
1385
  const bid = this.safeString(ticker, 'bidPrice');
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bitget.js';
2
- import { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, FundingHistory, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency } from './base/types.js';
2
+ import { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, FundingHistory, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency, Position } from './base/types.js';
3
3
  /**
4
4
  * @class bitget
5
5
  * @extends Exchange
@@ -111,9 +111,9 @@ export default class bitget extends Exchange {
111
111
  };
112
112
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
113
113
  fetchOrderTrades(id: string, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
114
- fetchPosition(symbol: string, params?: {}): Promise<import("./base/types.js").Position>;
115
- fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
116
- parsePosition(position: any, market?: Market): import("./base/types.js").Position;
114
+ fetchPosition(symbol: string, params?: {}): Promise<Position>;
115
+ fetchPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
116
+ parsePosition(position: any, market?: Market): Position;
117
117
  fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
118
118
  fetchFundingRate(symbol: string, params?: {}): Promise<{
119
119
  info: any;
@@ -315,6 +315,7 @@ export default class bitget extends Exchange {
315
315
  datetime: string;
316
316
  info: any;
317
317
  };
318
+ closeAllPositions(params?: {}): Promise<Position[]>;
318
319
  handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
319
320
  sign(path: any, api?: any[], method?: string, params?: {}, headers?: any, body?: any): {
320
321
  url: string;
package/js/src/bitget.js CHANGED
@@ -38,6 +38,8 @@ export default class bitget extends Exchange {
38
38
  'cancelAllOrders': true,
39
39
  'cancelOrder': true,
40
40
  'cancelOrders': true,
41
+ 'closeAllPositions': true,
42
+ 'closePosition': false,
41
43
  'createOrder': true,
42
44
  'createOrders': true,
43
45
  'createReduceOnlyOrder': false,
@@ -5450,6 +5452,14 @@ export default class bitget extends Exchange {
5450
5452
  // "utime": "1689300238205"
5451
5453
  // }
5452
5454
  //
5455
+ // closeAllPositions
5456
+ //
5457
+ // {
5458
+ // "symbol": "XRPUSDT_UMCBL",
5459
+ // "orderId": "1111861847410757635",
5460
+ // "clientOid": "1111861847410757637"
5461
+ // }
5462
+ //
5453
5463
  const marketId = this.safeString(position, 'symbol');
5454
5464
  market = this.safeMarket(marketId, market);
5455
5465
  const symbol = market['symbol'];
@@ -7000,6 +7010,67 @@ export default class bitget extends Exchange {
7000
7010
  'info': info,
7001
7011
  };
7002
7012
  }
7013
+ async closeAllPositions(params = {}) {
7014
+ /**
7015
+ * @method
7016
+ * @name bitget#closePositions
7017
+ * @description closes open positions for a market
7018
+ * @see https://bitgetlimited.github.io/apidoc/en/mix/#close-all-position
7019
+ * @param {object} [params] extra parameters specific to the okx api endpoint
7020
+ * @param {string} [params.subType] 'linear' or 'inverse'
7021
+ * @param {string} [params.settle] *required and only valid when params.subType === "linear"* 'USDT' or 'USDC'
7022
+ * @returns {[object]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
7023
+ */
7024
+ await this.loadMarkets();
7025
+ let subType = undefined;
7026
+ let settle = undefined;
7027
+ [subType, params] = this.handleSubTypeAndParams('closeAllPositions', undefined, params);
7028
+ settle = this.safeString(params, 'settle', 'USDT');
7029
+ params = this.omit(params, ['settle']);
7030
+ const productType = this.safeString(params, 'productType');
7031
+ const request = {};
7032
+ if (productType === undefined) {
7033
+ const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
7034
+ let localProductType = undefined;
7035
+ if (subType === 'inverse') {
7036
+ localProductType = 'dmcbl';
7037
+ }
7038
+ else {
7039
+ if (settle === 'USDT') {
7040
+ localProductType = 'umcbl';
7041
+ }
7042
+ else if (settle === 'USDC') {
7043
+ localProductType = 'cmcbl';
7044
+ }
7045
+ }
7046
+ if (sandboxMode) {
7047
+ localProductType = 's' + localProductType;
7048
+ }
7049
+ request['productType'] = localProductType;
7050
+ }
7051
+ const response = await this.privateMixPostMixV1OrderCloseAllPositions(this.extend(request, params));
7052
+ //
7053
+ // {
7054
+ // "code": "00000",
7055
+ // "msg": "success",
7056
+ // "requestTime": 1700814442466,
7057
+ // "data": {
7058
+ // "orderInfo": [
7059
+ // {
7060
+ // "symbol": "XRPUSDT_UMCBL",
7061
+ // "orderId": "1111861847410757635",
7062
+ // "clientOid": "1111861847410757637"
7063
+ // },
7064
+ // ],
7065
+ // "failure": [],
7066
+ // "result": true
7067
+ // }
7068
+ // }
7069
+ //
7070
+ const data = this.safeValue(response, 'data', {});
7071
+ const orderInfo = this.safeValue(data, 'orderInfo', []);
7072
+ return this.parsePositions(orderInfo, undefined, params);
7073
+ }
7003
7074
  handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
7004
7075
  if (!response) {
7005
7076
  return undefined; // fallback to default error handler
package/js/src/bitmart.js CHANGED
@@ -3341,19 +3341,15 @@ export default class bitmart extends Exchange {
3341
3341
  };
3342
3342
  }
3343
3343
  async fetchIsolatedBorrowRate(symbol, params = {}) {
3344
- //
3345
- // @method
3346
- // @name bitmart#fetchIsolatedBorrowRate
3347
- // @description fetch the rate of interest to borrow a currency for margin trading
3348
- // @see https://developer-pro.bitmart.com/en/spot/#get-trading-pair-borrowing-rate-and-amount-keyed
3349
- // @param {string} symbol unified symbol of the market to fetch the borrow rate for
3350
- // @param {object} [params] extra parameters specific to the exchange API endpoint
3351
- // <<<<<<< HEAD
3352
- // @returns {object} a [borrow rate structure]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
3353
- // =======
3354
- // @returns {object} an [isolated borrow rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
3355
- // >>>>>>> 3215552206edf1cda1ae63d2063535e19973dbe5
3356
- //
3344
+ /**
3345
+ * @method
3346
+ * @name bitmart#fetchIsolatedBorrowRate
3347
+ * @description fetch the rate of interest to borrow a currency for margin trading
3348
+ * @see https://developer-pro.bitmart.com/en/spot/#get-trading-pair-borrowing-rate-and-amount-keyed
3349
+ * @param {string} symbol unified symbol of the market to fetch the borrow rate for
3350
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3351
+ * @returns {object} an [isolated borrow rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
3352
+ */
3357
3353
  await this.loadMarkets();
3358
3354
  const market = this.market(symbol);
3359
3355
  const request = {
package/js/src/bybit.js CHANGED
@@ -347,6 +347,8 @@ export default class bybit extends Exchange {
347
347
  'v5/lending/account': 5,
348
348
  // broker
349
349
  'v5/broker/earning-record': 5,
350
+ 'v5/broker/earnings-info': 5,
351
+ 'v5/broker/account-info': 5,
350
352
  },
351
353
  'post': {
352
354
  // Legacy option USDC
@@ -910,7 +910,11 @@ export default class coinbase extends Exchange {
910
910
  else {
911
911
  cost = costString;
912
912
  }
913
- const feeCurrencyId = this.safeString(feeObject, 'currency');
913
+ let feeCurrencyId = this.safeString(feeObject, 'currency');
914
+ const feeCost = this.safeNumber(feeObject, 'amount', this.parseNumber(v3FeeCost));
915
+ if ((feeCurrencyId === undefined) && (market !== undefined) && (feeCost !== undefined)) {
916
+ feeCurrencyId = market['quote'];
917
+ }
914
918
  const datetime = this.safeStringN(trade, ['created_at', 'trade_time', 'time']);
915
919
  const side = this.safeStringLower2(trade, 'resource', 'side');
916
920
  const takerOrMaker = this.safeStringLower(trade, 'liquidity_indicator');
@@ -928,7 +932,7 @@ export default class coinbase extends Exchange {
928
932
  'amount': amountString,
929
933
  'cost': cost,
930
934
  'fee': {
931
- 'cost': this.safeNumber(feeObject, 'amount', this.parseNumber(v3FeeCost)),
935
+ 'cost': feeCost,
932
936
  'currency': this.safeCurrencyCode(feeCurrencyId),
933
937
  },
934
938
  });
@@ -2378,6 +2382,11 @@ export default class coinbase extends Exchange {
2378
2382
  amount = this.safeString(marketIOC, 'base_size');
2379
2383
  }
2380
2384
  const datetime = this.safeString(order, 'created_time');
2385
+ const totalFees = this.safeString(order, 'total_fees');
2386
+ let currencyFee = undefined;
2387
+ if ((totalFees !== undefined) && (market !== undefined)) {
2388
+ currencyFee = market['quote'];
2389
+ }
2381
2390
  return this.safeOrder({
2382
2391
  'info': order,
2383
2392
  'id': this.safeString(order, 'order_id'),
@@ -2401,7 +2410,7 @@ export default class coinbase extends Exchange {
2401
2410
  'status': this.parseOrderStatus(this.safeString(order, 'status')),
2402
2411
  'fee': {
2403
2412
  'cost': this.safeString(order, 'total_fees'),
2404
- 'currency': undefined,
2413
+ 'currency': currencyFee,
2405
2414
  },
2406
2415
  'trades': undefined,
2407
2416
  }, market);
package/js/src/coinex.js CHANGED
@@ -4825,17 +4825,13 @@ export default class coinex extends Exchange {
4825
4825
  return this.parseIsolatedBorrowRate(data, market);
4826
4826
  }
4827
4827
  async fetchIsolatedBorrowRates(params = {}) {
4828
- //
4829
- // @method
4830
- // @name coinex#fetchIsolatedBorrowRates
4831
- // @description fetch the borrow interest rates of all currencies
4832
- // @param {object} [params] extra parameters specific to the exchange API endpoint
4833
- // <<<<<<< HEAD
4834
- // @returns {object} a list of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
4835
- // =======
4836
- // @returns {object} a list of [isolated borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
4837
- // >>>>>>> 3215552206edf1cda1ae63d2063535e19973dbe5
4838
- //
4828
+ /**
4829
+ * @method
4830
+ * @name coinex#fetchIsolatedBorrowRates
4831
+ * @description fetch the borrow interest rates of all currencies
4832
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4833
+ * @returns {object} a list of [isolated borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
4834
+ */
4839
4835
  await this.loadMarkets();
4840
4836
  const response = await this.privateGetMarginConfig(params);
4841
4837
  //
package/js/src/gate.js CHANGED
@@ -48,6 +48,7 @@ export default class gate extends Exchange {
48
48
  'spot': 'https://api.gateio.ws/api/v4',
49
49
  'options': 'https://api.gateio.ws/api/v4',
50
50
  'subAccounts': 'https://api.gateio.ws/api/v4',
51
+ 'portfolio': 'https://api.gateio.ws/api/v4',
51
52
  'rebate': 'https://api.gateio.ws/api/v4',
52
53
  'earn': 'https://api.gateio.ws/api/v4',
53
54
  'account': 'https://api.gateio.ws/api/v4',
@@ -485,10 +486,13 @@ export default class gate extends Exchange {
485
486
  },
486
487
  'earn': {
487
488
  'get': {
489
+ 'uni/currencies': 20 / 15,
490
+ 'uni/currencies/{currency}': 20 / 15,
488
491
  'uni/lends': 20 / 15,
489
492
  'uni/lend_records': 20 / 15,
490
493
  'uni/interests/{currency}': 20 / 15,
491
494
  'uni/interest_records': 20 / 15,
495
+ 'uni/interest_status/{currency}': 20 / 15,
492
496
  },
493
497
  'post': {
494
498
  'uni/lends': 20 / 15,