ccxt 4.1.91 → 4.1.95

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.
@@ -31,6 +31,7 @@ class hitbtc extends hitbtc$1 {
31
31
  'addMargin': true,
32
32
  'cancelAllOrders': true,
33
33
  'cancelOrder': true,
34
+ 'closePosition': false,
34
35
  'createDepositAddress': true,
35
36
  'createOrder': true,
36
37
  'createPostOnlyOrder': true,
@@ -2870,6 +2871,9 @@ class hitbtc extends hitbtc$1 {
2870
2871
  let marketType = undefined;
2871
2872
  let marginMode = undefined;
2872
2873
  [marketType, params] = this.handleMarketTypeAndParams('fetchPositions', undefined, params);
2874
+ if (marketType === 'spot') {
2875
+ marketType = 'swap';
2876
+ }
2873
2877
  [marginMode, params] = this.handleMarginModeAndParams('fetchPositions', params);
2874
2878
  params = this.omit(params, ['marginMode', 'margin']);
2875
2879
  let response = undefined;
@@ -3528,6 +3532,43 @@ class hitbtc extends hitbtc$1 {
3528
3532
  }
3529
3533
  return result;
3530
3534
  }
3535
+ async closePosition(symbol, side = undefined, params = {}) {
3536
+ /**
3537
+ * @method
3538
+ * @name hitbtc#closePosition
3539
+ * @description closes open positions for a market
3540
+ * @see https://api.hitbtc.com/#close-all-futures-margin-positions
3541
+ * @param {object} [params] extra parameters specific to the okx api endpoint
3542
+ * @param {string} [params.symbol] *required* unified market symbol
3543
+ * @param {string} [params.marginMode] 'cross' or 'isolated', default is 'cross'
3544
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3545
+ */
3546
+ await this.loadMarkets();
3547
+ let marginMode = undefined;
3548
+ [marginMode, params] = this.handleMarginModeAndParams('closePosition', params, 'cross');
3549
+ const market = this.market(symbol);
3550
+ const request = {
3551
+ 'symbol': market['id'],
3552
+ 'margin_mode': marginMode,
3553
+ };
3554
+ const response = await this.privateDeleteFuturesPositionMarginModeSymbol(this.extend(request, params));
3555
+ //
3556
+ // {
3557
+ // "id":"202471640",
3558
+ // "symbol":"TRXUSDT_PERP",
3559
+ // "margin_mode":"Cross",
3560
+ // "leverage":"1.00",
3561
+ // "quantity":"0",
3562
+ // "price_entry":"0",
3563
+ // "price_margin_call":"0",
3564
+ // "price_liquidation":"0",
3565
+ // "pnl":"0.001234100000",
3566
+ // "created_at":"2023-10-29T14:46:13.235Z",
3567
+ // "updated_at":"2023-12-19T09:34:40.014Z"
3568
+ // }
3569
+ //
3570
+ return this.parseOrder(response, market);
3571
+ }
3531
3572
  handleMarginModeAndParams(methodName, params = {}, defaultValue = undefined) {
3532
3573
  /**
3533
3574
  * @ignore
@@ -29,14 +29,14 @@ class kucoinfutures extends kucoinfutures$1 {
29
29
  'addMargin': true,
30
30
  'cancelAllOrders': true,
31
31
  'cancelOrder': true,
32
+ 'closePosition': true,
33
+ 'closePositions': false,
32
34
  'createDepositAddress': true,
33
35
  'createOrder': true,
34
36
  'createReduceOnlyOrder': true,
35
37
  'createStopLimitOrder': true,
36
38
  'createStopMarketOrder': true,
37
39
  'createStopOrder': true,
38
- 'closePosition': true,
39
- 'closePositions': false,
40
40
  'fetchAccounts': true,
41
41
  'fetchBalance': true,
42
42
  'fetchBorrowRateHistories': false,
@@ -151,6 +151,7 @@ class kucoinfutures extends kucoinfutures$1 {
151
151
  'positions': 4.44,
152
152
  'funding-history': 4.44,
153
153
  'sub/api-key': 1,
154
+ 'trade-statistics': 1,
154
155
  },
155
156
  'post': {
156
157
  'withdrawals': 1,
@@ -172,6 +173,7 @@ class kucoinfutures extends kucoinfutures$1 {
172
173
  'orders': 4.44,
173
174
  'stopOrders': 1,
174
175
  'sub/api-key': 1,
176
+ 'orders/client-order/{clientOid}': 1,
175
177
  },
176
178
  },
177
179
  'webExchange': {
@@ -1234,13 +1236,27 @@ class kucoinfutures extends kucoinfutures$1 {
1234
1236
  * @param {string} id order id
1235
1237
  * @param {string} symbol unified symbol of the market the order was made in
1236
1238
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1239
+ * @param {string} [params.clientOrderId] cancel order by client order id
1237
1240
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1238
1241
  */
1239
1242
  await this.loadMarkets();
1240
- const request = {
1241
- 'orderId': id,
1242
- };
1243
- const response = await this.futuresPrivateDeleteOrdersOrderId(this.extend(request, params));
1243
+ const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
1244
+ params = this.omit(params, ['clientOrderId']);
1245
+ const request = {};
1246
+ let response = undefined;
1247
+ if (clientOrderId !== undefined) {
1248
+ if (symbol === undefined) {
1249
+ throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument when cancelling by clientOrderId');
1250
+ }
1251
+ const market = this.market(symbol);
1252
+ request['symbol'] = market['id'];
1253
+ request['clientOid'] = clientOrderId;
1254
+ response = await this.futuresPrivateDeleteOrdersClientOrderClientOid(this.extend(request, params));
1255
+ }
1256
+ else {
1257
+ request['orderId'] = id;
1258
+ response = await this.futuresPrivateDeleteOrdersOrderId(this.extend(request, params));
1259
+ }
1244
1260
  //
1245
1261
  // {
1246
1262
  // "code": "200000",
@@ -250,6 +250,7 @@ class okx extends okx$1 {
250
250
  // rfq
251
251
  'rfq/counterparties': 4,
252
252
  'rfq/maker-instrument-settings': 4,
253
+ 'rfq/mmp-config': 4,
253
254
  'rfq/rfqs': 10,
254
255
  'rfq/quotes': 10,
255
256
  'rfq/trades': 4,
@@ -389,6 +390,7 @@ class okx extends okx$1 {
389
390
  'rfq/execute-quote': 15,
390
391
  'rfq/maker-instrument-settings': 4,
391
392
  'rfq/mmp-reset': 4,
393
+ 'rfq/mmp-config': 100,
392
394
  'rfq/create-quote': 0.4,
393
395
  'rfq/cancel-quote': 0.4,
394
396
  'rfq/cancel-batch-quotes': 10,
@@ -3,6 +3,7 @@
3
3
  var bingx$1 = require('../bingx.js');
4
4
  var errors = require('../base/errors.js');
5
5
  var Cache = require('../base/ws/Cache.js');
6
+ var Precise = require('../base/Precise.js');
6
7
 
7
8
  // ---------------------------------------------------------------------------
8
9
  // ---------------------------------------------------------------------------
@@ -60,6 +61,10 @@ class bingx extends bingx$1 {
60
61
  '1d': '1day',
61
62
  },
62
63
  },
64
+ 'watchBalance': {
65
+ 'fetchBalanceSnapshot': true,
66
+ 'awaitBalanceSnapshot': false, // whether to wait for the balance snapshot before providing updates
67
+ },
63
68
  },
64
69
  'streaming': {
65
70
  'keepAlive': 1800000, // 30 minutes
@@ -547,8 +552,41 @@ class bingx extends bingx$1 {
547
552
  'dataType': 'ACCOUNT_UPDATE',
548
553
  };
549
554
  }
555
+ const client = this.client(url);
556
+ this.setBalanceCache(client, type, subscriptionHash, params);
557
+ let fetchBalanceSnapshot = undefined;
558
+ let awaitBalanceSnapshot = undefined;
559
+ [fetchBalanceSnapshot, params] = this.handleOptionAndParams(params, 'watchBalance', 'fetchBalanceSnapshot', true);
560
+ [awaitBalanceSnapshot, params] = this.handleOptionAndParams(params, 'watchBalance', 'awaitBalanceSnapshot', false);
561
+ if (fetchBalanceSnapshot && awaitBalanceSnapshot) {
562
+ await client.future(type + ':fetchBalanceSnapshot');
563
+ }
550
564
  return await this.watch(url, messageHash, request, subscriptionHash);
551
565
  }
566
+ setBalanceCache(client, type, subscriptionHash, params) {
567
+ if (subscriptionHash in client.subscriptions) {
568
+ return undefined;
569
+ }
570
+ const fetchBalanceSnapshot = this.handleOptionAndParams(params, 'watchBalance', 'fetchBalanceSnapshot', true);
571
+ if (fetchBalanceSnapshot) {
572
+ const messageHash = type + ':fetchBalanceSnapshot';
573
+ if (!(messageHash in client.futures)) {
574
+ client.future(messageHash);
575
+ this.spawn(this.loadBalanceSnapshot, client, messageHash, type);
576
+ }
577
+ }
578
+ else {
579
+ this.balance[type] = {};
580
+ }
581
+ }
582
+ async loadBalanceSnapshot(client, messageHash, type) {
583
+ const response = await this.fetchBalance({ 'type': type });
584
+ this.balance[type] = this.extend(response, this.safeValue(this.balance, type, {}));
585
+ // don't remove the future from the .futures cache
586
+ const future = client.futures[messageHash];
587
+ future.resolve();
588
+ client.resolve(this.balance[type], type + ':balance');
589
+ }
552
590
  handleErrorMessage(client, message) {
553
591
  //
554
592
  // { code: 100400, msg: '', timestamp: 1696245808833 }
@@ -831,9 +869,6 @@ class bingx extends bingx$1 {
831
869
  const data = this.safeValue(a, 'B', []);
832
870
  const timestamp = this.safeInteger2(message, 'T', 'E');
833
871
  const type = ('P' in a) ? 'swap' : 'spot';
834
- if (!(type in this.balance)) {
835
- this.balance[type] = {};
836
- }
837
872
  this.balance[type]['info'] = data;
838
873
  this.balance[type]['timestamp'] = timestamp;
839
874
  this.balance[type]['datetime'] = this.iso8601(timestamp);
@@ -841,8 +876,12 @@ class bingx extends bingx$1 {
841
876
  const balance = data[i];
842
877
  const currencyId = this.safeString(balance, 'a');
843
878
  const code = this.safeCurrencyCode(currencyId);
844
- const account = (code in this.balance) ? this.balance[code] : this.account();
845
- account['total'] = this.safeString(balance, 'wb');
879
+ const account = (code in this.balance[type]) ? this.balance[type][code] : this.account();
880
+ account['free'] = this.safeString(balance, 'wb');
881
+ const balanceChange = this.safeString(balance, 'bc');
882
+ if (account['used'] !== undefined) {
883
+ account['used'] = Precise["default"].stringSub(this.safeString(account, 'used'), balanceChange);
884
+ }
846
885
  this.balance[type][code] = account;
847
886
  }
848
887
  this.balance[type] = this.safeBalance(this.balance[type]);
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 { 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.90";
7
+ declare const version = "4.1.94";
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.91';
41
+ const version = '4.1.95';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -127,6 +127,7 @@ interface Exchange {
127
127
  privateGetV5AccountFeeRate(params?: {}): Promise<implicitReturnType>;
128
128
  privateGetV5AccountInfo(params?: {}): Promise<implicitReturnType>;
129
129
  privateGetV5AccountTransactionLog(params?: {}): Promise<implicitReturnType>;
130
+ privateGetV5AccountSmpGroup(params?: {}): Promise<implicitReturnType>;
130
131
  privateGetV5AccountMmpState(params?: {}): Promise<implicitReturnType>;
131
132
  privateGetV5AssetExchangeOrderRecord(params?: {}): Promise<implicitReturnType>;
132
133
  privateGetV5AssetDeliveryRecord(params?: {}): Promise<implicitReturnType>;
@@ -54,6 +54,8 @@ interface Exchange {
54
54
  v3PrivateGetBrokerageProductsProductId(params?: {}): Promise<implicitReturnType>;
55
55
  v3PrivateGetBrokerageProductsProductIdCandles(params?: {}): Promise<implicitReturnType>;
56
56
  v3PrivateGetBrokerageProductsProductIdTicker(params?: {}): Promise<implicitReturnType>;
57
+ v3PrivateGetBrokeragePortfolios(params?: {}): Promise<implicitReturnType>;
58
+ v3PrivateGetBrokeragePortfoliosPortfolioUuid(params?: {}): Promise<implicitReturnType>;
57
59
  v3PrivateGetBrokerageTransactionSummary(params?: {}): Promise<implicitReturnType>;
58
60
  v3PrivateGetBrokerageProductBook(params?: {}): Promise<implicitReturnType>;
59
61
  v3PrivateGetBrokerageBestBidAsk(params?: {}): Promise<implicitReturnType>;
@@ -63,8 +65,12 @@ interface Exchange {
63
65
  v3PrivatePostBrokerageOrdersBatchCancel(params?: {}): Promise<implicitReturnType>;
64
66
  v3PrivatePostBrokerageOrdersEdit(params?: {}): Promise<implicitReturnType>;
65
67
  v3PrivatePostBrokerageOrdersEditPreview(params?: {}): Promise<implicitReturnType>;
68
+ v3PrivatePostBrokeragePortfolios(params?: {}): Promise<implicitReturnType>;
69
+ v3PrivatePostBrokeragePortfoliosMoveFunds(params?: {}): Promise<implicitReturnType>;
66
70
  v3PrivatePostBrokerageConvertQuote(params?: {}): Promise<implicitReturnType>;
67
71
  v3PrivatePostBrokerageConvertTradeTradeId(params?: {}): Promise<implicitReturnType>;
72
+ v3PrivatePutBrokeragePortfoliosPortfolioUuid(params?: {}): Promise<implicitReturnType>;
73
+ v3PrivateDeleteBrokeragePortfoliosPortfolioUuid(params?: {}): Promise<implicitReturnType>;
68
74
  }
69
75
  declare abstract class Exchange extends _Exchange {
70
76
  }
@@ -2,8 +2,21 @@ import { implicitReturnType } from '../base/types.js';
2
2
  import { Exchange as _Exchange } from '../base/Exchange.js';
3
3
  interface Exchange {
4
4
  publicGetOrderbook(params?: {}): Promise<implicitReturnType>;
5
- publicGetTrades(params?: {}): Promise<implicitReturnType>;
6
5
  publicGetTicker(params?: {}): Promise<implicitReturnType>;
6
+ publicGetTickerUtc(params?: {}): Promise<implicitReturnType>;
7
+ publicGetTrades(params?: {}): Promise<implicitReturnType>;
8
+ v2PublicGetRangeUnits(params?: {}): Promise<implicitReturnType>;
9
+ v2PublicGetMarketsQuoteCurrency(params?: {}): Promise<implicitReturnType>;
10
+ v2PublicGetMarketsQuoteCurrencyTargetCurrency(params?: {}): Promise<implicitReturnType>;
11
+ v2PublicGetOrderbookQuoteCurrencyTargetCurrency(params?: {}): Promise<implicitReturnType>;
12
+ v2PublicGetTradesQuoteCurrencyTargetCurrency(params?: {}): Promise<implicitReturnType>;
13
+ v2PublicGetTickerNewQuoteCurrency(params?: {}): Promise<implicitReturnType>;
14
+ v2PublicGetTickerNewQuoteCurrencyTargetCurrency(params?: {}): Promise<implicitReturnType>;
15
+ v2PublicGetTickerUtcNewQuoteCurrency(params?: {}): Promise<implicitReturnType>;
16
+ v2PublicGetTickerUtcNewQuoteCurrencyTargetCurrency(params?: {}): Promise<implicitReturnType>;
17
+ v2PublicGetCurrencies(params?: {}): Promise<implicitReturnType>;
18
+ v2PublicGetCurrenciesCurrency(params?: {}): Promise<implicitReturnType>;
19
+ v2PublicGetChartQuoteCurrencyTargetCurrency(params?: {}): Promise<implicitReturnType>;
7
20
  privatePostAccountDepositAddress(params?: {}): Promise<implicitReturnType>;
8
21
  privatePostAccountBtcDepositAddress(params?: {}): Promise<implicitReturnType>;
9
22
  privatePostAccountBalance(params?: {}): Promise<implicitReturnType>;
@@ -16,12 +29,41 @@ interface Exchange {
16
29
  privatePostOrderLimitSell(params?: {}): Promise<implicitReturnType>;
17
30
  privatePostOrderCompleteOrders(params?: {}): Promise<implicitReturnType>;
18
31
  privatePostOrderLimitOrders(params?: {}): Promise<implicitReturnType>;
19
- privatePostOrderQueryOrder(params?: {}): Promise<implicitReturnType>;
32
+ privatePostOrderOrderInfo(params?: {}): Promise<implicitReturnType>;
20
33
  privatePostTransactionAuthNumber(params?: {}): Promise<implicitReturnType>;
21
34
  privatePostTransactionHistory(params?: {}): Promise<implicitReturnType>;
22
35
  privatePostTransactionKrwHistory(params?: {}): Promise<implicitReturnType>;
23
36
  privatePostTransactionBtc(params?: {}): Promise<implicitReturnType>;
24
37
  privatePostTransactionCoin(params?: {}): Promise<implicitReturnType>;
38
+ v2PrivatePostAccountBalance(params?: {}): Promise<implicitReturnType>;
39
+ v2PrivatePostAccountDepositAddress(params?: {}): Promise<implicitReturnType>;
40
+ v2PrivatePostAccountUserInfo(params?: {}): Promise<implicitReturnType>;
41
+ v2PrivatePostAccountVirtualAccount(params?: {}): Promise<implicitReturnType>;
42
+ v2PrivatePostOrderCancel(params?: {}): Promise<implicitReturnType>;
43
+ v2PrivatePostOrderLimitBuy(params?: {}): Promise<implicitReturnType>;
44
+ v2PrivatePostOrderLimitSell(params?: {}): Promise<implicitReturnType>;
45
+ v2PrivatePostOrderLimitOrders(params?: {}): Promise<implicitReturnType>;
46
+ v2PrivatePostOrderCompleteOrders(params?: {}): Promise<implicitReturnType>;
47
+ v2PrivatePostOrderQueryOrder(params?: {}): Promise<implicitReturnType>;
48
+ v2PrivatePostTransactionAuthNumber(params?: {}): Promise<implicitReturnType>;
49
+ v2PrivatePostTransactionBtc(params?: {}): Promise<implicitReturnType>;
50
+ v2PrivatePostTransactionHistory(params?: {}): Promise<implicitReturnType>;
51
+ v2PrivatePostTransactionKrwHistory(params?: {}): Promise<implicitReturnType>;
52
+ v2_1PrivatePostAccountBalanceAll(params?: {}): Promise<implicitReturnType>;
53
+ v2_1PrivatePostAccountBalance(params?: {}): Promise<implicitReturnType>;
54
+ v2_1PrivatePostAccountTradeFee(params?: {}): Promise<implicitReturnType>;
55
+ v2_1PrivatePostAccountTradeFeeQuoteCurrencyTargetCurrency(params?: {}): Promise<implicitReturnType>;
56
+ v2_1PrivatePostOrderLimit(params?: {}): Promise<implicitReturnType>;
57
+ v2_1PrivatePostOrderCancel(params?: {}): Promise<implicitReturnType>;
58
+ v2_1PrivatePostOrderCancelAll(params?: {}): Promise<implicitReturnType>;
59
+ v2_1PrivatePostOrderOpenOrders(params?: {}): Promise<implicitReturnType>;
60
+ v2_1PrivatePostOrderOpenOrdersAll(params?: {}): Promise<implicitReturnType>;
61
+ v2_1PrivatePostOrderCompleteOrders(params?: {}): Promise<implicitReturnType>;
62
+ v2_1PrivatePostOrderCompleteOrdersAll(params?: {}): Promise<implicitReturnType>;
63
+ v2_1PrivatePostOrderInfo(params?: {}): Promise<implicitReturnType>;
64
+ v2_1PrivatePostTransactionKrwHistory(params?: {}): Promise<implicitReturnType>;
65
+ v2_1PrivatePostTransactionCoinHistory(params?: {}): Promise<implicitReturnType>;
66
+ v2_1PrivatePostTransactionCoinWithdrawalLimit(params?: {}): Promise<implicitReturnType>;
25
67
  }
26
68
  declare abstract class Exchange extends _Exchange {
27
69
  }
@@ -167,6 +167,7 @@ interface kucoin {
167
167
  futuresPrivateGetWithdrawalsQuotas(params?: {}): Promise<implicitReturnType>;
168
168
  futuresPrivateGetWithdrawalList(params?: {}): Promise<implicitReturnType>;
169
169
  futuresPrivateGetSubApiKey(params?: {}): Promise<implicitReturnType>;
170
+ futuresPrivateGetTradeStatistics(params?: {}): Promise<implicitReturnType>;
170
171
  futuresPrivatePostTransferOut(params?: {}): Promise<implicitReturnType>;
171
172
  futuresPrivatePostTransferIn(params?: {}): Promise<implicitReturnType>;
172
173
  futuresPrivatePostOrders(params?: {}): Promise<implicitReturnType>;
@@ -184,6 +185,7 @@ interface kucoin {
184
185
  futuresPrivateDeleteWithdrawalsWithdrawalId(params?: {}): Promise<implicitReturnType>;
185
186
  futuresPrivateDeleteCancelTransferOut(params?: {}): Promise<implicitReturnType>;
186
187
  futuresPrivateDeleteSubApiKey(params?: {}): Promise<implicitReturnType>;
188
+ futuresPrivateDeleteOrdersClientOrderClientOid(params?: {}): Promise<implicitReturnType>;
187
189
  webExchangeGetCurrencyCurrencyChainInfo(params?: {}): Promise<implicitReturnType>;
188
190
  webExchangeGetContractSymbolFundingRates(params?: {}): Promise<implicitReturnType>;
189
191
  }
@@ -73,6 +73,7 @@ interface Exchange {
73
73
  publicGetCopytradingPublicSubpositionsHistory(params?: {}): Promise<implicitReturnType>;
74
74
  privateGetRfqCounterparties(params?: {}): Promise<implicitReturnType>;
75
75
  privateGetRfqMakerInstrumentSettings(params?: {}): Promise<implicitReturnType>;
76
+ privateGetRfqMmpConfig(params?: {}): Promise<implicitReturnType>;
76
77
  privateGetRfqRfqs(params?: {}): Promise<implicitReturnType>;
77
78
  privateGetRfqQuotes(params?: {}): Promise<implicitReturnType>;
78
79
  privateGetRfqTrades(params?: {}): Promise<implicitReturnType>;
@@ -198,6 +199,7 @@ interface Exchange {
198
199
  privatePostRfqExecuteQuote(params?: {}): Promise<implicitReturnType>;
199
200
  privatePostRfqMakerInstrumentSettings(params?: {}): Promise<implicitReturnType>;
200
201
  privatePostRfqMmpReset(params?: {}): Promise<implicitReturnType>;
202
+ privatePostRfqMmpConfig(params?: {}): Promise<implicitReturnType>;
201
203
  privatePostRfqCreateQuote(params?: {}): Promise<implicitReturnType>;
202
204
  privatePostRfqCancelQuote(params?: {}): Promise<implicitReturnType>;
203
205
  privatePostRfqCancelBatchQuotes(params?: {}): Promise<implicitReturnType>;
package/js/src/binance.js CHANGED
@@ -3140,7 +3140,7 @@ export default class binance extends Exchange {
3140
3140
  * @see https://binance-docs.github.io/apidocs/futures/en/#24hr-ticker-price-change-statistics // swap
3141
3141
  * @see https://binance-docs.github.io/apidocs/delivery/en/#24hr-ticker-price-change-statistics // future
3142
3142
  * @see https://binance-docs.github.io/apidocs/voptions/en/#24hr-ticker-price-change-statistics // option
3143
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
3143
+ * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
3144
3144
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3145
3145
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
3146
3146
  */
@@ -3155,22 +3155,24 @@ export default class binance extends Exchange {
3155
3155
  [type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
3156
3156
  let subType = undefined;
3157
3157
  [subType, params] = this.handleSubTypeAndParams('fetchTickers', market, params);
3158
- const query = this.omit(params, 'type');
3159
- let defaultMethod = undefined;
3158
+ let response = undefined;
3160
3159
  if (type === 'option') {
3161
- defaultMethod = 'eapiPublicGetTicker';
3160
+ response = await this.eapiPublicGetTicker(params);
3162
3161
  }
3163
3162
  else if (this.isLinear(type, subType)) {
3164
- defaultMethod = 'fapiPublicGetTicker24hr';
3163
+ response = await this.fapiPublicGetTicker24hr(params);
3165
3164
  }
3166
3165
  else if (this.isInverse(type, subType)) {
3167
- defaultMethod = 'dapiPublicGetTicker24hr';
3166
+ response = await this.dapiPublicGetTicker24hr(params);
3168
3167
  }
3169
3168
  else {
3170
- defaultMethod = 'publicGetTicker24hr';
3169
+ const request = {};
3170
+ if (symbols !== undefined) {
3171
+ const marketIds = this.marketIds(symbols);
3172
+ request['symbols'] = this.json(marketIds);
3173
+ }
3174
+ response = await this.publicGetTicker24hr(this.extend(request, params));
3171
3175
  }
3172
- const method = this.safeString(this.options, 'fetchTickersMethod', defaultMethod);
3173
- const response = await this[method](query);
3174
3176
  return this.parseTickers(response, symbols);
3175
3177
  }
3176
3178
  parseOHLCV(ohlcv, market = undefined) {
package/js/src/bingx.js CHANGED
@@ -893,14 +893,19 @@ export default class bingx extends Exchange {
893
893
  const type = (cost === undefined) ? 'spot' : 'swap';
894
894
  const currencyId = this.safeString2(trade, 'currency', 'N');
895
895
  const currencyCode = this.safeCurrencyCode(currencyId);
896
- const m = this.safeValue(trade, 'm', false);
896
+ const m = this.safeValue(trade, 'm');
897
897
  const marketId = this.safeString(trade, 's');
898
898
  const isBuyerMaker = this.safeValue2(trade, 'buyerMaker', 'isBuyerMaker');
899
- let takeOrMaker = (isBuyerMaker || m) ? 'maker' : 'taker';
899
+ let takeOrMaker = undefined;
900
+ if ((isBuyerMaker !== undefined) || (m !== undefined)) {
901
+ takeOrMaker = (isBuyerMaker || m) ? 'maker' : 'taker';
902
+ }
900
903
  let side = this.safeStringLower2(trade, 'side', 'S');
901
904
  if (side === undefined) {
902
- side = (isBuyerMaker || m) ? 'sell' : 'buy';
903
- takeOrMaker = 'taker';
905
+ if ((isBuyerMaker !== undefined) || (m !== undefined)) {
906
+ side = (isBuyerMaker || m) ? 'sell' : 'buy';
907
+ takeOrMaker = 'taker';
908
+ }
904
909
  }
905
910
  return this.safeTrade({
906
911
  'id': this.safeStringN(trade, ['id', 't']),
@@ -913,7 +918,7 @@ export default class bingx extends Exchange {
913
918
  'side': this.parseOrderSide(side),
914
919
  'takerOrMaker': takeOrMaker,
915
920
  'price': this.safeString2(trade, 'price', 'p'),
916
- 'amount': this.safeStringN(trade, ['qty', 'amount', 'q']),
921
+ 'amount': this.safeStringN(trade, ['qty', 'volume', 'amount', 'q']),
917
922
  'cost': cost,
918
923
  'fee': {
919
924
  'cost': this.parseNumber(Precise.stringAbs(this.safeString2(trade, 'commission', 'n'))),
@@ -1349,7 +1354,7 @@ export default class bingx extends Exchange {
1349
1354
  async fetchBalance(params = {}) {
1350
1355
  /**
1351
1356
  * @method
1352
- * @name cryptocom#fetchBalance
1357
+ * @name bingx#fetchBalance
1353
1358
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
1354
1359
  * @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Query%20Assets
1355
1360
  * @see https://bingx-api.github.io/docs/#/swapV2/account-api.html#Get%20Perpetual%20Swap%20Account%20Asset%20Information
@@ -317,6 +317,7 @@ export default class bitget extends Exchange {
317
317
  datetime: string;
318
318
  info: any;
319
319
  };
320
+ closePosition(symbol: string, side?: OrderSide, params?: {}): Promise<Order>;
320
321
  closeAllPositions(params?: {}): Promise<Position[]>;
321
322
  handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
322
323
  sign(path: any, api?: any[], method?: string, params?: {}, headers?: any, body?: any): {