ccxt 4.0.100 → 4.0.101

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 (52) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +390 -142
  3. package/dist/ccxt.browser.min.js +2 -2
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/binance.js +28 -1
  6. package/dist/cjs/src/bitbank.js +11 -0
  7. package/dist/cjs/src/bitfinex.js +12 -8
  8. package/dist/cjs/src/bitflyer.js +39 -10
  9. package/dist/cjs/src/bitforex.js +0 -8
  10. package/dist/cjs/src/bitget.js +15 -5
  11. package/dist/cjs/src/bitstamp1.js +22 -0
  12. package/dist/cjs/src/bl3p.js +24 -0
  13. package/dist/cjs/src/bybit.js +111 -36
  14. package/dist/cjs/src/coinbasepro.js +11 -0
  15. package/dist/cjs/src/currencycom.js +1 -1
  16. package/dist/cjs/src/huobi.js +1 -1
  17. package/dist/cjs/src/huobijp.js +1 -1
  18. package/dist/cjs/src/idex.js +1 -1
  19. package/dist/cjs/src/kucoinfutures.js +46 -51
  20. package/dist/cjs/src/lbank.js +1 -1
  21. package/dist/cjs/src/lbank2.js +1 -1
  22. package/dist/cjs/src/pro/huobijp.js +1 -2
  23. package/dist/cjs/src/pro/krakenfutures.js +7 -7
  24. package/dist/cjs/src/pro/kucoin.js +51 -2
  25. package/dist/cjs/src/pro/kucoinfutures.js +3 -3
  26. package/dist/cjs/src/pro/phemex.js +2 -2
  27. package/js/ccxt.d.ts +1 -1
  28. package/js/ccxt.js +1 -1
  29. package/js/src/binance.js +28 -1
  30. package/js/src/bitbank.js +11 -0
  31. package/js/src/bitfinex.js +12 -8
  32. package/js/src/bitflyer.js +39 -10
  33. package/js/src/bitforex.js +0 -8
  34. package/js/src/bitget.js +15 -5
  35. package/js/src/bitstamp1.js +22 -0
  36. package/js/src/bl3p.js +24 -0
  37. package/js/src/bybit.js +111 -36
  38. package/js/src/coinbasepro.js +11 -0
  39. package/js/src/currencycom.js +1 -1
  40. package/js/src/huobi.js +1 -1
  41. package/js/src/huobijp.js +1 -1
  42. package/js/src/idex.js +1 -1
  43. package/js/src/kucoinfutures.js +46 -51
  44. package/js/src/lbank.js +1 -1
  45. package/js/src/lbank2.js +1 -1
  46. package/js/src/pro/huobijp.js +1 -2
  47. package/js/src/pro/krakenfutures.js +7 -7
  48. package/js/src/pro/kucoin.d.ts +1 -0
  49. package/js/src/pro/kucoin.js +51 -2
  50. package/js/src/pro/kucoinfutures.js +3 -3
  51. package/js/src/pro/phemex.js +2 -2
  52. package/package.json +1 -1
@@ -19095,6 +19095,18 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
19095
19095
  // "M": true // Was the trade the best price match?
19096
19096
  // }
19097
19097
  //
19098
+ // REST: aggregate trades for swap & future (both linear and inverse)
19099
+ //
19100
+ // {
19101
+ // "a": "269772814",
19102
+ // "p": "25864.1",
19103
+ // "q": "3",
19104
+ // "f": "662149354",
19105
+ // "l": "662149355",
19106
+ // "T": "1694209776022",
19107
+ // "m": false,
19108
+ // }
19109
+ //
19098
19110
  // recent public trades and old public trades
19099
19111
  // https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#recent-trades-list
19100
19112
  // https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#old-trade-lookup-market_data
@@ -19348,7 +19360,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
19348
19360
  }
19349
19361
  }
19350
19362
  if (limit !== undefined) {
19351
- request['limit'] = limit; // default = 500, maximum = 1000
19363
+ const isFutureOrSwap = (market['swap'] || market['future']);
19364
+ request['limit'] = isFutureOrSwap ? Math.min(limit, 1000) : limit; // default = 500, maximum = 1000
19352
19365
  }
19353
19366
  params = this.omit(params, ['until', 'fetchTradesMethod']);
19354
19367
  //
@@ -19377,6 +19390,20 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
19377
19390
  // }
19378
19391
  // ]
19379
19392
  //
19393
+ // inverse (swap & future)
19394
+ //
19395
+ // [
19396
+ // {
19397
+ // "a": "269772814",
19398
+ // "p": "25864.1",
19399
+ // "q": "3",
19400
+ // "f": "662149354",
19401
+ // "l": "662149355",
19402
+ // "T": "1694209776022",
19403
+ // "m": false,
19404
+ // },
19405
+ // ]
19406
+ //
19380
19407
  // recent public trades and historical public trades
19381
19408
  //
19382
19409
  // [
@@ -28891,6 +28918,17 @@ class bitbank extends _abstract_bitbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
28891
28918
  return this.parseOrderBook(orderbook, market['symbol'], timestamp);
28892
28919
  }
28893
28920
  parseTrade(trade, market = undefined) {
28921
+ //
28922
+ // fetchTrades
28923
+ //
28924
+ // {
28925
+ // "transaction_id": "1143247037",
28926
+ // "side": "buy",
28927
+ // "price": "3836025",
28928
+ // "amount": "0.0005",
28929
+ // "executed_at": "1694249441593"
28930
+ // }
28931
+ //
28894
28932
  const timestamp = this.safeInteger(trade, 'executed_at');
28895
28933
  market = this.safeMarket(undefined, market);
28896
28934
  const priceString = this.safeString(trade, 'price');
@@ -31725,14 +31763,6 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
31725
31763
  // "type":"sell"
31726
31764
  // }
31727
31765
  //
31728
- // { "timestamp":1637258238,
31729
- // "tid":894452800,
31730
- // "price":"0.99958",
31731
- // "amount":"261.90514",
31732
- // "exchange":"bitfinex",
31733
- // "type":"buy"
31734
- // }
31735
- //
31736
31766
  // fetchMyTrades (private) v1
31737
31767
  //
31738
31768
  // {
@@ -31811,6 +31841,18 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
31811
31841
  request['timestamp'] = this.parseToInt(since / 1000);
31812
31842
  }
