ccxt 4.3.90 → 4.3.91

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
@@ -196,7 +196,7 @@ var xt$1 = require('./src/pro/xt.js');
196
196
 
197
197
  //-----------------------------------------------------------------------------
198
198
  // this is updated by vss.js when building
199
- const version = '4.3.90';
199
+ const version = '4.3.91';
200
200
  Exchange["default"].ccxtVersion = version;
201
201
  const exchanges = {
202
202
  'ace': ace,
@@ -330,7 +330,7 @@ class binance extends binance$1 {
330
330
  'capital/deposit/hisrec': 0.1,
331
331
  'capital/deposit/subAddress': 0.1,
332
332
  'capital/deposit/subHisrec': 0.1,
333
- 'capital/withdraw/history': 1800,
333
+ 'capital/withdraw/history': 2,
334
334
  'capital/withdraw/address/list': 10,
335
335
  'capital/contract/convertible-coins': 4.0002,
336
336
  'convert/tradeFlow': 20.001,
@@ -1415,6 +1415,7 @@ class hitbtc extends hitbtc$1 {
1415
1415
  }
1416
1416
  parseTransactionStatus(status) {
1417
1417
  const statuses = {
1418
+ 'CREATED': 'pending',
1418
1419
  'PENDING': 'pending',
1419
1420
  'FAILED': 'failed',
1420
1421
  'ROLLED_BACK': 'failed',
@@ -241,6 +241,7 @@ class kucoin extends kucoin$1 {
241
241
  'purchase/orders': 10,
242
242
  // broker
243
243
  'broker/api/rebase/download': 3,
244
+ 'migrate/user/account/status': 3,
244
245
  // affiliate
245
246
  'affiliate/inviter/statistics': 30,
246
247
  },
@@ -685,6 +686,7 @@ class kucoin extends kucoin$1 {
685
686
  'project/marketInterestRate': 'v3',
686
687
  'redeem/orders': 'v3',
687
688
  'purchase/orders': 'v3',
689
+ 'migrate/user/account/status': 'v3',
688
690
  'margin/symbols': 'v3',
689
691
  'affiliate/inviter/statistics': 'v2',
690
692
  'asset/ndbroker/deposit/list': 'v1',
@@ -1208,6 +1210,30 @@ class kucoin extends kucoin$1 {
1208
1210
  }
1209
1211
  return result;
1210
1212
  }
1213
+ async loadMigrationStatus(force = false) {
1214
+ if (!('hfMigrated' in this.options) || force) {
1215
+ const result = await this.privateGetMigrateUserAccountStatus();
1216
+ const data = this.safeDict(result, 'data', {});
1217
+ const status = this.safeInteger(data, 'status');
1218
+ this.options['hfMigrated'] = (status === 2);
1219
+ }
1220
+ }
1221
+ async handleHfAndParams(params = {}) {
1222
+ await this.loadMigrationStatus();
1223
+ const migrated = this.safeBool(this.options, 'hfMigrated');
1224
+ let loadedHf = undefined;
1225
+ if (migrated !== undefined) {
1226
+ if (migrated) {
1227
+ loadedHf = true;
1228
+ }
1229
+ else {
1230
+ loadedHf = false;
1231
+ }
1232
+ }
1233
+ const hf = this.safeBool(params, 'hf', loadedHf);
1234
+ params = this.omit(params, 'hf');
1235
+ return [hf, params];
1236
+ }
1211
1237
  async fetchCurrencies(params = {}) {
1212
1238
  /**
1213
1239
  * @method
@@ -2089,7 +2115,8 @@ class kucoin extends kucoin$1 {
2089
2115
  const market = this.market(symbol);
2090
2116
  const testOrder = this.safeBool(params, 'test', false);
2091
2117
  params = this.omit(params, 'test');
2092
- const isHf = this.safeBool(params, 'hf', false);
2118
+ let hf = undefined;
2119
+ [hf, params] = await this.handleHfAndParams(params);
2093
2120
  const [triggerPrice, stopLossPrice, takeProfitPrice] = this.handleTriggerPrices(params);
2094
2121
  const tradeType = this.safeString(params, 'tradeType'); // keep it for backward compatibility
2095
2122
  const isTriggerOrder = (triggerPrice || stopLossPrice || takeProfitPrice);
@@ -2103,19 +2130,22 @@ class kucoin extends kucoin$1 {
2103
2130
  if (isMarginOrder) {
2104
2131
  response = await this.privatePostMarginOrderTest(orderRequest);
2105
2132
  }
2133
+ else if (hf) {
2134
+ response = await this.privatePostHfOrdersTest(orderRequest);
2135
+ }
2106
2136
  else {
2107
2137
  response = await this.privatePostOrdersTest(orderRequest);
2108
2138
  }
2109
2139
  }
2110
- else if (isHf) {
2111
- response = await this.privatePostHfOrders(orderRequest);
2112
- }
2113
2140
  else if (isTriggerOrder) {
2114
2141
  response = await this.privatePostStopOrder(orderRequest);
2115
2142
  }
2116
2143
  else if (isMarginOrder) {
2117
2144
  response = await this.privatePostMarginOrder(orderRequest);
2118
2145
  }
2146
+ else if (hf) {
2147
+ response = await this.privatePostHfOrders(orderRequest);
2148
+ }
2119
2149
  else {
2120
2150
  response = await this.privatePostOrders(orderRequest);
2121
2151
  }
@@ -2216,8 +2246,8 @@ class kucoin extends kucoin$1 {
2216
2246
  'symbol': market['id'],
2217
2247
  'orderList': ordersRequests,
2218
2248
  };
2219
- const hf = this.safeBool(params, 'hf', false);
2220
- params = this.omit(params, 'hf');
2249
+ let hf = undefined;
2250
+ [hf, params] = await this.handleHfAndParams(params);
2221
2251
  let response = undefined;
2222
2252
  if (hf) {
2223
2253
  response = await this.privatePostHfOrdersMulti(this.extend(request, params));
@@ -2406,7 +2436,8 @@ class kucoin extends kucoin$1 {
2406
2436
  const request = {};
2407
2437
  const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
2408
2438
  const stop = this.safeBool2(params, 'stop', 'trigger', false);
2409
- const hf = this.safeBool(params, 'hf', false);
2439
+ let hf = undefined;
2440
+ [hf, params] = await this.handleHfAndParams(params);
2410
2441
  if (hf) {
2411
2442
  if (symbol === undefined) {
2412
2443
  throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol parameter for hf orders');
@@ -2415,7 +2446,7 @@ class kucoin extends kucoin$1 {
2415
2446
  request['symbol'] = market['id'];
2416
2447
  }
2417
2448
  let response = undefined;
2418
- params = this.omit(params, ['clientOid', 'clientOrderId', 'stop', 'hf', 'trigger']);
2449
+ params = this.omit(params, ['clientOid', 'clientOrderId', 'stop', 'trigger']);
2419
2450
  if (clientOrderId !== undefined) {
2420
2451
  request['clientOid'] = clientOrderId;
2421
2452
  if (stop) {
@@ -2519,8 +2550,9 @@ class kucoin extends kucoin$1 {
2519
2550
  await this.loadMarkets();
2520
2551
  const request = {};
2521
2552
  const stop = this.safeBool(params, 'stop', false);
2522
- const hf = this.safeBool(params, 'hf', false);
2523
- params = this.omit(params, ['stop', 'hf']);
2553
+ let hf = undefined;
2554
+ [hf, params] = await this.handleHfAndParams(params);
2555
+ params = this.omit(params, 'stop');
2524
2556
  const [marginMode, query] = this.handleMarginModeAndParams('cancelAllOrders', params);
2525
2557
  if (symbol !== undefined) {
2526
2558
  request['symbol'] = this.marketId(symbol);
@@ -2577,8 +2609,12 @@ class kucoin extends kucoin$1 {
2577
2609
  let lowercaseStatus = status.toLowerCase();
2578
2610
  const until = this.safeInteger(params, 'until');
2579
2611
  const stop = this.safeBool2(params, 'stop', 'trigger', false);
2580
- const hf = this.safeBool(params, 'hf', false);
2581
- params = this.omit(params, ['stop', 'hf', 'until', 'trigger']);
2612
+ let hf = undefined;
2613
+ [hf, params] = await this.handleHfAndParams(params);
2614
+ if (hf && (symbol === undefined)) {
2615
+ throw new errors.ArgumentsRequired(this.id + ' fetchOrdersByStatus() requires a symbol parameter for hf orders');
2616
+ }
2617
+ params = this.omit(params, ['stop', 'trigger', 'till', 'until']);
2582
2618
  const [marginMode, query] = this.handleMarginModeAndParams('fetchOrdersByStatus', params);
2583
2619
  if (lowercaseStatus === 'open') {
2584
2620
  lowercaseStatus = 'active';
@@ -2756,7 +2792,8 @@ class kucoin extends kucoin$1 {
2756
2792
  const request = {};
2757
2793
  const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
2758
2794
  const stop = this.safeBool2(params, 'stop', 'trigger', false);
2759
- const hf = this.safeBool(params, 'hf', false);
2795
+ let hf = undefined;
2796
+ [hf, params] = await this.handleHfAndParams(params);
2760
2797
  let market = undefined;
2761
2798
  if (symbol !== undefined) {
2762
2799
  market = this.market(symbol);
@@ -2767,7 +2804,7 @@ class kucoin extends kucoin$1 {
2767
2804
  }
2768
2805
  request['symbol'] = market['id'];
2769
2806
  }
2770
- params = this.omit(params, ['stop', 'hf', 'clientOid', 'clientOrderId', 'trigger']);
2807
+ params = this.omit(params, ['stop', 'clientOid', 'clientOrderId', 'trigger']);
2771
2808
  let response = undefined;
2772
2809
  if (clientOrderId !== undefined) {
2773
2810
  request['clientOid'] = clientOrderId;
@@ -3033,7 +3070,8 @@ class kucoin extends kucoin$1 {
3033
3070
  return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
3034
3071
  }
3035
3072
  let request = {};
3036
- const hf = this.safeBool(params, 'hf', false);
3073
+ let hf = undefined;
3074
+ [hf, params] = await this.handleHfAndParams(params);
3037
3075
  if (hf && symbol === undefined) {
3038
3076
  throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol parameter for hf orders');
3039
3077
  }
@@ -3760,11 +3798,11 @@ class kucoin extends kucoin$1 {
3760
3798
  const accountsByType = this.safeDict(this.options, 'accountsByType');
3761
3799
  let type = this.safeString(accountsByType, requestedType, requestedType);
3762
3800
  params = this.omit(params, 'type');
3763
- const isHf = this.safeBool(params, 'hf', false);
3764
- if (isHf) {
3801
+ let hf = undefined;
3802
+ [hf, params] = await this.handleHfAndParams(params);
3803
+ if (hf) {
3765
3804
  type = 'trade_hf';
3766
3805
  }
3767
- params = this.omit(params, 'hf');
3768
3806
  const [marginMode, query] = this.handleMarginModeAndParams('fetchBalance', params);
3769
3807
  let response = undefined;
3770
3808
  const request = {};
@@ -4220,8 +4258,8 @@ class kucoin extends kucoin$1 {
4220
4258
  await this.loadAccounts();
4221
4259
  let paginate = false;
4222
4260
  [paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
4223
- const isHf = this.safeBool(params, 'hf');
4224
- params = this.omit(params, 'hf');
4261
+ let hf = undefined;
4262
+ [hf, params] = await this.handleHfAndParams(params);
4225
4263
  if (paginate) {
4226
4264
  return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
4227
4265
  }
@@ -4245,7 +4283,7 @@ class kucoin extends kucoin$1 {
4245
4283
  let marginMode = undefined;
4246
4284
  [marginMode, params] = this.handleMarginModeAndParams('fetchLedger', params);
4247
4285
  let response = undefined;
4248
- if (isHf) {
4286
+ if (hf) {
4249
4287
  if (marginMode !== undefined) {
4250
4288
  response = await this.privateGetHfMarginAccountLedgers(this.extend(request, params));
4251
4289
  }
@@ -48,6 +48,7 @@ class kucoinfutures extends kucoinfutures$1 {
48
48
  'createTriggerOrder': true,
49
49
  'fetchAccounts': true,
50
50
  'fetchBalance': true,
51
+ 'fetchBidsAsks': true,
51
52
  'fetchBorrowRateHistories': false,
52
53
  'fetchBorrowRateHistory': false,
53
54
  'fetchClosedOrders': true,
@@ -772,11 +773,20 @@ class kucoinfutures extends kucoinfutures$1 {
772
773
  * @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-symbols-list
773
774
  * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
774
775
  * @param {object} [params] extra parameters specific to the exchange API endpoint
776
+ * @param {string} [params.method] the method to use, futuresPublicGetAllTickers or futuresPublicGetContractsActive
775
777
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
776
778
  */
777
779
  await this.loadMarkets();
778
780
  symbols = this.marketSymbols(symbols);
779
- const response = await this.futuresPublicGetContractsActive(params);
781
+ let method = undefined;
782
+ [method, params] = this.handleOptionAndParams(params, 'fetchTickers', 'method', 'futuresPublicGetContractsActive');
783
+ let response = undefined;
784
+ if (method === 'futuresPublicGetAllTickers') {
785
+ response = await this.futuresPublicGetAllTickers(params);
786
+ }
787
+ else {
788
+ response = await this.futuresPublicGetContractsActive(params);
789
+ }
780
790
  //
781
791
  // {
782
792
  // "code": "200000",
@@ -839,7 +849,7 @@ class kucoinfutures extends kucoinfutures$1 {
839
849
  // }
840
850
  // }
841
851
  //
842
- const data = this.safeList(response, 'data', []);
852
+ const data = this.safeList(response, 'data');
843
853
  const tickers = this.parseTickers(data, symbols);
844
854
  return this.filterByArrayTickers(tickers, 'symbol', symbols);
845
855
  }
@@ -949,6 +959,20 @@ class kucoinfutures extends kucoinfutures$1 {
949
959
  'info': ticker,
950
960
  }, market);
951
961
  }
962
+ async fetchBidsAsks(symbols = undefined, params = {}) {
963
+ /**
964
+ * @method
965
+ * @name kucoinfutures#fetchBidsAsks
966
+ * @description fetches the bid and ask price and volume for multiple markets
967
+ * @param {string[]} [symbols] unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
968
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
969
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
970
+ */
971
+ const request = {
972
+ 'method': 'futuresPublicGetAllTickers',
973
+ };
974
+ return await this.fetchTickers(symbols, this.extend(request, params));
975
+ }
952
976
  async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
953
977
  /**
954
978
  * @method
@@ -482,7 +482,7 @@ class woo extends woo$1 {
482
482
  'swap': swap,
483
483
  'future': false,
484
484
  'option': false,
485
- 'active': undefined,
485
+ 'active': this.safeString(market, 'is_trading') === '1',
486
486
  'contract': contract,
487
487
  'linear': linear,
488
488
  'inverse': undefined,
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 { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
7
- declare const version = "4.3.89";
7
+ declare const version = "4.3.90";
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, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.3.90';
41
+ const version = '4.3.91';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -87,6 +87,7 @@ interface Exchange {
87
87
  privateGetRedeemOrders(params?: {}): Promise<implicitReturnType>;
88
88
  privateGetPurchaseOrders(params?: {}): Promise<implicitReturnType>;
89
89
  privateGetBrokerApiRebaseDownload(params?: {}): Promise<implicitReturnType>;
90
+ privateGetMigrateUserAccountStatus(params?: {}): Promise<implicitReturnType>;
90
91
  privateGetAffiliateInviterStatistics(params?: {}): Promise<implicitReturnType>;
91
92
  privatePostSubUserCreated(params?: {}): Promise<implicitReturnType>;
92
93
  privatePostSubApiKey(params?: {}): Promise<implicitReturnType>;
@@ -87,6 +87,7 @@ interface kucoin {
87
87
  privateGetRedeemOrders(params?: {}): Promise<implicitReturnType>;
88
88
  privateGetPurchaseOrders(params?: {}): Promise<implicitReturnType>;
89
89
  privateGetBrokerApiRebaseDownload(params?: {}): Promise<implicitReturnType>;
90
+ privateGetMigrateUserAccountStatus(params?: {}): Promise<implicitReturnType>;
90
91
  privateGetAffiliateInviterStatistics(params?: {}): Promise<implicitReturnType>;
91
92
  privatePostSubUserCreated(params?: {}): Promise<implicitReturnType>;
92
93
  privatePostSubApiKey(params?: {}): Promise<implicitReturnType>;
package/js/src/binance.js CHANGED
@@ -333,7 +333,7 @@ export default class binance extends Exchange {
333
333
  'capital/deposit/hisrec': 0.1,
334
334
  'capital/deposit/subAddress': 0.1,
335
335
  'capital/deposit/subHisrec': 0.1,
336
- 'capital/withdraw/history': 1800,
336
+ 'capital/withdraw/history': 2,
337
337
  'capital/withdraw/address/list': 10,
338
338
  'capital/contract/convertible-coins': 4.0002,
339
339
  'convert/tradeFlow': 20.001,
package/js/src/hitbtc.js CHANGED
@@ -1418,6 +1418,7 @@ export default class hitbtc extends Exchange {
1418
1418
  }
1419
1419
  parseTransactionStatus(status) {
1420
1420
  const statuses = {
1421
+ 'CREATED': 'pending',
1421
1422
  'PENDING': 'pending',
1422
1423
  'FAILED': 'failed',
1423
1424
  'ROLLED_BACK': 'failed',
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/kucoin.js';
2
- import type { TransferEntry, Int, OrderSide, OrderType, Order, OHLCV, Trade, Balances, OrderRequest, Str, Transaction, Ticker, OrderBook, Tickers, Strings, Currency, Market, Num, Account, TradingFeeInterface, Currencies, Dict, int } from './base/types.js';
2
+ import type { TransferEntry, Int, OrderSide, OrderType, Order, OHLCV, Trade, Balances, OrderRequest, Str, Transaction, Ticker, OrderBook, Tickers, Strings, Currency, Market, Num, Account, Dict, TradingFeeInterface, Currencies, int } from './base/types.js';
3
3
  /**
4
4
  * @class kucoin
5
5
  * @augments Exchange
@@ -16,6 +16,8 @@ export default class kucoin extends Exchange {
16
16
  info: any;
17
17
  }>;
18
18
  fetchMarkets(params?: {}): Promise<Market[]>;
19
+ loadMigrationStatus(force?: boolean): Promise<void>;
20
+ handleHfAndParams(params?: {}): Promise<{}[]>;
19
21
  fetchCurrencies(params?: {}): Promise<Currencies>;
20
22
  fetchAccounts(params?: {}): Promise<Account[]>;
21
23
  fetchTransactionFee(code: string, params?: {}): Promise<{
package/js/src/kucoin.js CHANGED
@@ -244,6 +244,7 @@ export default class kucoin extends Exchange {
244
244
  'purchase/orders': 10,
245
245
  // broker
246
246
  'broker/api/rebase/download': 3,
247
+ 'migrate/user/account/status': 3,
247
248
  // affiliate
248
249
  'affiliate/inviter/statistics': 30,
249
250
  },
@@ -688,6 +689,7 @@ export default class kucoin extends Exchange {
688
689
  'project/marketInterestRate': 'v3',
689
690
  'redeem/orders': 'v3',
690
691
  'purchase/orders': 'v3',
692
+ 'migrate/user/account/status': 'v3',
691
693
  'margin/symbols': 'v3',
692
694
  'affiliate/inviter/statistics': 'v2',
693
695
  'asset/ndbroker/deposit/list': 'v1',
@@ -1211,6 +1213,30 @@ export default class kucoin extends Exchange {
1211
1213
  }
1212
1214
  return result;
1213
1215
  }
1216
+ async loadMigrationStatus(force = false) {
1217
+ if (!('hfMigrated' in this.options) || force) {
1218
+ const result = await this.privateGetMigrateUserAccountStatus();
1219
+ const data = this.safeDict(result, 'data', {});
1220
+ const status = this.safeInteger(data, 'status');
1221
+ this.options['hfMigrated'] = (status === 2);
1222
+ }
1223
+ }
1224
+ async handleHfAndParams(params = {}) {
1225
+ await this.loadMigrationStatus();
1226
+ const migrated = this.safeBool(this.options, 'hfMigrated');
1227
+ let loadedHf = undefined;
1228
+ if (migrated !== undefined) {
1229
+ if (migrated) {
1230
+ loadedHf = true;
1231
+ }
1232
+ else {
1233
+ loadedHf = false;
1234
+ }
1235
+ }
1236
+ const hf = this.safeBool(params, 'hf', loadedHf);
1237
+ params = this.omit(params, 'hf');
1238
+ return [hf, params];
1239
+ }
1214
1240
  async fetchCurrencies(params = {}) {
1215
1241
  /**
1216
1242
  * @method
@@ -2092,7 +2118,8 @@ export default class kucoin extends Exchange {
2092
2118
  const market = this.market(symbol);
2093
2119
  const testOrder = this.safeBool(params, 'test', false);
2094
2120
  params = this.omit(params, 'test');
2095
- const isHf = this.safeBool(params, 'hf', false);
2121
+ let hf = undefined;
2122
+ [hf, params] = await this.handleHfAndParams(params);
2096
2123
  const [triggerPrice, stopLossPrice, takeProfitPrice] = this.handleTriggerPrices(params);
2097
2124
  const tradeType = this.safeString(params, 'tradeType'); // keep it for backward compatibility
2098
2125
  const isTriggerOrder = (triggerPrice || stopLossPrice || takeProfitPrice);
@@ -2106,19 +2133,22 @@ export default class kucoin extends Exchange {
2106
2133
  if (isMarginOrder) {
2107
2134
  response = await this.privatePostMarginOrderTest(orderRequest);
2108
2135
  }
2136
+ else if (hf) {
2137
+ response = await this.privatePostHfOrdersTest(orderRequest);
2138
+ }
2109
2139
  else {
2110
2140
  response = await this.privatePostOrdersTest(orderRequest);
2111
2141
  }
2112
2142
  }
2113
- else if (isHf) {
2114
- response = await this.privatePostHfOrders(orderRequest);
2115
- }
2116
2143
  else if (isTriggerOrder) {
2117
2144
  response = await this.privatePostStopOrder(orderRequest);
2118
2145
  }
2119
2146
  else if (isMarginOrder) {
2120
2147
  response = await this.privatePostMarginOrder(orderRequest);
2121
2148
  }
2149
+ else if (hf) {
2150
+ response = await this.privatePostHfOrders(orderRequest);
2151
+ }
2122
2152
  else {
2123
2153
  response = await this.privatePostOrders(orderRequest);
2124
2154
  }
@@ -2219,8 +2249,8 @@ export default class kucoin extends Exchange {
2219
2249
  'symbol': market['id'],
2220
2250
  'orderList': ordersRequests,
2221
2251
  };
2222
- const hf = this.safeBool(params, 'hf', false);
2223
- params = this.omit(params, 'hf');
2252
+ let hf = undefined;
2253
+ [hf, params] = await this.handleHfAndParams(params);
2224
2254
  let response = undefined;
2225
2255
  if (hf) {
2226
2256
  response = await this.privatePostHfOrdersMulti(this.extend(request, params));
@@ -2409,7 +2439,8 @@ export default class kucoin extends Exchange {
2409
2439
  const request = {};
2410
2440
  const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
2411
2441
  const stop = this.safeBool2(params, 'stop', 'trigger', false);
2412
- const hf = this.safeBool(params, 'hf', false);
2442
+ let hf = undefined;
2443
+ [hf, params] = await this.handleHfAndParams(params);
2413
2444
  if (hf) {
2414
2445
  if (symbol === undefined) {
2415
2446
  throw new ArgumentsRequired(this.id + ' cancelOrder() requires a symbol parameter for hf orders');
@@ -2418,7 +2449,7 @@ export default class kucoin extends Exchange {
2418
2449
  request['symbol'] = market['id'];
2419
2450
  }
2420
2451
  let response = undefined;
2421
- params = this.omit(params, ['clientOid', 'clientOrderId', 'stop', 'hf', 'trigger']);
2452
+ params = this.omit(params, ['clientOid', 'clientOrderId', 'stop', 'trigger']);
2422
2453
  if (clientOrderId !== undefined) {
2423
2454
  request['clientOid'] = clientOrderId;
2424
2455
  if (stop) {
@@ -2522,8 +2553,9 @@ export default class kucoin extends Exchange {
2522
2553
  await this.loadMarkets();
2523
2554
  const request = {};
2524
2555
  const stop = this.safeBool(params, 'stop', false);
2525
- const hf = this.safeBool(params, 'hf', false);
2526
- params = this.omit(params, ['stop', 'hf']);
2556
+ let hf = undefined;
2557
+ [hf, params] = await this.handleHfAndParams(params);
2558
+ params = this.omit(params, 'stop');
2527
2559
  const [marginMode, query] = this.handleMarginModeAndParams('cancelAllOrders', params);
2528
2560
  if (symbol !== undefined) {
2529
2561
  request['symbol'] = this.marketId(symbol);
@@ -2580,8 +2612,12 @@ export default class kucoin extends Exchange {
2580
2612
  let lowercaseStatus = status.toLowerCase();
2581
2613
  const until = this.safeInteger(params, 'until');
2582
2614
  const stop = this.safeBool2(params, 'stop', 'trigger', false);
2583
- const hf = this.safeBool(params, 'hf', false);
2584
- params = this.omit(params, ['stop', 'hf', 'until', 'trigger']);
2615
+ let hf = undefined;
2616
+ [hf, params] = await this.handleHfAndParams(params);
2617
+ if (hf && (symbol === undefined)) {
2618
+ throw new ArgumentsRequired(this.id + ' fetchOrdersByStatus() requires a symbol parameter for hf orders');
2619
+ }
2620
+ params = this.omit(params, ['stop', 'trigger', 'till', 'until']);
2585
2621
  const [marginMode, query] = this.handleMarginModeAndParams('fetchOrdersByStatus', params);
2586
2622
  if (lowercaseStatus === 'open') {
2587
2623
  lowercaseStatus = 'active';
@@ -2759,7 +2795,8 @@ export default class kucoin extends Exchange {
2759
2795
  const request = {};
2760
2796
  const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
2761
2797
  const stop = this.safeBool2(params, 'stop', 'trigger', false);
2762
- const hf = this.safeBool(params, 'hf', false);
2798
+ let hf = undefined;
2799
+ [hf, params] = await this.handleHfAndParams(params);
2763
2800
  let market = undefined;
2764
2801
  if (symbol !== undefined) {
2765
2802
  market = this.market(symbol);
@@ -2770,7 +2807,7 @@ export default class kucoin extends Exchange {
2770
2807
  }
2771
2808
  request['symbol'] = market['id'];
2772
2809
  }
2773
- params = this.omit(params, ['stop', 'hf', 'clientOid', 'clientOrderId', 'trigger']);
2810
+ params = this.omit(params, ['stop', 'clientOid', 'clientOrderId', 'trigger']);
2774
2811
  let response = undefined;
2775
2812
  if (clientOrderId !== undefined) {
2776
2813
  request['clientOid'] = clientOrderId;
@@ -3036,7 +3073,8 @@ export default class kucoin extends Exchange {
3036
3073
  return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
3037
3074
  }
3038
3075
  let request = {};
3039
- const hf = this.safeBool(params, 'hf', false);
3076
+ let hf = undefined;
3077
+ [hf, params] = await this.handleHfAndParams(params);
3040
3078
  if (hf && symbol === undefined) {
3041
3079
  throw new ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol parameter for hf orders');
3042
3080
  }
@@ -3763,11 +3801,11 @@ export default class kucoin extends Exchange {
3763
3801
  const accountsByType = this.safeDict(this.options, 'accountsByType');
3764
3802
  let type = this.safeString(accountsByType, requestedType, requestedType);
3765
3803
  params = this.omit(params, 'type');
3766
- const isHf = this.safeBool(params, 'hf', false);
3767
- if (isHf) {
3804
+ let hf = undefined;
3805
+ [hf, params] = await this.handleHfAndParams(params);
3806
+ if (hf) {
3768
3807
  type = 'trade_hf';
3769
3808
  }
3770
- params = this.omit(params, 'hf');
3771
3809
  const [marginMode, query] = this.handleMarginModeAndParams('fetchBalance', params);
3772
3810
  let response = undefined;
3773
3811
  const request = {};
@@ -4223,8 +4261,8 @@ export default class kucoin extends Exchange {
4223
4261
  await this.loadAccounts();
4224
4262
  let paginate = false;
4225
4263
  [paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
4226
- const isHf = this.safeBool(params, 'hf');
4227
- params = this.omit(params, 'hf');
4264
+ let hf = undefined;
4265
+ [hf, params] = await this.handleHfAndParams(params);
4228
4266
  if (paginate) {
4229
4267
  return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
4230
4268
  }
@@ -4248,7 +4286,7 @@ export default class kucoin extends Exchange {
4248
4286
  let marginMode = undefined;
4249
4287
  [marginMode, params] = this.handleMarginModeAndParams('fetchLedger', params);
4250
4288
  let response = undefined;
4251
- if (isHf) {
4289
+ if (hf) {
4252
4290
  if (marginMode !== undefined) {
4253
4291
  response = await this.privateGetHfMarginAccountLedgers(this.extend(request, params));
4254
4292
  }
@@ -28,6 +28,7 @@ export default class kucoinfutures extends kucoin {
28
28
  fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
29
29
  fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
30
30
  parseTicker(ticker: Dict, market?: Market): Ticker;
31
+ fetchBidsAsks(symbols?: Strings, params?: {}): Promise<Tickers>;
31
32
  fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
32
33
  fetchPosition(symbol: string, params?: {}): Promise<import("./base/types.js").Position>;
33
34
  fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
@@ -51,6 +51,7 @@ export default class kucoinfutures extends kucoin {
51
51
  'createTriggerOrder': true,
52
52
  'fetchAccounts': true,
53
53
  'fetchBalance': true,
54
+ 'fetchBidsAsks': true,
54
55
  'fetchBorrowRateHistories': false,
55
56
  'fetchBorrowRateHistory': false,
56
57
  'fetchClosedOrders': true,
@@ -775,11 +776,20 @@ export default class kucoinfutures extends kucoin {
775
776
  * @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-symbols-list
776
777
  * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
777
778
  * @param {object} [params] extra parameters specific to the exchange API endpoint
779
+ * @param {string} [params.method] the method to use, futuresPublicGetAllTickers or futuresPublicGetContractsActive
778
780
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
779
781
  */
780
782
  await this.loadMarkets();
781
783
  symbols = this.marketSymbols(symbols);
782
- const response = await this.futuresPublicGetContractsActive(params);
784
+ let method = undefined;
785
+ [method, params] = this.handleOptionAndParams(params, 'fetchTickers', 'method', 'futuresPublicGetContractsActive');
786
+ let response = undefined;
787
+ if (method === 'futuresPublicGetAllTickers') {
788
+ response = await this.futuresPublicGetAllTickers(params);
789
+ }
790
+ else {
791
+ response = await this.futuresPublicGetContractsActive(params);
792
+ }
783
793
  //
784
794
  // {
785
795
  // "code": "200000",
@@ -842,7 +852,7 @@ export default class kucoinfutures extends kucoin {
842
852
  // }
843
853
  // }
844
854
  //
845
- const data = this.safeList(response, 'data', []);
855
+ const data = this.safeList(response, 'data');
846
856
  const tickers = this.parseTickers(data, symbols);
847
857
  return this.filterByArrayTickers(tickers, 'symbol', symbols);
848
858
  }
@@ -952,6 +962,20 @@ export default class kucoinfutures extends kucoin {
952
962
  'info': ticker,
953
963
  }, market);
954
964
  }
965
+ async fetchBidsAsks(symbols = undefined, params = {}) {
966
+ /**
967
+ * @method
968
+ * @name kucoinfutures#fetchBidsAsks
969
+ * @description fetches the bid and ask price and volume for multiple markets
970
+ * @param {string[]} [symbols] unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
971
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
972
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
973
+ */
974
+ const request = {
975
+ 'method': 'futuresPublicGetAllTickers',
976
+ };
977
+ return await this.fetchTickers(symbols, this.extend(request, params));
978
+ }
955
979
  async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
956
980
  /**
957
981
  * @method