31813
31843
  const response = await this.publicGetTradesSymbol(this.extend(request, params));
31844
+ //
31845
+ // [
31846
+ // {
31847
+ // "timestamp": "1694284565",
31848
+ // "tid": "1415415034",
31849
+ // "price": "25862.0",
31850
+ // "amount": "0.00020685",
31851
+ // "exchange": "bitfinex",
31852
+ // "type": "buy"
31853
+ // },
31854
+ // ]
31855
+ //
31814
31856
  return this.parseTrades(response, market, since, limit);
31815
31857
  }
31816
31858
  async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -35803,7 +35845,7 @@ class bitflyer extends _abstract_bitflyer_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
35803
35845
  //
35804
35846
  // fetchTrades (public) v1
35805
35847
  //
35806
- // {
35848
+ // {
35807
35849
  // "id":2278466664,
35808
35850
  // "side":"SELL",
35809
35851
  // "price":56810.7,
@@ -35813,16 +35855,18 @@ class bitflyer extends _abstract_bitflyer_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
35813
35855
  // "sell_child_order_acceptance_id":"JRF20211119-114639-236919"
35814
35856
  // }
35815
35857
  //
35816
- // {
35817
- // "id":2278463423,
35818
- // "side":"BUY",
35819
- // "price":56757.83,
35820
- // "size":0.6003,"exec_date":"2021-11-19T11:28:00.523",
35821
- // "buy_child_order_acceptance_id":"JRF20211119-112800-236526",
35822
- // "sell_child_order_acceptance_id":"JRF20211119-112734-062017"
35823
- // }
35824
- //
35858
+ // fetchMyTrades
35825
35859
  //
35860
+ // {
35861
+ // "id": 37233,
35862
+ // "side": "BUY",
35863
+ // "price": 33470,
35864
+ // "size": 0.01,
35865
+ // "exec_date": "2015-07-07T09:57:40.397",
35866
+ // "child_order_id": "JOR20150707-060559-021935",
35867
+ // "child_order_acceptance_id": "JRF20150707-060559-396699"
35868
+ // "commission": 0,
35869
+ // },
35826
35870
  //
35827
35871
  let side = this.safeStringLower(trade, 'side');
35828
35872
  if (side !== undefined) {
@@ -35881,6 +35925,19 @@ class bitflyer extends _abstract_bitflyer_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
35881
35925
  request['count'] = limit;
35882
35926
  }
35883
35927
  const response = await this.publicGetGetexecutions(this.extend(request, params));
35928
+ //
35929
+ // [
35930
+ // {
35931
+ // "id": 39287,
35932
+ // "side": "BUY",
35933
+ // "price": 31690,
35934
+ // "size": 27.04,
35935
+ // "exec_date": "2015-07-08T02:43:34.823",
35936
+ // "buy_child_order_acceptance_id": "JRF20150707-200203-452209",
35937
+ // "sell_child_order_acceptance_id": "JRF20150708-024334-060234"
35938
+ // },
35939
+ // ]
35940
+ //
35884
35941
  return this.parseTrades(response, market, since, limit);
35885
35942
  }
35886
35943
  async fetchTradingFee(symbol, params = {}) {
@@ -36117,6 +36174,20 @@ class bitflyer extends _abstract_bitflyer_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
36117
36174
  request['count'] = limit;
36118
36175
  }
36119
36176
  const response = await this.privateGetGetexecutions(this.extend(request, params));
36177
+ //
36178
+ // [
36179
+ // {
36180
+ // "id": 37233,
36181
+ // "side": "BUY",
36182
+ // "price": 33470,
36183
+ // "size": 0.01,
36184
+ // "exec_date": "2015-07-07T09:57:40.397",
36185
+ // "child_order_id": "JOR20150707-060559-021935",
36186
+ // "child_order_acceptance_id": "JRF20150707-060559-396699"
36187
+ // "commission": 0,
36188
+ // },
36189
+ // ]
36190
+ //
36120
36191
  return this.parseTrades(response, market, since, limit);
36121
36192
  }
36122
36193
  async fetchPositions(symbols = undefined, params = {}) {
@@ -36649,14 +36720,6 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
36649
36720
  // "tid":"1131019666"
36650
36721
  // }
36651
36722
  //
36652
- // {
36653
- // "price":57591.33,
36654
- // "amount":0.002,
36655
- // "time":1637329685322,
36656
- // "direction":1,
36657
- // "tid":"1131019639"
36658
- // }
36659
- //
36660
36723
  // fetchMyTrades (private)
36661
36724
  //
36662
36725
  // {
@@ -39384,7 +39447,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
39384
39447
  // "fillTime": "1692073691000"
39385
39448
  // }
39386
39449
  //
39387
- // swap
39450
+ // swap (public trades)
39388
39451
  //
39389
39452
  // {
39390
39453
  // "tradeId": "1075199767891652609",
@@ -39516,6 +39579,16 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
39516
39579
  params = this.omit(params, 'method');
39517
39580
  if (swapMethod === 'publicMixGetMarketFillsHistory') {
39518
39581
  response = await this.publicMixGetMarketFillsHistory(this.extend(request, params));
39582
+ //
39583
+ // {
39584
+ // "tradeId": "1084459062491590657",
39585
+ // "price": "25874",
39586
+ // "size": "1.624",
39587
+ // "side": "Buy",
39588
+ // "timestamp": "1694281109000",
39589
+ // "symbol": "BTCUSDT_UMCBL",
39590
+ // }
39591
+ //
39519
39592
  }
39520
39593
  else if (swapMethod === 'publicMixGetMarketFills') {
39521
39594
  response = await this.publicMixGetMarketFills(this.extend(request, params));
@@ -40216,12 +40289,12 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
40216
40289
  }
40217
40290
  else if (isStopLossOrTakeProfit) {
40218
40291
  if (isStopLoss) {
40219
- const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice');
40220
- request['presetStopLossPrice'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
40292
+ const slTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice');
40293
+ request['presetStopLossPrice'] = this.priceToPrecision(symbol, slTriggerPrice);
40221
40294
  }
40222
40295
  if (isTakeProfit) {
40223
- const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice');
40224
- request['presetTakeProfitPrice'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
40296
+ const tpTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice');
40297
+ request['presetTakeProfitPrice'] = this.priceToPrecision(symbol, tpTriggerPrice);
40225
40298
  }
40226
40299
  }
40227
40300
  }
@@ -59359,6 +59432,17 @@ class bitstamp1 extends _abstract_bitstamp1_js__WEBPACK_IMPORTED_MODULE_0__/* ["
59359
59432
  return this.parseTicker(ticker, market);
59360
59433
  }
59361
59434
  parseTrade(trade, market = undefined) {
59435
+ //
59436
+ // public trade
59437
+ //
59438
+ // {
59439
+ // "amount": "0.00114000",
59440
+ // "date": "1694287856",
59441
+ // "price": "25865",
59442
+ // "tid": 298730788,
59443
+ // "type": 0
59444
+ // }
59445
+ //
59362
59446
  const timestamp = this.safeTimestamp2(trade, 'date', 'datetime');
59363
59447
  const side = (trade['type'] === 0) ? 'buy' : 'sell';
59364
59448
  const orderId = this.safeString(trade, 'order_id');
@@ -59403,6 +59487,17 @@ class bitstamp1 extends _abstract_bitstamp1_js__WEBPACK_IMPORTED_MODULE_0__/* ["
59403
59487
  'time': 'minute',
59404
59488
  };
59405
59489
  const response = await this.publicGetTransactions(this.extend(request, params));
59490
+ //
59491
+ // [
59492
+ // {
59493
+ // "amount": "0.00114000",
59494
+ // "date": "1694287856",
59495
+ // "price": "25865",
59496
+ // "tid": 298730788,
59497
+ // "type": 0
59498
+ // },
59499
+ // ]
59500
+ //
59406
59501
  return this.parseTrades(response, market, since, limit);
59407
59502
  }
59408
59503
  parseBalance(response) {
@@ -65968,6 +66063,16 @@ class bl3p extends _abstract_bl3p_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
65968
66063
  return this.parseTicker(ticker, market);
65969
66064
  }
65970
66065
  parseTrade(trade, market = undefined) {
66066
+ //
66067
+ // fetchTrades
66068
+ //
66069
+ // {
66070
+ // "trade_id": "2518789",
66071
+ // "date": "1694348697745",
66072
+ // "amount_int": "2959153",
66073
+ // "price_int": "2416231440"
66074
+ // }
66075
+ //
65971
66076
  const id = this.safeString(trade, 'trade_id');
65972
66077
  const timestamp = this.safeInteger(trade, 'date');
65973
66078
  const price = this.safeString(trade, 'price_int');
@@ -66004,6 +66109,20 @@ class bl3p extends _abstract_bl3p_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
66004
66109
  const response = await this.publicGetMarketTrades(this.extend({
66005
66110
  'market': market['id'],
66006
66111
  }, params));
66112
+ //
66113
+ // {
66114
+ // "result": "success",
66115
+ // "data": {
66116
+ // "trades": [
66117
+ // {
66118
+ // "trade_id": "2518789",
66119
+ // "date": "1694348697745",
66120
+ // "amount_int": "2959153",
66121
+ // "price_int": "2416231440"
66122
+ // },
66123
+ // ]
66124
+ // }
66125
+ // }
66007
66126
  const result = this.parseTrades(response['data']['trades'], market, since, limit);
66008
66127
  return result;
66009
66128
  }
@@ -72347,7 +72466,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
72347
72466
  '110023': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
72348
72467
  '110024': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
72349
72468
  '110025': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
72350
- '110026': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
72469
+ '110026': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
72351
72470
  '110027': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
72352
72471
  '110028': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
72353
72472
  '110029': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder,
@@ -74022,20 +74141,14 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
74022
74141
  request['limit'] = limit; // max 1000, default 1000
74023
74142
  }
74024
74143
  request['interval'] = this.safeString(this.timeframes, timeframe, timeframe);
74025
- let method = undefined;
74144
+ let response = undefined;
74026
74145
  if (market['spot']) {
74027
74146
  request['category'] = 'spot';
74028
- method = 'publicGetV5MarketKline';
74147
+ response = await this.publicGetV5MarketKline(this.extend(request, params));
74029
74148
  }
74030
74149
  else {
74031
74150
  const price = this.safeString(params, 'price');
74032
74151
  params = this.omit(params, 'price');
74033
- const methods = {
74034
- 'mark': 'publicGetV5MarketMarkPriceKline',
74035
- 'index': 'publicGetV5MarketIndexPriceKline',
74036
- 'premiumIndex': 'publicGetV5MarketPremiumIndexPriceKline',
74037
- };
74038
- method = this.safeValue(methods, price, 'publicGetV5MarketKline');
74039
74152
  if (market['linear']) {
74040
74153
  request['category'] = 'linear';
74041
74154
  }
@@ -74045,8 +74158,19 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
74045
74158
  else {
74046
74159
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchOHLCV() is not supported for option markets');
74047
74160
  }
74161
+ if (price === 'mark') {
74162
+ response = await this.publicGetV5MarketMarkPriceKline(this.extend(request, params));
74163
+ }
74164
+ else if (price === 'index') {
74165
+ response = await this.publicGetV5MarketIndexPriceKline(this.extend(request, params));
74166
+ }
74167
+ else if (price === 'premiumIndex') {
74168
+ response = await this.publicGetV5MarketPremiumIndexPriceKline(this.extend(request, params));
74169
+ }
74170
+ else {
74171
+ response = await this.publicGetV5MarketKline(this.extend(request, params));
74172
+ }
74048
74173
  }
74049
- const response = await this[method](this.extend(request, params));
74050
74174
  //
74051
74175
  // {
74052
74176
  // "retCode": 0,
@@ -75219,6 +75343,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75219
75343
  * @param {boolean} [params.isLeverage] *unified spot only* false then spot trading true then margin trading
75220
75344
  * @param {string} [params.tpslMode] *contract only* 'full' or 'partial'
75221
75345
  * @param {string} [params.mmp] *option only* market maker protection
75346
+ * @param {int} [params.triggerDirection] *contract only* conditional orders, 1: triggered when market price rises to triggerPrice, 2: triggered when market price falls to triggerPrice
75222
75347
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
75223
75348
  */
75224
75349
  await this.loadMarkets();
@@ -75326,7 +75451,6 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75326
75451
  const isBuy = side === 'buy';
75327
75452
  const ascending = stopLossTriggerPrice ? !isBuy : isBuy;
75328
75453
  if (triggerPrice !== undefined) {
75329
- request['triggerDirection'] = ascending ? 2 : 1;
75330
75454
  request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
75331
75455
  }
75332
75456
  else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
@@ -75472,8 +75596,13 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75472
75596
  request['orderLinkId'] = this.uuid16();
75473
75597
  }
75474
75598
  params = this.omit(params, ['stopPrice', 'timeInForce', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'postOnly', 'clientOrderId']);
75475
- const method = market['option'] ? 'privatePostOptionUsdcOpenapiPrivateV1PlaceOrder' : 'privatePostPerpetualUsdcOpenapiPrivateV1PlaceOrder';
75476
- const response = await this[method](this.extend(request, params));
75599
+ let response = undefined;
75600
+ if (market['option']) {
75601
+ response = await this.privatePostOptionUsdcOpenapiPrivateV1PlaceOrder(this.extend(request, params));
75602
+ }
75603
+ else {
75604
+ response = await this.privatePostPerpetualUsdcOpenapiPrivateV1PlaceOrder(this.extend(request, params));
75605
+ }
75477
75606
  //
75478
75607
  // {
75479
75608
  // "retCode":0,
@@ -75515,12 +75644,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75515
75644
  if (price !== undefined) {
75516
75645
  request['orderPrice'] = this.priceToPrecision(symbol, price);
75517
75646
  }
75518
- let method = undefined;
75647
+ let response = undefined;
75519
75648
  if (market['option']) {
75520
- method = 'privatePostOptionUsdcOpenapiPrivateV1ReplaceOrder';
75649
+ response = await this.privatePostOptionUsdcOpenapiPrivateV1ReplaceOrder(this.extend(request, params));
75521
75650
  }
75522
75651
  else {
75523
- method = 'privatePostPerpetualUsdcOpenapiPrivateV1ReplaceOrder';
75524
75652
  const isStop = this.safeValue(params, 'stop', false);
75525
75653
  const triggerPrice = this.safeValue2(params, 'stopPrice', 'triggerPrice');
75526
75654
  const stopLossPrice = this.safeValue(params, 'stopLossPrice');
@@ -75541,8 +75669,8 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75541
75669
  }
75542
75670
  }
75543
75671
  params = this.omit(params, ['stop', 'stopPrice', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice']);
75672
+ response = await this.privatePostPerpetualUsdcOpenapiPrivateV1ReplaceOrder(this.extend(request, params));
75544
75673
  }
75545
- const response = await this[method](this.extend(request, params));
75546
75674
  //
75547
75675
  // {
75548
75676
  // "retCode": 0,
@@ -75676,18 +75804,17 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75676
75804
  };
75677
75805
  const isStop = this.safeValue(params, 'stop', false);
75678
75806
  params = this.omit(params, ['stop']);
75679
- let method = undefined;
75680
75807
  if (id !== undefined) { // The user can also use argument params["order_link_id"]
75681
75808
  request['orderId'] = id;
75682
75809
  }
75810
+ let response = undefined;
75683
75811
  if (market['option']) {
75684
- method = 'privatePostOptionUsdcOpenapiPrivateV1CancelOrder';
75812
+ response = await this.privatePostOptionUsdcOpenapiPrivateV1CancelOrder(this.extend(request, params));
75685
75813
  }
75686
75814
  else {
75687
- method = 'privatePostPerpetualUsdcOpenapiPrivateV1CancelOrder';
75688
75815
  request['orderFilter'] = isStop ? 'StopOrder' : 'Order';
75816
+ response = await this.privatePostPerpetualUsdcOpenapiPrivateV1CancelOrder(this.extend(request, params));
75689
75817
  }
75690
- const response = await this[method](this.extend(request, params));
75691
75818
  //
75692
75819
  // {
75693
75820
  // "retCode": 0,
@@ -76860,7 +76987,6 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
76860
76987
  request['start_date'] = this.yyyymmdd(since);
76861
76988
  }
76862
76989
  }
76863
- const method = (enableUnified[1]) ? 'privateGetV5AccountTransactionLog' : 'privateGetV2PrivateWalletFundRecords';
76864
76990
  if (code !== undefined) {
76865
76991
  currency = this.currency(code);
76866
76992
  request[currencyKey] = currency['id'];
@@ -76868,7 +76994,13 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
76868
76994
  if (limit !== undefined) {
76869
76995
  request['limit'] = limit;
76870
76996
  }
76871
- const response = await this[method](this.extend(request, params));
76997
+ let response = undefined;
76998
+ if (enableUnified[1]) {
76999
+ response = await this.privateGetV5AccountTransactionLog(this.extend(request, params));
77000
+ }
77001
+ else {
77002
+ response = await this.privateGetV2PrivateWalletFundRecords(this.extend(request, params));
77003
+ }
76872
77004
  //
76873
77005
  // {
76874
77006
  // "ret_code": 0,
@@ -77589,21 +77721,83 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
77589
77721
  });
77590
77722
  }
77591
77723
  async setMarginMode(marginMode, symbol = undefined, params = {}) {
77724
+ /**
77725
+ * @method
77726
+ * @name bybit#setMarginMode
77727
+ * @description set margin mode (account) or trade mode (symbol)
77728
+ * @see https://bybit-exchange.github.io/docs/v5/account/set-margin-mode
77729
+ * @see https://bybit-exchange.github.io/docs/v5/position/cross-isolate
77730
+ * @param {string} marginMode account mode must be either [isolated, cross, portfolio], trade mode must be either [isolated, cross]
77731
+ * @param {string} symbol unified market symbol of the market the position is held in, default is undefined
77732
+ * @param {object} [params] extra parameters specific to the bybit api endpoint
77733
+ * @param {string} [params.leverage] the rate of leverage, is required if setting trade mode (symbol)
77734
+ * @returns {object} response from the exchange
77735
+ */
77592
77736
  await this.loadMarkets();
77593
77737
  const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
77594
77738
  const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
77595
- if (marginMode === 'ISOLATED_MARGIN') {
77596
- if (!isUnifiedAccount) {
77597
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' setMarginMode() Normal Account not support ISOLATED_MARGIN');
77739
+ let response = undefined;
77740
+ if (symbol === undefined) {
77741
+ if (marginMode === 'isolated') {
77742
+ if (!isUnifiedAccount) {
77743
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' setMarginMode() Normal Account not support ISOLATED_MARGIN');
77744
+ }
77745
+ marginMode = 'ISOLATED_MARGIN';
77746
+ }
77747
+ else if (marginMode === 'cross') {
77748
+ marginMode = 'REGULAR_MARGIN';
77749
+ }
77750
+ else if (marginMode === 'portfolio') {
77751
+ marginMode = 'PORTFOLIO_MARGIN';
77598
77752
  }
77753
+ else {
77754
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' setMarginMode() marginMode must be either [isolated, cross, portfolio]');
77755
+ }
77756
+ const request = {
77757
+ 'setMarginMode': marginMode,
77758
+ };
77759
+ response = await this.privatePostV5AccountSetMarginMode(this.extend(request, params));
77599
77760
  }
77600
- else if ((marginMode !== 'REGULAR_MARGIN') && (marginMode !== 'PORTFOLIO_MARGIN')) {
77601
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' setMarginMode() marginMode must be either ISOLATED_MARGIN or REGULAR_MARGIN or PORTFOLIO_MARGIN');
77761
+ else {
77762
+ const market = this.market(symbol);
77763
+ let type = undefined;
77764
+ [type, params] = this.getBybitType('setMarginMode', market, params);
77765
+ if (type === 'linear') {
77766
+ if (isUnifiedAccount) {
77767
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' setMarginMode() with symbol Unified Account only support inverse contract');
77768
+ }
77769
+ const isUsdtSettled = market['settle'] === 'USDT';
77770
+ if (!isUsdtSettled) {
77771
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' setMarginMode() with symbol only support USDT perpetual / inverse contract');
77772
+ }
77773
+ }
77774
+ else if (type !== 'inverse') {
77775
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' setMarginMode() does not support this market type');
77776
+ }
77777
+ let tradeMode = undefined;
77778
+ if (marginMode === 'cross') {
77779
+ tradeMode = 0;
77780
+ }
77781
+ else if (marginMode === 'isolated') {
77782
+ tradeMode = 1;
77783
+ }
77784
+ else {
77785
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' setMarginMode() with symbol marginMode must be either [isolated, cross]');
77786
+ }
77787
+ const leverage = this.safeString(params, 'leverage');
77788
+ params = this.omit(params, ['leverage']);
77789
+ if (leverage === undefined) {
77790
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' setMarginMode() with symbol requires leverage');
77791
+ }
77792
+ const request = {
77793
+ 'category': type,
77794
+ 'symbol': market['id'],
77795
+ 'tradeMode': tradeMode,
77796
+ 'buyLeverage': leverage,
77797
+ 'sellLeverage': leverage,
77798
+ };
77799
+ response = await this.privatePostV5PositionSwitchIsolated(this.extend(request, params));
77602
77800
  }
77603
- const request = {
77604
- 'setMarginMode': marginMode,
77605
- };
77606
- const response = await this.privatePostV5AccountSetMarginMode(this.extend(request, params));
77607
77801
  return response;
77608
77802
  }
77609
77803
  async setLeverage(leverage, symbol = undefined, params = {}) {
@@ -77635,15 +77829,14 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
77635
77829
  'buyLeverage': leverage,
77636
77830
  'sellLeverage': leverage,
77637
77831
  };
77638
- let method = undefined;
77832
+ let response = undefined;
77639
77833
  if (isUsdcSettled && !isUnifiedAccount) {
77640
77834
  request['leverage'] = leverage;
77641
- method = 'privatePostPerpetualUsdcOpenapiPrivateV1PositionLeverageSave';
77835
+ response = await this.privatePostPerpetualUsdcOpenapiPrivateV1PositionLeverageSave(this.extend(request, params));
77642
77836
  }
77643
77837
  else {
77644
77838
  request['buyLeverage'] = leverage;
77645
77839
  request['sellLeverage'] = leverage;
77646
- method = 'privatePostV5PositionSetLeverage';
77647
77840
  if (market['linear']) {
77648
77841
  request['category'] = 'linear';
77649
77842
  }
@@ -77653,8 +77846,9 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
77653
77846
  else {
77654
77847
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' setLeverage() only support linear and inverse market');
77655
77848
  }
77849
+ response = await this.privatePostV5PositionSetLeverage(this.extend(request, params));
77656
77850
  }
77657
- return await this[method](this.extend(request, params));
77851
+ return response;
77658
77852
  }
77659
77853
  async setPositionMode(hedged, symbol = undefined, params = {}) {
77660
77854
  /**
@@ -84365,6 +84559,17 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
84365
84559
  request['limit'] = limit; // default 100
84366
84560
  }
84367
84561
  const response = await this.publicGetProductsIdTrades(this.extend(request, params));
84562
+ //
84563
+ // [
84564
+ // {
84565
+ // "trade_id": "15035219",
84566
+ // "side": "sell",
84567
+ // "size": "0.27426731",
84568
+ // "price": "25820.42000000",
84569
+ // "time": "2023-09-10T13:47:41.447577Z"
84570
+ // },
84571
+ // ]
84572
+ //
84368
84573
  return this.parseTrades(response, market, since, limit);
84369
84574
  }
84370
84575
  async fetchTradingFees(params = {}) {
@@ -100557,7 +100762,7 @@ class currencycom extends _abstract_currencycom_js__WEBPACK_IMPORTED_MODULE_0__/
100557
100762
  // 'limit': 500, // default 500, max 1000
100558
100763
  };
100559
100764
  if (limit !== undefined) {
100560
- request['limit'] = limit; // default 500, max 1000
100765
+ request['limit'] = Math.min(limit, 1000); // default 500, max 1000
100561
100766
  }
100562
100767
  if (since !== undefined) {
100563
100768
  request['startTime'] = since;
@@ -129539,7 +129744,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
129539
129744
  }
129540
129745
  request[fieldName] = market['id'];
129541
129746
  if (limit !== undefined) {
129542
- request['size'] = limit; // max 2000
129747
+ request['size'] = Math.min(limit, 2000); // max 2000
129543
129748
  }
129544
129749
  const response = await this[method](this.extend(request, params));
129545
129750
  //
@@ -136036,7 +136241,7 @@ class huobijp extends _abstract_huobijp_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
136036
136241
  'symbol': market['id'],
136037
136242
  };
136038
136243
  if (limit !== undefined) {
136039
- request['size'] = limit;
136244
+ request['size'] = Math.min(limit, 2000);
136040
136245
  }
136041
136246
  const response = await this.marketGetHistoryTrade(this.extend(request, params));
136042
136247
  //
@@ -137601,7 +137806,7 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
137601
137806
  request['start'] = since;
137602
137807
  }
137603
137808
  if (limit !== undefined) {
137604
- request['limit'] = limit;
137809
+ request['limit'] = Math.min(limit, 1000);
137605
137810
  }
137606
137811
  // [
137607
137812
  // {
@@ -150528,58 +150733,53 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
150528
150733
  const request = {
150529
150734
  'symbol': market['id'],
150530
150735
  };
150531
- const response = await this.futuresPrivateGetPositions(this.extend(request, params));
150736
+ const response = await this.futuresPrivateGetPosition(this.extend(request, params));
150532
150737
  //
150533
- // {
150534
- // "code": "200000",
150535
- // "data": [
150536
- // {
150537
- // "id": "63b3599e6c41f50001c47d44",
150538
- // "symbol": "XBTUSDTM",
150539
- // "autoDeposit": false,
150540
- // "maintMarginReq": 0.004,
150541
- // "riskLimit": 25000,
150542
- // "realLeverage": 5.0,
150543
- // "crossMode": false,
150544
- // "delevPercentage": 0.57,
150545
- // "openingTimestamp": 1684000025528,
150546
- // "currentTimestamp": 1684000052160,
150547
- // "currentQty": 1,
150548
- // "currentCost": 26.821,
150549
- // "currentComm": 0.0160926,
150550
- // "unrealisedCost": 26.821,
150551
- // "realisedGrossCost": 0.0,
150552
- // "realisedCost": 0.0160926,
150553
- // "isOpen": true,
150554
- // "markPrice": 26821.13,
150555
- // "markValue": 26.82113,
150556
- // "posCost": 26.821,
150557
- // "posCross": 0.0,
150558
- // "posCrossMargin": 0.0,
150559
- // "posInit": 5.3642,
150560
- // "posComm": 0.01931112,
150561
- // "posCommCommon": 0.01931112,
150562
- // "posLoss": 0.0,
150563
- // "posMargin": 5.38351112,
150564
- // "posMaint": 0.12927722,
150565
- // "maintMargin": 5.38364112,
150566
- // "realisedGrossPnl": 0.0,
150567
- // "realisedPnl": -0.0160926,
150568
- // "unrealisedPnl": 1.3E-4,
150569
- // "unrealisedPnlPcnt": 0.0,
150570
- // "unrealisedRoePcnt": 0.0,
150571
- // "avgEntryPrice": 26821.0,
150572
- // "liquidationPrice": 21567.0,
150573
- // "bankruptPrice": 21456.0,
150574
- // "settleCurrency": "USDT",
150575
- // "isInverse": false,
150576
- // "maintainMargin": 0.004
150577
- // }
150578
- // ]
150579
- // }
150738
+ // {
150739
+ // "code": "200000",
150740
+ // "data": {
150741
+ // "id": "6505ee6eaff4070001f651c4",
150742
+ // "symbol": "XBTUSDTM",
150743
+ // "autoDeposit": false,
150744
+ // "maintMarginReq": 0,
150745
+ // "riskLimit": 200,
150746
+ // "realLeverage": 0.0,
150747
+ // "crossMode": false,
150748
+ // "delevPercentage": 0.0,
150749
+ // "currentTimestamp": 1694887534594,
150750
+ // "currentQty": 0,
150751
+ // "currentCost": 0.0,
150752
+ // "currentComm": 0.0,
150753
+ // "unrealisedCost": 0.0,
150754
+ // "realisedGrossCost": 0.0,
150755
+ // "realisedCost": 0.0,
150756
+ // "isOpen": false,
150757
+ // "markPrice": 26611.71,
150758
+ // "markValue": 0.0,
150759
+ // "posCost": 0.0,
150760
+ // "posCross": 0,
150761
+ // "posInit": 0.0,
150762
+ // "posComm": 0.0,
150763
+ // "posLoss": 0.0,
150764
+ // "posMargin": 0.0,
150765
+ // "posMaint": 0.0,
150766
+ // "maintMargin": 0.0,
150767
+ // "realisedGrossPnl": 0.0,
150768
+ // "realisedPnl": 0.0,
150769
+ // "unrealisedPnl": 0.0,
150770
+ // "unrealisedPnlPcnt": 0,
150771
+ // "unrealisedRoePcnt": 0,
150772
+ // "avgEntryPrice": 0.0,
150773
+ // "liquidationPrice": 0.0,
150774
+ // "bankruptPrice": 0.0,
150775
+ // "settleCurrency": "USDT",
150776
+ // "maintainMargin": 0,
150777
+ // "riskLimitLevel": 1
150778
+ // }
150779
+ // }
150580
150780
  //
150581
- const data = this.safeValue(response, 'data', []);
150582
- return this.parsePosition(data[0], market);
150781
+ const data = this.safeValue(response, 'data', {});
150782
+ return this.parsePosition(data, market);
150583
150783
  }
150584
150784
  async fetchPositions(symbols = undefined, params = {}) {
150585
150785
  /**
@@ -150725,7 +150925,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
150725
150925
  'unrealizedPnl': this.parseNumber(unrealisedPnl),
150726
150926
  'contracts': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAbs */ .O.stringAbs(size)),
150727
150927
  'contractSize': this.safeValue(market, 'contractSize'),
150728
- 'realizedPnl': this.safeNumber(position, 'realised_pnl'),
150928
+ 'realizedPnl': this.safeNumber(position, 'realisedPnl'),
150729
150929
  'marginRatio': undefined,
150730
150930
  'liquidationPrice': this.safeNumber(position, 'liquidationPrice'),
150731
150931
  'markPrice': this.safeNumber(position, 'markPrice'),
@@ -154998,7 +155198,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
154998
155198
  request['time'] = since;
154999
155199
  }
155000
155200
  if (limit !== undefined) {
155001
- request['size'] = limit;
155201
+ request['size'] = Math.min(limit, 600);
155002
155202
  }
155003
155203
  const response = await this.publicGetTrades(this.extend(request, params));
155004
155204
  return this.parseTrades(response, market, since, limit);
@@ -156408,7 +156608,7 @@ class lbank2 extends _abstract_lbank2_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
156408
156608
  request['time'] = since;
156409
156609
  }
156410
156610
  if (limit !== undefined) {
156411
- request['size'] = limit;
156611
+ request['size'] = Math.min(limit, 600);
156412
156612
  }
156413
156613
  else {
156414
156614
  request['size'] = 600; // max
@@ -221089,8 +221289,7 @@ class huobijp extends _huobijp_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
221089
221289
  // unroll the accumulated deltas
221090
221290
  const messages = orderbook.cache;
221091
221291
  for (let i = 0; i < messages.length; i++) {
221092
- const message = messages[i];
221093
- this.handleOrderBookMessage(client, message, orderbook);
221292
+ this.handleOrderBookMessage(client, messages[i], orderbook);
221094
221293
  }
221095
221294
  this.orderbooks[symbol] = orderbook;
221096
221295
  client.resolve(orderbook, messageHash);
@@ -224300,9 +224499,9 @@ class krakenfutures extends _krakenfutures_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
224300
224499
  let totalAmount = '0';
224301
224500
  const trades = previousOrder['trades'];
224302
224501
  for (let i = 0; i < trades.length; i++) {
224303
- const trade = trades[i];
224304
- totalCost = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAdd */ .O.stringAdd(totalCost, this.numberToString(trade['cost']));
224305
- totalAmount = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAdd */ .O.stringAdd(totalAmount, this.numberToString(trade['amount']));
224502
+ const currentTrade = trades[i];
224503
+ totalCost = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAdd */ .O.stringAdd(totalCost, this.numberToString(currentTrade['cost']));
224504
+ totalAmount = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAdd */ .O.stringAdd(totalAmount, this.numberToString(currentTrade['amount']));
224306
224505
  }
224307
224506
  if (_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringGt */ .O.stringGt(totalAmount, '0')) {
224308
224507
  previousOrder['average'] = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringDiv */ .O.stringDiv(totalCost, totalAmount);
@@ -224337,13 +224536,13 @@ class krakenfutures extends _krakenfutures_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
224337
224536
  if (isCancel) {
224338
224537
  // get order without symbol
224339
224538
  for (let i = 0; i < orders.length; i++) {
224340
- const order = orders[i];
224341
- if (order['id'] === message['order_id']) {
224342
- orders[i] = this.extend(order, {
224539
+ const currentOrder = orders[i];
224540
+ if (currentOrder['id'] === message['order_id']) {
224541
+ orders[i] = this.extend(currentOrder, {
224343
224542
  'status': 'canceled',
224344
224543
  });
224345
224544
  client.resolve(orders, 'orders');
224346
- client.resolve(orders, 'orders:' + order['symbol']);
224545
+ client.resolve(orders, 'orders:' + currentOrder['symbol']);
224347
224546
  break;
224348
224547
  }
224349
224548
  }
@@ -225130,7 +225329,7 @@ class kucoin extends _kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
225130
225329
  'watchOrderBook': true,
225131
225330
  'watchOrders': true,
225132
225331
  'watchMyTrades': true,
225133
- 'watchTickers': false,
225332
+ 'watchTickers': true,
225134
225333
  'watchTicker': true,
225135
225334
  'watchTrades': true,
225136
225335
  'watchTradesForSymbols': true,
@@ -225248,6 +225447,29 @@ class kucoin extends _kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
225248
225447
  const messageHash = 'ticker:' + symbol;
225249
225448
  return await this.subscribe(url, messageHash, topic, query);
225250
225449
  }
225450
+ async watchTickers(symbols = undefined, params = {}) {
225451
+ /**
225452
+ * @method
225453
+ * @name kucoin#watchTickers
225454
+ * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
225455
+ * @param {string[]} symbols unified symbol of the market to fetch the ticker for
225456
+ * @param {object} [params] extra parameters specific to the kucoin api endpoint
225457
+ * @returns {object} a [ticker structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
225458
+ */
225459
+ await this.loadMarkets();
225460
+ symbols = this.marketSymbols(symbols);
225461
+ let messageHash = 'tickers';
225462
+ if (symbols !== undefined) {
225463
+ messageHash = 'tickers::' + symbols.join(',');
225464
+ }
225465
+ const url = await this.negotiate(false);
225466
+ const topic = '/market/ticker:all';
225467
+ const tickers = await this.subscribe(url, messageHash, topic, params);
225468
+ if (this.newUpdates) {
225469
+ return tickers;
225470
+ }
225471
+ return this.filterByArray(this.tickers, 'symbol', symbols);
225472
+ }
225251
225473
  handleTicker(client, message) {
225252
225474
  //
225253
225475
  // market/snapshot
@@ -225307,7 +225529,14 @@ class kucoin extends _kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
225307
225529
  let market = undefined;
225308
225530
  if (topic !== undefined) {
225309
225531
  const parts = topic.split(':');
225310
- const marketId = this.safeString(parts, 1);
225532
+ const first = this.safeString(parts, 1);
225533
+ let marketId = undefined;
225534
+ if (first === 'all') {
225535
+ marketId = this.safeString(message, 'subject');
225536
+ }
225537
+ else {
225538
+ marketId = first;
225539
+ }
225311
225540
  market = this.safeMarket(marketId, market, '-');
225312
225541
  }
225313
225542
  const data = this.safeValue(message, 'data', {});
@@ -225317,6 +225546,21 @@ class kucoin extends _kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
225317
225546
  this.tickers[symbol] = ticker;
225318
225547
  const messageHash = 'ticker:' + symbol;
225319
225548
  client.resolve(ticker, messageHash);
225549
+ // watchTickers
225550
+ client.resolve(ticker, 'tickers');
225551
+ const messageHashes = this.findMessageHashes(client, 'tickers::');
225552
+ for (let i = 0; i < messageHashes.length; i++) {
225553
+ const messageHash = messageHashes[i];
225554
+ const parts = messageHash.split('::');
225555
+ const symbolsString = parts[1];
225556
+ const symbols = symbolsString.split(',');
225557
+ const tickers = this.filterByArray(this.tickers, 'symbol', symbols);
225558
+ const tickersSymbols = Object.keys(tickers);
225559
+ const numTickers = tickersSymbols.length;
225560
+ if (numTickers > 0) {
225561
+ client.resolve(tickers, messageHash);
225562
+ }
225563
+ }
225320
225564
  }
225321
225565
  async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
225322
225566
  /**
@@ -225996,6 +226240,10 @@ class kucoin extends _kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
225996
226240
  // }
225997
226241
  // }
225998
226242
  //
226243
+ const topic = this.safeString(message, 'topic');
226244
+ if (topic === '/market/ticker:all') {
226245
+ return this.handleTicker(client, message);
226246
+ }
225999
226247
  const subject = this.safeString(message, 'subject');
226000
226248
  const methods = {
226001
226249
  'trade.l2update': this.handleOrderBook,
@@ -226458,9 +226706,9 @@ class kucoinfutures extends _kucoinfutures_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
226458
226706
  const deltaEnd = this.safeInteger(data, 'sequence');
226459
226707
  if (nonce === undefined) {
226460
226708
  const cacheLength = storedOrderBook.cache.length;
226461
- const topicParts = topic.split(':');
226462
- const topicSymbol = this.safeString(topicParts, 1);
226463
- const topicChannel = this.safeString(topicParts, 0);
226709
+ const topicPartsNew = topic.split(':');
226710
+ const topicSymbol = this.safeString(topicPartsNew, 1);
226711
+ const topicChannel = this.safeString(topicPartsNew, 0);
226464
226712
  const subscriptions = Object.keys(client.subscriptions);
226465
226713
  let subscription = undefined;
226466
226714
  for (let i = 0; i < subscriptions.length; i++) {
@@ -232592,8 +232840,8 @@ class phemex extends _phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
232592
232840
  return method.call(this, client, message);
232593
232841
  }
232594
232842
  }
232595
- const method = this.safeString(message, 'method', '');
232596
- if (('market24h' in message) || ('spot_market24h' in message) || (method.indexOf('perp_market24h_pack_p') >= 0)) {
232843
+ const methodName = this.safeString(message, 'method', '');
232844
+ if (('market24h' in message) || ('spot_market24h' in message) || (methodName.indexOf('perp_market24h_pack_p') >= 0)) {
232597
232845
  return this.handleTicker(client, message);
232598
232846
  }
232599
232847
  else if (('trades' in message) || ('trades_p' in message)) {
@@ -273772,7 +274020,7 @@ SOFTWARE.
273772
274020
 
273773
274021
  //-----------------------------------------------------------------------------
273774
274022
  // this is updated by vss.js when building
273775
- const version = '4.0.100';
274023
+ const version = '4.0.101';
273776
274024
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
273777
274025
  //-----------------------------------------------------------------------------
273778
274026