ccxt 4.2.44 → 4.2.45

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.
@@ -7096,6 +7096,7 @@ class Exchange {
7096
7096
  this.balance = {};
7097
7097
  this.orderbooks = {};
7098
7098
  this.tickers = {};
7099
+ this.bidsasks = {};
7099
7100
  this.orders = undefined;
7100
7101
  this.triggerOrders = undefined;
7101
7102
  this.transactions = {};
@@ -10463,12 +10464,46 @@ class Exchange {
10463
10464
  const market = this.market(symbol);
10464
10465
  return this.safeString(market, 'symbol', symbol);
10465
10466
  }
10467
+ handleParamString(params, paramName, defaultValue = undefined) {
10468
+ const value = this.safeString(params, paramName, defaultValue);
10469
+ if (value !== undefined) {
10470
+ params = this.omit(params, paramName);
10471
+ }
10472
+ return [value, params];
10473
+ }
10466
10474
  resolvePath(path, params) {
10467
10475
  return [
10468
10476
  this.implodeParams(path, params),
10469
10477
  this.omit(params, this.extractParams(path)),
10470
10478
  ];
10471
10479
  }
10480
+ getListFromObjectValues(objects, key) {
10481
+ const newArray = this.toArray(objects);
10482
+ const results = [];
10483
+ for (let i = 0; i < newArray.length; i++) {
10484
+ results.push(newArray[i][key]);
10485
+ }
10486
+ return results;
10487
+ }
10488
+ getSymbolsForMarketType(marketType = undefined, subType = undefined, symbolWithActiveStatus = true, symbolWithUnknownStatus = true) {
10489
+ let filteredMarkets = this.markets;
10490
+ if (marketType !== undefined) {
10491
+ filteredMarkets = this.filterBy(filteredMarkets, 'type', marketType);
10492
+ }
10493
+ if (subType !== undefined) {
10494
+ this.checkRequiredArgument('getSymbolsForMarketType', subType, 'subType', ['linear', 'inverse', 'quanto']);
10495
+ filteredMarkets = this.filterBy(filteredMarkets, 'subType', subType);
10496
+ }
10497
+ const activeStatuses = [];
10498
+ if (symbolWithActiveStatus) {
10499
+ activeStatuses.push(true);
10500
+ }
10501
+ if (symbolWithUnknownStatus) {
10502
+ activeStatuses.push(undefined);
10503
+ }
10504
+ filteredMarkets = this.filterByArray(filteredMarkets, 'active', activeStatuses, false);
10505
+ return this.getListFromObjectValues(filteredMarkets, 'symbol');
10506
+ }
10472
10507
  filterByArray(objects, key, values = undefined, indexed = true) {
10473
10508
  objects = this.toArray(objects);
10474
10509
  // return all of them if no values were passed
@@ -11394,6 +11429,19 @@ class Exchange {
11394
11429
  return depositAddress;
11395
11430
  }
11396
11431
  }
11432
+ else if (this.has['fetchDepositAddressesByNetwork']) {
11433
+ const network = this.safeString(params, 'network');
11434
+ params = this.omit(params, 'network');
11435
+ const addressStructures = await this.fetchDepositAddressesByNetwork(code, params);
11436
+ if (network !== undefined) {
11437
+ return this.safeDict(addressStructures, network);
11438
+ }
11439
+ else {
11440
+ const keys = Object.keys(addressStructures);
11441
+ const key = this.safeString(keys, 0);
11442
+ return this.safeDict(addressStructures, key);
11443
+ }
11444
+ }
11397
11445
  else {
11398
11446
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchDepositAddress() is not supported yet');
11399
11447
  }
@@ -18102,7 +18150,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
18102
18150
  'fetchOHLCV': true,
18103
18151
  'fetchOpenInterest': true,
18104
18152
  'fetchOpenInterestHistory': true,
18105
- 'fetchOpenOrder': false,
18153
+ 'fetchOpenOrder': true,
18106
18154
  'fetchOpenOrders': true,
18107
18155
  'fetchOrder': true,
18108
18156
  'fetchOrderBook': true,
@@ -23171,7 +23219,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23171
23219
  // "status": "NEW"
23172
23220
  // }
23173
23221
  //
23174
- // createOrder, fetchOpenOrders: portfolio margin linear swap and future conditional
23222
+ // createOrder, fetchOpenOrders, fetchOpenOrder: portfolio margin linear swap and future conditional
23175
23223
  //
23176
23224
  // {
23177
23225
  // "newClientStrategyId": "x-xcKtGhcu27f109953d6e4dc0974006",
@@ -23310,6 +23358,130 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23310
23358
  // "selfTradePreventionMode": "NONE"
23311
23359
  // }
23312
23360
  //
23361
+ // fetchOpenOrder: linear swap
23362
+ //
23363
+ // {
23364
+ // "orderId": 3697213934,
23365
+ // "symbol": "BTCUSDT",
23366
+ // "status": "NEW",
23367
+ // "clientOrderId": "x-xcKtGhcufb20c5a7761a4aa09aa156",
23368
+ // "price": "33000.00",
23369
+ // "avgPrice": "0.00000",
23370
+ // "origQty": "0.010",
23371
+ // "executedQty": "0.000",
23372
+ // "cumQuote": "0.00000",
23373
+ // "timeInForce": "GTC",
23374
+ // "type": "LIMIT",
23375
+ // "reduceOnly": false,
23376
+ // "closePosition": false,
23377
+ // "side": "BUY",
23378
+ // "positionSide": "BOTH",
23379
+ // "stopPrice": "0.00",
23380
+ // "workingType": "CONTRACT_PRICE",
23381
+ // "priceProtect": false,
23382
+ // "origType": "LIMIT",
23383
+ // "priceMatch": "NONE",
23384
+ // "selfTradePreventionMode": "NONE",
23385
+ // "goodTillDate": 0,
23386
+ // "time": 1707892893502,
23387
+ // "updateTime": 1707892893515
23388
+ // }
23389
+ //
23390
+ // fetchOpenOrder: inverse swap
23391
+ //
23392
+ // {
23393
+ // "orderId": 597368542,
23394
+ // "symbol": "BTCUSD_PERP",
23395
+ // "pair": "BTCUSD",
23396
+ // "status": "NEW",
23397
+ // "clientOrderId": "x-xcKtGhcubbde7ba93b1a4ab881eff3",
23398
+ // "price": "35000",
23399
+ // "avgPrice": "0",
23400
+ // "origQty": "1",
23401
+ // "executedQty": "0",
23402
+ // "cumBase": "0",
23403
+ // "timeInForce": "GTC",
23404
+ // "type": "LIMIT",
23405
+ // "reduceOnly": false,
23406
+ // "closePosition": false,
23407
+ // "side": "BUY",
23408
+ // "positionSide": "BOTH",
23409
+ // "stopPrice": "0",
23410
+ // "workingType": "CONTRACT_PRICE",
23411
+ // "priceProtect": false,
23412
+ // "origType": "LIMIT",
23413
+ // "time": 1707893453199,
23414
+ // "updateTime": 1707893453199
23415
+ // }
23416
+ //
23417
+ // fetchOpenOrder: linear portfolio margin
23418
+ //
23419
+ // {
23420
+ // "orderId": 264895013409,
23421
+ // "symbol": "BTCUSDT",
23422
+ // "status": "NEW",
23423
+ // "clientOrderId": "x-xcKtGhcu6278f1adbdf14f74ab432e",
23424
+ // "price": "35000",
23425
+ // "avgPrice": "0",
23426
+ // "origQty": "0.010",
23427
+ // "executedQty": "0",
23428
+ // "cumQuote": "0",
23429
+ // "timeInForce": "GTC",
23430
+ // "type": "LIMIT",
23431
+ // "reduceOnly": false,
23432
+ // "side": "BUY",
23433
+ // "positionSide": "LONG",
23434
+ // "origType": "LIMIT",
23435
+ // "time": 1707893839364,
23436
+ // "updateTime": 1707893839364,
23437
+ // "goodTillDate": 0,
23438
+ // "selfTradePreventionMode": "NONE"
23439
+ // }
23440
+ //
23441
+ // fetchOpenOrder: inverse portfolio margin
23442
+ //
23443
+ // {
23444
+ // "orderId": 71790316950,
23445
+ // "symbol": "ETHUSD_PERP",
23446
+ // "pair": "ETHUSD",
23447
+ // "status": "NEW",
23448
+ // "clientOrderId": "x-xcKtGhcuec11030474204ab08ba2c2",
23449
+ // "price": "2500",
23450
+ // "avgPrice": "0",
23451
+ // "origQty": "1",
23452
+ // "executedQty": "0",
23453
+ // "cumBase": "0",
23454
+ // "timeInForce": "GTC",
23455
+ // "type": "LIMIT",
23456
+ // "reduceOnly": false,
23457
+ // "side": "BUY",
23458
+ // "positionSide": "LONG",
23459
+ // "origType": "LIMIT",
23460
+ // "time": 1707894181694,
23461
+ // "updateTime": 1707894181694
23462
+ // }
23463
+ //
23464
+ // fetchOpenOrder: inverse portfolio margin conditional
23465
+ //
23466
+ // {
23467
+ // "newClientStrategyId": "x-xcKtGhcu2da9c765294b433994ffce",
23468
+ // "strategyId": 1423501,
23469
+ // "strategyStatus": "NEW",
23470
+ // "strategyType": "STOP",
23471
+ // "origQty": "1",
23472
+ // "price": "2500",
23473
+ // "reduceOnly": false,
23474
+ // "side": "BUY",
23475
+ // "positionSide": "LONG",
23476
+ // "stopPrice": "4000",
23477
+ // "symbol": "ETHUSD_PERP",
23478
+ // "bookTime": 1707894782679,
23479
+ // "updateTime": 1707894782679,
23480
+ // "timeInForce": "GTC",
23481
+ // "workingType": "CONTRACT_PRICE",
23482
+ // "priceProtect": false
23483
+ // }
23484
+ //
23313
23485
  const code = this.safeString(order, 'code');
23314
23486
  if (code !== undefined) {
23315
23487
  // cancelOrders/createOrders might have a partial success
@@ -24309,7 +24481,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24309
24481
  [marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
24310
24482
  let isPortfolioMargin = undefined;
24311
24483
  [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchOpenOrders', 'papi', 'portfolioMargin', false);
24312
- const isConditional = this.safeBool2(params, 'stop', 'conditional');
24484
+ const isConditional = this.safeBoolN(params, ['stop', 'conditional', 'trigger']);
24313
24485
  if (symbol !== undefined) {
24314
24486
  market = this.market(symbol);
24315
24487
  request['symbol'] = market['id'];
@@ -24329,7 +24501,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24329
24501
  }
24330
24502
  let subType = undefined;
24331
24503
  [subType, params] = this.handleSubTypeAndParams('fetchOpenOrders', market, params);
24332
- params = this.omit(params, ['type', 'stop', 'conditional']);
24504
+ params = this.omit(params, ['type', 'stop', 'conditional', 'trigger']);
24333
24505
  let response = undefined;
24334
24506
  if (type === 'option') {
24335
24507
  if (since !== undefined) {
@@ -24385,6 +24557,223 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24385
24557
  }
24386
24558
  return this.parseOrders(response, market, since, limit);
24387
24559
  }
24560
+ async fetchOpenOrder(id, symbol = undefined, params = {}) {
24561
+ /**
24562
+ * @method
24563
+ * @name binance#fetchOpenOrder
24564
+ * @description fetch an open order by the id
24565
+ * @see https://binance-docs.github.io/apidocs/futures/en/#query-current-open-order-user_data
24566
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#query-current-open-order-user_data
24567
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-current-um-open-order-user_data
24568
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-current-cm-open-order-user_data
24569
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-current-um-open-conditional-order-user_data
24570
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-current-cm-open-conditional-order-user_data
24571
+ * @param {string} id order id
24572
+ * @param {string} symbol unified market symbol
24573
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
24574
+ * @param {string} [params.trigger] set to true if you would like to fetch portfolio margin account stop or conditional orders
24575
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
24576
+ */
24577
+ if (symbol === undefined) {
24578
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchOpenOrder() requires a symbol argument');
24579
+ }
24580
+ await this.loadMarkets();
24581
+ const market = this.market(symbol);
24582
+ const request = {
24583
+ 'symbol': market['id'],
24584
+ };
24585
+ let isPortfolioMargin = undefined;
24586
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchOpenOrder', 'papi', 'portfolioMargin', false);
24587
+ const isConditional = this.safeBoolN(params, ['stop', 'conditional', 'trigger']);
24588
+ params = this.omit(params, ['stop', 'conditional', 'trigger']);
24589
+ const isPortfolioMarginConditional = (isPortfolioMargin && isConditional);
24590
+ const orderIdRequest = isPortfolioMarginConditional ? 'strategyId' : 'orderId';
24591
+ request[orderIdRequest] = id;
24592
+ let response = undefined;
24593
+ if (market['linear']) {
24594
+ if (isPortfolioMargin) {
24595
+ if (isConditional) {
24596
+ response = await this.papiGetUmConditionalOpenOrder(this.extend(request, params));
24597
+ }
24598
+ else {
24599
+ response = await this.papiGetUmOpenOrder(this.extend(request, params));
24600
+ }
24601
+ }
24602
+ else {
24603
+ response = await this.fapiPrivateGetOpenOrder(this.extend(request, params));
24604
+ }
24605
+ }
24606
+ else if (market['inverse']) {
24607
+ if (isPortfolioMargin) {
24608
+ if (isConditional) {
24609
+ response = await this.papiGetCmConditionalOpenOrder(this.extend(request, params));
24610
+ }
24611
+ else {
24612
+ response = await this.papiGetCmOpenOrder(this.extend(request, params));
24613
+ }
24614
+ }
24615
+ else {
24616
+ response = await this.dapiPrivateGetOpenOrder(this.extend(request, params));
24617
+ }
24618
+ }
24619
+ else {
24620
+ if (market['option']) {
24621
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOpenOrder() does not support option markets');
24622
+ }
24623
+ else if (market['spot']) {
24624
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOpenOrder() does not support spot markets');
24625
+ }
24626
+ }
24627
+ //
24628
+ // linear swap
24629
+ //
24630
+ // {
24631
+ // "orderId": 3697213934,
24632
+ // "symbol": "BTCUSDT",
24633
+ // "status": "NEW",
24634
+ // "clientOrderId": "x-xcKtGhcufb20c5a7761a4aa09aa156",
24635
+ // "price": "33000.00",
24636
+ // "avgPrice": "0.00000",
24637
+ // "origQty": "0.010",
24638
+ // "executedQty": "0.000",
24639
+ // "cumQuote": "0.00000",
24640
+ // "timeInForce": "GTC",
24641
+ // "type": "LIMIT",
24642
+ // "reduceOnly": false,
24643
+ // "closePosition": false,
24644
+ // "side": "BUY",
24645
+ // "positionSide": "BOTH",
24646
+ // "stopPrice": "0.00",
24647
+ // "workingType": "CONTRACT_PRICE",
24648
+ // "priceProtect": false,
24649
+ // "origType": "LIMIT",
24650
+ // "priceMatch": "NONE",
24651
+ // "selfTradePreventionMode": "NONE",
24652
+ // "goodTillDate": 0,
24653
+ // "time": 1707892893502,
24654
+ // "updateTime": 1707892893515
24655
+ // }
24656
+ //
24657
+ // inverse swap
24658
+ //
24659
+ // {
24660
+ // "orderId": 597368542,
24661
+ // "symbol": "BTCUSD_PERP",
24662
+ // "pair": "BTCUSD",
24663
+ // "status": "NEW",
24664
+ // "clientOrderId": "x-xcKtGhcubbde7ba93b1a4ab881eff3",
24665
+ // "price": "35000",
24666
+ // "avgPrice": "0",
24667
+ // "origQty": "1",
24668
+ // "executedQty": "0",
24669
+ // "cumBase": "0",
24670
+ // "timeInForce": "GTC",
24671
+ // "type": "LIMIT",
24672
+ // "reduceOnly": false,
24673
+ // "closePosition": false,
24674
+ // "side": "BUY",
24675
+ // "positionSide": "BOTH",
24676
+ // "stopPrice": "0",
24677
+ // "workingType": "CONTRACT_PRICE",
24678
+ // "priceProtect": false,
24679
+ // "origType": "LIMIT",
24680
+ // "time": 1707893453199,
24681
+ // "updateTime": 1707893453199
24682
+ // }
24683
+ //
24684
+ // linear portfolio margin
24685
+ //
24686
+ // {
24687
+ // "orderId": 264895013409,
24688
+ // "symbol": "BTCUSDT",
24689
+ // "status": "NEW",
24690
+ // "clientOrderId": "x-xcKtGhcu6278f1adbdf14f74ab432e",
24691
+ // "price": "35000",
24692
+ // "avgPrice": "0",
24693
+ // "origQty": "0.010",
24694
+ // "executedQty": "0",
24695
+ // "cumQuote": "0",
24696
+ // "timeInForce": "GTC",
24697
+ // "type": "LIMIT",
24698
+ // "reduceOnly": false,
24699
+ // "side": "BUY",
24700
+ // "positionSide": "LONG",
24701
+ // "origType": "LIMIT",
24702
+ // "time": 1707893839364,
24703
+ // "updateTime": 1707893839364,
24704
+ // "goodTillDate": 0,
24705
+ // "selfTradePreventionMode": "NONE"
24706
+ // }
24707
+ //
24708
+ // inverse portfolio margin
24709
+ //
24710
+ // {
24711
+ // "orderId": 71790316950,
24712
+ // "symbol": "ETHUSD_PERP",
24713
+ // "pair": "ETHUSD",
24714
+ // "status": "NEW",
24715
+ // "clientOrderId": "x-xcKtGhcuec11030474204ab08ba2c2",
24716
+ // "price": "2500",
24717
+ // "avgPrice": "0",
24718
+ // "origQty": "1",
24719
+ // "executedQty": "0",
24720
+ // "cumBase": "0",
24721
+ // "timeInForce": "GTC",
24722
+ // "type": "LIMIT",
24723
+ // "reduceOnly": false,
24724
+ // "side": "BUY",
24725
+ // "positionSide": "LONG",
24726
+ // "origType": "LIMIT",
24727
+ // "time": 1707894181694,
24728
+ // "updateTime": 1707894181694
24729
+ // }
24730
+ //
24731
+ // linear portfolio margin conditional
24732
+ //
24733
+ // {
24734
+ // "newClientStrategyId": "x-xcKtGhcu2205fde44418483ca21874",
24735
+ // "strategyId": 4084339,
24736
+ // "strategyStatus": "NEW",
24737
+ // "strategyType": "STOP",
24738
+ // "origQty": "0.010",
24739
+ // "price": "35000",
24740
+ // "reduceOnly": false,
24741
+ // "side": "BUY",
24742
+ // "positionSide": "LONG",
24743
+ // "stopPrice": "60000",
24744
+ // "symbol": "BTCUSDT",
24745
+ // "bookTime": 1707894490094,
24746
+ // "updateTime": 1707894490094,
24747
+ // "timeInForce": "GTC",
24748
+ // "workingType": "CONTRACT_PRICE",
24749
+ // "priceProtect": false,
24750
+ // "goodTillDate": 0,
24751
+ // "selfTradePreventionMode": "NONE"
24752
+ // }
24753
+ //
24754
+ // inverse portfolio margin conditional
24755
+ //
24756
+ // {
24757
+ // "newClientStrategyId": "x-xcKtGhcu2da9c765294b433994ffce",
24758
+ // "strategyId": 1423501,
24759
+ // "strategyStatus": "NEW",
24760
+ // "strategyType": "STOP",
24761
+ // "origQty": "1",
24762
+ // "price": "2500",
24763
+ // "reduceOnly": false,
24764
+ // "side": "BUY",
24765
+ // "positionSide": "LONG",
24766
+ // "stopPrice": "4000",
24767
+ // "symbol": "ETHUSD_PERP",
24768
+ // "bookTime": 1707894782679,
24769
+ // "updateTime": 1707894782679,
24770
+ // "timeInForce": "GTC",
24771
+ // "workingType": "CONTRACT_PRICE",
24772
+ // "priceProtect": false
24773
+ // }
24774
+ //
24775
+ return this.parseOrder(response, market);
24776
+ }
24388
24777
  async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
24389
24778
  /**
24390
24779
  * @method
@@ -29298,12 +29687,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
29298
29687
  * @see https://binance-docs.github.io/apidocs/spot/en/#get-force-liquidation-record-user_data
29299
29688
  * @see https://binance-docs.github.io/apidocs/futures/en/#user-39-s-force-orders-user_data
29300
29689
  * @see https://binance-docs.github.io/apidocs/delivery/en/#user-39-s-force-orders-user_data
29690
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-user-39-s-margin-force-orders-user_data
29691
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-user-39-s-um-force-orders-user_data
29692
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-user-39-s-cm-force-orders-user_data
29301
29693
  * @param {string} [symbol] unified CCXT market symbol
29302
29694
  * @param {int} [since] the earliest time in ms to fetch liquidations for
29303
29695
  * @param {int} [limit] the maximum number of liquidation structures to retrieve
29304
29696
  * @param {object} [params] exchange specific parameters for the binance api endpoint
29305
29697
  * @param {int} [params.until] timestamp in ms of the latest liquidation
29306
29698
  * @param {boolean} [params.paginate] *spot only* default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
29699
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch liquidations in a portfolio margin account
29307
29700
  * @returns {object} an array of [liquidation structures]{@link https://docs.ccxt.com/#/?id=liquidation-structure}
29308
29701
  */
29309
29702
  await this.loadMarkets();
@@ -29320,13 +29713,17 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
29320
29713
  [type, params] = this.handleMarketTypeAndParams('fetchMyLiquidations', market, params);
29321
29714
  let subType = undefined;
29322
29715
  [subType, params] = this.handleSubTypeAndParams('fetchMyLiquidations', market, params, 'linear');
29716
+ let isPortfolioMargin = undefined;
29717
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchMyLiquidations', 'papi', 'portfolioMargin', false);
29323
29718
  let request = {};
29324
29719
  if (type !== 'spot') {
29325
29720
  request['autoCloseType'] = 'LIQUIDATION';
29326
29721
  }
29327
29722
  if (market !== undefined) {
29328
29723
  const symbolKey = market['spot'] ? 'isolatedSymbol' : 'symbol';
29329
- request[symbolKey] = market['id'];
29724
+ if (!isPortfolioMargin) {
29725
+ request[symbolKey] = market['id'];
29726
+ }
29330
29727
  }
29331
29728
  if (since !== undefined) {
29332
29729
  request['startTime'] = since;
@@ -29342,13 +29739,28 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
29342
29739
  [request, params] = this.handleUntilOption('endTime', request, params);
29343
29740
  let response = undefined;
29344
29741
  if (type === 'spot') {
29345
- response = await this.sapiGetMarginForceLiquidationRec(this.extend(request, params));
29742
+ if (isPortfolioMargin) {
29743
+ response = await this.papiGetMarginForceOrders(this.extend(request, params));
29744
+ }
29745
+ else {
29746
+ response = await this.sapiGetMarginForceLiquidationRec(this.extend(request, params));
29747
+ }
29346
29748
  }
29347
29749
  else if (subType === 'linear') {
29348
- response = await this.fapiPrivateGetForceOrders(this.extend(request, params));
29750
+ if (isPortfolioMargin) {
29751
+ response = await this.papiGetUmForceOrders(this.extend(request, params));
29752
+ }
29753
+ else {
29754
+ response = await this.fapiPrivateGetForceOrders(this.extend(request, params));
29755
+ }
29349
29756
  }
29350
29757
  else if (subType === 'inverse') {
29351
- response = await this.dapiPrivateGetForceOrders(this.extend(request, params));
29758
+ if (isPortfolioMargin) {
29759
+ response = await this.papiGetCmForceOrders(this.extend(request, params));
29760
+ }
29761
+ else {
29762
+ response = await this.dapiPrivateGetForceOrders(this.extend(request, params));
29763
+ }
29352
29764
  }
29353
29765
  else {
29354
29766
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchMyLiquidations() does not support ' + market['type'] + ' markets');
@@ -29430,7 +29842,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
29430
29842
  // },
29431
29843
  // ]
29432
29844
  //
29433
- const liquidations = this.safeValue(response, 'rows', response);
29845
+ const liquidations = this.safeList(response, 'rows', response);
29434
29846
  return this.parseLiquidations(liquidations, market, since, limit);
29435
29847
  }
29436
29848
  parseLiquidation(liquidation, market = undefined) {
@@ -29989,6 +30401,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
29989
30401
  'fetchClosedOrders': true,
29990
30402
  'fetchCurrencies': true,
29991
30403
  'fetchDepositAddress': true,
30404
+ 'fetchDepositAddressesByNetwork': true,
29992
30405
  'fetchDeposits': true,
29993
30406
  'fetchDepositWithdrawFee': 'emulated',
29994
30407
  'fetchDepositWithdrawFees': true,
@@ -30341,6 +30754,13 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
30341
30754
  },
30342
30755
  'recvWindow': 5 * 1000,
30343
30756
  'broker': 'CCXT',
30757
+ 'defaultNetworks': {
30758
+ 'ETH': 'ETH',
30759
+ 'USDT': 'ERC20',
30760
+ 'USDC': 'ERC20',
30761
+ 'BTC': 'BTC',
30762
+ 'LTC': 'LTC',
30763
+ },
30344
30764
  },
30345
30765
  });
30346
30766
  }
@@ -33024,15 +33444,15 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
33024
33444
  'status': status,
33025
33445
  };
33026
33446
  }
33027
- async fetchDepositAddress(code, params = {}) {
33447
+ async fetchDepositAddressesByNetwork(code, params = {}) {
33028
33448
  /**
33029
33449
  * @method
33030
- * @name bingx#fetchDepositAddress
33031
- * @description fetch the deposit address for a currency associated with this account
33032
- * @see https://bingx-api.github.io/docs/#/common/sub-account#Query%20Main%20Account%20Deposit%20Address
33450
+ * @name bingx#fetchDepositAddressesByNetwork
33451
+ * @description fetch the deposit addresses for a currency associated with this account
33452
+ * @see https://bingx-api.github.io/docs/#/en-us/common/wallet-api.html#Query%20Main%20Account%20Deposit%20Address
33033
33453
  * @param {string} code unified currency code
33034
33454
  * @param {object} [params] extra parameters specific to the exchange API endpoint
33035
- * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
33455
+ * @returns {object} a dictionary [address structures]{@link https://docs.ccxt.com/#/?id=address-structure}, indexed by the network
33036
33456
  */
33037
33457
  await this.loadMarkets();
33038
33458
  const currency = this.currency(code);
@@ -33067,6 +33487,36 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
33067
33487
  const parsed = this.parseDepositAddresses(data, [currency['code']], false);
33068
33488
  return this.indexBy(parsed, 'network');
33069
33489
  }
33490
+ async fetchDepositAddress(code, params = {}) {
33491
+ /**
33492
+ * @method
33493
+ * @name bingx#fetchDepositAddress
33494
+ * @description fetch the deposit address for a currency associated with this account
33495
+ * @see https://bingx-api.github.io/docs/#/en-us/common/wallet-api.html#Query%20Main%20Account%20Deposit%20Address
33496
+ * @param {string} code unified currency code
33497
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
33498
+ * @param {string} [params.network] The chain of currency. This only apply for multi-chain currency, and there is no need for single chain currency
33499
+ * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
33500
+ */
33501
+ const network = this.safeString(params, 'network');
33502
+ params = this.omit(params, ['network']);
33503
+ const addressStructures = await this.fetchDepositAddressesByNetwork(code, params);
33504
+ if (network !== undefined) {
33505
+ return this.safeDict(addressStructures, network);
33506
+ }
33507
+ else {
33508
+ const options = this.safeDict(this.options, 'defaultNetworks');
33509
+ const defaultNetworkForCurrency = this.safeString(options, code);
33510
+ if (defaultNetworkForCurrency !== undefined) {
33511
+ return this.safeDict(addressStructures, defaultNetworkForCurrency);
33512
+ }
33513
+ else {
33514
+ const keys = Object.keys(addressStructures);
33515
+ const key = this.safeString(keys, 0);
33516
+ return this.safeDict(addressStructures, key);
33517
+ }
33518
+ }
33519
+ }
33070
33520
  parseDepositAddress(depositAddress, currency = undefined) {
33071
33521
  //
33072
33522
  // {
@@ -69130,7 +69580,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
69130
69580
  for (let i = 0; i < ids.length; i++) {
69131
69581
  const id = ids[i];
69132
69582
  if (id.indexOf('_') < 0) {
69133
- const value = this.safeNumber(transaction, id);
69583
+ const value = this.safeInteger(transaction, id);
69134
69584
  if ((value !== undefined) && (value !== 0)) {
69135
69585
  return id;
69136
69586
  }
@@ -82497,7 +82947,9 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
82497
82947
  'fetchBorrowInterest': false,
82498
82948
  'fetchBorrowRateHistories': false,
82499
82949
  'fetchBorrowRateHistory': false,
82950
+ 'fetchCanceledAndClosedOrders': true,
82500
82951
  'fetchCanceledOrders': true,
82952
+ 'fetchClosedOrder': true,
82501
82953
  'fetchClosedOrders': true,
82502
82954
  'fetchCrossBorrowRate': true,
82503
82955
  'fetchCrossBorrowRates': false,
@@ -82525,10 +82977,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
82525
82977
  'fetchOHLCV': true,
82526
82978
  'fetchOpenInterest': true,
82527
82979
  'fetchOpenInterestHistory': true,
82980
+ 'fetchOpenOrder': true,
82528
82981
  'fetchOpenOrders': true,
82529
- 'fetchOrder': true,
82982
+ 'fetchOrder': false,
82530
82983
  'fetchOrderBook': true,
82531
- 'fetchOrders': true,
82984
+ 'fetchOrders': false,
82532
82985
  'fetchOrderTrades': true,
82533
82986
  'fetchPosition': true,
82534
82987
  'fetchPositions': true,
@@ -85882,35 +86335,6 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
85882
86335
  'trades': undefined,
85883
86336
  }, market);
85884
86337
  }
85885
- async fetchOrder(id, symbol = undefined, params = {}) {
85886
- /**
85887
- * @method
85888
- * @name bybit#fetchOrder
85889
- * @description fetches information on an order made by the user
85890
- * @see https://bybit-exchange.github.io/docs/v5/order/order-list
85891
- * @param {string} symbol unified symbol of the market the order was made in
85892
- * @param {object} [params] extra parameters specific to the exchange API endpoint
85893
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
85894
- */
85895
- if (symbol === undefined) {
85896
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
85897
- }
85898
- await this.loadMarkets();
85899
- const request = {
85900
- 'orderId': id,
85901
- };
85902
- const result = await this.fetchOrders(symbol, undefined, undefined, this.extend(request, params));
85903
- const length = result.length;
85904
- if (length === 0) {
85905
- const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
85906
- const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
85907
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
85908
- }
85909
- if (length > 1) {
85910
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' returned more than one order');
85911
- }
85912
- return this.safeValue(result, 0);
85913
- }
85914
86338
  async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
85915
86339
  /**
85916
86340
  * @method
@@ -86946,29 +87370,99 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
86946
87370
  const data = this.safeValue(result, 'dataList', []);
86947
87371
  return this.parseOrders(data, market, since, limit);
86948
87372
  }
87373
+ async fetchOrder(id, symbol = undefined, params = {}) {
87374
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchOrder() is not supported after the 5/02 update, please use fetchOpenOrder or fetchClosedOrder');
87375
+ }
86949
87376
  async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
87377
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchOrders() is not supported after the 5/02 update, please use fetchOpenOrders, fetchClosedOrders or fetchCanceledOrders');
87378
+ }
87379
+ async fetchClosedOrder(id, symbol = undefined, params = {}) {
86950
87380
  /**
86951
87381
  * @method
86952
- * @name bybit#fetchOrders
86953
- * @description fetches information on multiple orders made by the user
87382
+ * @name bybit#fetchClosedOrder
87383
+ * @description fetches information on a closed order made by the user
86954
87384
  * @see https://bybit-exchange.github.io/docs/v5/order/order-list
86955
- * @param {string} symbol unified market symbol of the market orders were made in
87385
+ * @param {string} id order id
87386
+ * @param {string} [symbol] unified symbol of the market the order was made in
87387
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
87388
+ * @param {boolean} [params.stop] set to true for fetching a closed stop order
87389
+ * @param {string} [params.type] market type, ['swap', 'option', 'spot']
87390
+ * @param {string} [params.subType] market subType, ['linear', 'inverse']
87391
+ * @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
87392
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
87393
+ */
87394
+ await this.loadMarkets();
87395
+ const request = {
87396
+ 'orderId': id,
87397
+ };
87398
+ const result = await this.fetchClosedOrders(symbol, undefined, undefined, this.extend(request, params));
87399
+ const length = result.length;
87400
+ if (length === 0) {
87401
+ const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
87402
+ const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
87403
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
87404
+ }
87405
+ if (length > 1) {
87406
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' returned more than one order');
87407
+ }
87408
+ return this.safeValue(result, 0);
87409
+ }
87410
+ async fetchOpenOrder(id, symbol = undefined, params = {}) {
87411
+ /**
87412
+ * @method
87413
+ * @name bybit#fetchOpenOrder
87414
+ * @description fetches information on an open order made by the user
87415
+ * @see https://bybit-exchange.github.io/docs/v5/order/open-order
87416
+ * @param {string} id order id
87417
+ * @param {string} [symbol] unified symbol of the market the order was made in
87418
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
87419
+ * @param {boolean} [params.stop] set to true for fetching an open stop order
87420
+ * @param {string} [params.type] market type, ['swap', 'option', 'spot']
87421
+ * @param {string} [params.subType] market subType, ['linear', 'inverse']
87422
+ * @param {string} [params.baseCoin] Base coin. Supports linear, inverse & option
87423
+ * @param {string} [params.settleCoin] Settle coin. Supports linear, inverse & option
87424
+ * @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
87425
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
87426
+ */
87427
+ await this.loadMarkets();
87428
+ const request = {
87429
+ 'orderId': id,
87430
+ };
87431
+ const result = await this.fetchOpenOrders(symbol, undefined, undefined, this.extend(request, params));
87432
+ const length = result.length;
87433
+ if (length === 0) {
87434
+ const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
87435
+ const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
87436
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
87437
+ }
87438
+ if (length > 1) {
87439
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' returned more than one order');
87440
+ }
87441
+ return this.safeValue(result, 0);
87442
+ }
87443
+ async fetchCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
87444
+ /**
87445
+ * @method
87446
+ * @name bybit#fetchCanceledAndClosedOrders
87447
+ * @description fetches information on multiple canceled and closed orders made by the user
87448
+ * @see https://bybit-exchange.github.io/docs/v5/order/order-list
87449
+ * @param {string} [symbol] unified market symbol of the market orders were made in
86956
87450
  * @param {int} [since] the earliest time in ms to fetch orders for
86957
87451
  * @param {int} [limit] the maximum number of order structures to retrieve
86958
87452
  * @param {object} [params] extra parameters specific to the exchange API endpoint
86959
- * @param {boolean} [params.stop] true if stop order
87453
+ * @param {boolean} [params.stop] set to true for fetching stop orders
86960
87454
  * @param {string} [params.type] market type, ['swap', 'option', 'spot']
86961
87455
  * @param {string} [params.subType] market subType, ['linear', 'inverse']
86962
87456
  * @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
86963
87457
  * @param {int} [params.until] the latest time in ms to fetch entries for
86964
- * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
87458
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
86965
87459
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
86966
87460
  */
86967
87461
  await this.loadMarkets();
86968
87462
  let paginate = false;
86969
- [paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
87463
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchCanceledAndClosedOrders', 'paginate');
86970
87464
  if (paginate) {
86971
- return await this.fetchPaginatedCallCursor('fetchOrders', symbol, since, limit, params, 'nextPageCursor', 'nextPageCursor', undefined, 50);
87465
+ return await this.fetchPaginatedCallCursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, 'nextPageCursor', 'nextPageCursor', undefined, 50);
86972
87466
  }
86973
87467
  const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
86974
87468
  const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
@@ -86981,7 +87475,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
86981
87475
  request['symbol'] = market['id'];
86982
87476
  }
86983
87477
  let type = undefined;
86984
- [type, params] = this.getBybitType('fetchOrders', market, params);
87478
+ [type, params] = this.getBybitType('fetchCanceledAndClosedOrders', market, params);
86985
87479
  if (((type === 'option') || isUsdcSettled) && !isUnifiedAccount) {
86986
87480
  return await this.fetchUsdcOrders(symbol, since, limit, params);
86987
87481
  }
@@ -87063,17 +87557,23 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
87063
87557
  * @name bybit#fetchClosedOrders
87064
87558
  * @description fetches information on multiple closed orders made by the user
87065
87559
  * @see https://bybit-exchange.github.io/docs/v5/order/order-list
87066
- * @param {string} symbol unified market symbol of the market orders were made in
87560
+ * @param {string} [symbol] unified market symbol of the market orders were made in
87067
87561
  * @param {int} [since] the earliest time in ms to fetch orders for
87068
87562
  * @param {int} [limit] the maximum number of order structures to retrieve
87069
87563
  * @param {object} [params] extra parameters specific to the exchange API endpoint
87564
+ * @param {boolean} [params.stop] set to true for fetching closed stop orders
87565
+ * @param {string} [params.type] market type, ['swap', 'option', 'spot']
87566
+ * @param {string} [params.subType] market subType, ['linear', 'inverse']
87567
+ * @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
87568
+ * @param {int} [params.until] the latest time in ms to fetch entries for
87569
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
87070
87570
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
87071
87571
  */
87072
87572
  await this.loadMarkets();
87073
87573
  const request = {
87074
87574
  'orderStatus': 'Filled',
87075
87575
  };
87076
- return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
87576
+ return await this.fetchCanceledAndClosedOrders(symbol, since, limit, this.extend(request, params));
87077
87577
  }
87078
87578
  async fetchCanceledOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
87079
87579
  /**
@@ -87081,20 +87581,23 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
87081
87581
  * @name bybit#fetchCanceledOrders
87082
87582
  * @description fetches information on multiple canceled orders made by the user
87083
87583
  * @see https://bybit-exchange.github.io/docs/v5/order/order-list
87084
- * @param {string} symbol unified market symbol of the market orders were made in
87584
+ * @param {string} [symbol] unified market symbol of the market orders were made in
87085
87585
  * @param {int} [since] timestamp in ms of the earliest order, default is undefined
87086
87586
  * @param {int} [limit] max number of orders to return, default is undefined
87087
87587
  * @param {object} [params] extra parameters specific to the exchange API endpoint
87088
87588
  * @param {boolean} [params.stop] true if stop order
87089
87589
  * @param {string} [params.type] market type, ['swap', 'option', 'spot']
87090
87590
  * @param {string} [params.subType] market subType, ['linear', 'inverse']
87591
+ * @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
87592
+ * @param {int} [params.until] the latest time in ms to fetch entries for
87593
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
87091
87594
  * @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
87092
87595
  */
87093
87596
  await this.loadMarkets();
87094
87597
  const request = {
87095
87598
  'orderStatus': 'Cancelled',
87096
87599
  };
87097
- return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
87600
+ return await this.fetchCanceledAndClosedOrders(symbol, since, limit, this.extend(request, params));
87098
87601
  }
87099
87602
  async fetchUsdcOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
87100
87603
  await this.loadMarkets();
@@ -91891,6 +92394,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
91891
92394
  'fetchCrossBorrowRate': false,
91892
92395
  'fetchCrossBorrowRates': false,
91893
92396
  'fetchCurrencies': true,
92397
+ 'fetchDepositAddressesByNetwork': true,
91894
92398
  'fetchDeposits': true,
91895
92399
  'fetchFundingHistory': false,
91896
92400
  'fetchFundingRate': false,
@@ -91958,6 +92462,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
91958
92462
  'public': {
91959
92463
  'get': [
91960
92464
  'currencies',
92465
+ 'currencies/crypto',
91961
92466
  'time',
91962
92467
  'exchange-rates',
91963
92468
  'users/{user_id}',
@@ -92152,6 +92657,10 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
92152
92657
  'ACCOUNT_TYPE_CRYPTO',
92153
92658
  'ACCOUNT_TYPE_FIAT',
92154
92659
  ],
92660
+ 'networks': {
92661
+ 'ERC20': 'ethereum',
92662
+ 'XLM': 'stellar',
92663
+ },
92155
92664
  'createMarketBuyOrderRequiresPrice': true,
92156
92665
  'advanced': true,
92157
92666
  'fetchMarkets': 'fetchMarketsV3',
@@ -92507,10 +93016,10 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
92507
93016
  return this.parseTrades(buys['data'], undefined, since, limit);
92508
93017
  }
92509
93018
  async fetchTransactionsWithMethod(method, code = undefined, since = undefined, limit = undefined, params = {}) {
92510
- const request = await this.prepareAccountRequestWithCurrencyCode(code, limit, params);
93019
+ let request = undefined;
93020
+ [request, params] = await this.prepareAccountRequestWithCurrencyCode(code, limit, params);
92511
93021
  await this.loadMarkets();
92512
- const query = this.omit(params, ['account_id', 'accountId']);
92513
- const response = await this[method](this.extend(request, query));
93022
+ const response = await this[method](this.extend(request, params));
92514
93023
  return this.parseTransactions(response['data'], undefined, since, limit);
92515
93024
  }
92516
93025
  async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
@@ -93062,15 +93571,45 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
93062
93571
  const expires = this.safeInteger(options, 'expires', 1000);
93063
93572
  const now = this.milliseconds();
93064
93573
  if ((timestamp === undefined) || ((now - timestamp) > expires)) {
93065
- const currencies = await this.v2PublicGetCurrencies(params);
93574
+ const promises = [
93575
+ this.v2PublicGetCurrencies(params),
93576
+ this.v2PublicGetCurrenciesCrypto(params),
93577
+ ];
93578
+ const promisesResult = await Promise.all(promises);
93579
+ const fiatResponse = this.safeDict(promisesResult, 0, {});
93580
+ //
93581
+ // [
93582
+ // "data": {
93583
+ // id: 'IMP',
93584
+ // name: 'Isle of Man Pound',
93585
+ // min_size: '0.01'
93586
+ // },
93587
+ // ...
93588
+ // ]
93589
+ //
93590
+ const cryptoResponse = this.safeDict(promisesResult, 1, {});
93591
+ //
93592
+ // {
93593
+ // asset_id: '9476e3be-b731-47fa-82be-347fabc573d9',
93594
+ // code: 'AERO',
93595
+ // name: 'Aerodrome Finance',
93596
+ // color: '#0433FF',
93597
+ // sort_index: '340',
93598
+ // exponent: '8',
93599
+ // type: 'crypto',
93600
+ // address_regex: '^(?:0x)?[0-9a-fA-F]{40}$'
93601
+ // }
93602
+ //
93603
+ const fiatData = this.safeList(fiatResponse, 'data', []);
93604
+ const cryptoData = this.safeList(cryptoResponse, 'data', []);
93066
93605
  const exchangeRates = await this.v2PublicGetExchangeRates(params);
93067
93606
  this.options['fetchCurrencies'] = this.extend(options, {
93068
- 'currencies': currencies,
93607
+ 'currencies': this.arrayConcat(fiatData, cryptoData),
93069
93608
  'exchangeRates': exchangeRates,
93070
93609
  'timestamp': now,
93071
93610
  });
93072
93611
  }
93073
- return this.safeValue(this.options, 'fetchCurrencies', {});
93612
+ return this.safeDict(this.options, 'fetchCurrencies', {});
93074
93613
  }
93075
93614
  async fetchCurrencies(params = {}) {
93076
93615
  /**
@@ -93085,18 +93624,27 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
93085
93624
  const response = await this.fetchCurrenciesFromCache(params);
93086
93625
  const currencies = this.safeValue(response, 'currencies', {});
93087
93626
  //
93088
- // {
93089
- // "data":[
93090
- // {"id":"AED","name":"United Arab Emirates Dirham","min_size":"0.01000000"},
93091
- // {"id":"AFN","name":"Afghan Afghani","min_size":"0.01000000"},
93092
- // {"id":"ALL","name":"Albanian Lek","min_size":"0.01000000"},
93093
- // {"id":"AMD","name":"Armenian Dram","min_size":"0.01000000"},
93094
- // {"id":"ANG","name":"Netherlands Antillean Gulden","min_size":"0.01000000"},
93095
- // ...
93096
- // ],
93097
- // }
93627
+ // fiat
93628
+ //
93629
+ // {
93630
+ // id: 'IMP',
93631
+ // name: 'Isle of Man Pound',
93632
+ // min_size: '0.01'
93633
+ // },
93634
+ //
93635
+ // crypto
93636
+ //
93637
+ // {
93638
+ // asset_id: '9476e3be-b731-47fa-82be-347fabc573d9',
93639
+ // code: 'AERO',
93640
+ // name: 'Aerodrome Finance',
93641
+ // color: '#0433FF',
93642
+ // sort_index: '340',
93643
+ // exponent: '8',
93644
+ // type: 'crypto',
93645
+ // address_regex: '^(?:0x)?[0-9a-fA-F]{40}$'
93646
+ // }
93098
93647
  //
93099
- const exchangeRates = this.safeValue(response, 'exchangeRates', {});
93100
93648
  //
93101
93649
  // {
93102
93650
  // "data":{
@@ -93112,24 +93660,23 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
93112
93660
  // }
93113
93661
  // }
93114
93662
  //
93115
- const data = this.safeValue(currencies, 'data', []);
93116
- const dataById = this.indexBy(data, 'id');
93117
- const rates = this.safeValue(this.safeValue(exchangeRates, 'data', {}), 'rates', {});
93118
- const keys = Object.keys(rates);
93119
93663
  const result = {};
93120
- for (let i = 0; i < keys.length; i++) {
93121
- const key = keys[i];
93122
- const type = (key in dataById) ? 'fiat' : 'crypto';
93123
- const currency = this.safeValue(dataById, key, {});
93124
- const id = this.safeString(currency, 'id', key);
93125
- const name = this.safeString(currency, 'name');
93664
+ const networks = {};
93665
+ const networksById = {};
93666
+ for (let i = 0; i < currencies.length; i++) {
93667
+ const currency = currencies[i];
93668
+ const assetId = this.safeString(currency, 'asset_id');
93669
+ const id = this.safeString2(currency, 'id', 'code');
93126
93670
  const code = this.safeCurrencyCode(id);
93671
+ const name = this.safeString(currency, 'name');
93672
+ this.options['networks'][code] = name.toLowerCase();
93673
+ this.options['networksById'][code] = name.toLowerCase();
93127
93674
  result[code] = {
93675
+ 'info': currency,
93128
93676
  'id': id,
93129
93677
  'code': code,
93130
- 'info': currency,
93131
- 'type': type,
93132
- 'name': name,
93678
+ 'type': (assetId !== undefined) ? 'crypto' : 'fiat',
93679
+ 'name': this.safeString(currency, 'name'),
93133
93680
  'active': true,
93134
93681
  'deposit': undefined,
93135
93682
  'withdraw': undefined,
@@ -93146,7 +93693,14 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
93146
93693
  },
93147
93694
  },
93148
93695
  };
93696
+ if (assetId !== undefined) {
93697
+ const lowerCaseName = name.toLowerCase();
93698
+ networks[code] = lowerCaseName;
93699
+ networksById[lowerCaseName] = code;
93700
+ }
93149
93701
  }
93702
+ this.options['networks'] = this.extend(networks, this.options['networks']);
93703
+ this.options['networksById'] = this.extend(networksById, this.options['networksById']);
93150
93704
  return result;
93151
93705
  }
93152
93706
  async fetchTickers(symbols = undefined, params = {}) {
@@ -93624,12 +94178,12 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
93624
94178
  if (code !== undefined) {
93625
94179
  currency = this.currency(code);
93626
94180
  }
93627
- const request = await this.prepareAccountRequestWithCurrencyCode(code, limit, params);
93628
- const query = this.omit(params, ['account_id', 'accountId']);
94181
+ let request = undefined;
94182
+ [request, params] = await this.prepareAccountRequestWithCurrencyCode(code, limit, params);
93629
94183
  // for pagination use parameter 'starting_after'
93630
94184
  // the value for the next page can be obtained from the result of the previous call in the 'pagination' field
93631
94185
  // eg: instance.last_json_response.pagination.next_starting_after
93632
- const response = await this.v2PrivateGetAccountsAccountIdTransactions(this.extend(request, query));
94186
+ const response = await this.v2PrivateGetAccountsAccountIdTransactions(this.extend(request, params));
93633
94187
  return this.parseLedger(response['data'], currency, since, limit);
93634
94188
  }
93635
94189
  parseLedgerEntryStatus(status) {
@@ -93987,6 +94541,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
93987
94541
  }
93988
94542
  async prepareAccountRequestWithCurrencyCode(code = undefined, limit = undefined, params = {}) {
93989
94543
  let accountId = this.safeString2(params, 'account_id', 'accountId');
94544
+ params = this.omit(params, ['account_id', 'accountId']);
93990
94545
  if (accountId === undefined) {
93991
94546
  if (code === undefined) {
93992
94547
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' prepareAccountRequestWithCurrencyCode() method requires an account_id (or accountId) parameter OR a currency code argument');
@@ -94002,7 +94557,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
94002
94557
  if (limit !== undefined) {
94003
94558
  request['limit'] = limit;
94004
94559
  }
94005
- return request;
94560
+ return [request, params];
94006
94561
  }
94007
94562
  async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
94008
94563
  /**
@@ -95175,6 +95730,140 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
95175
95730
  const data = this.safeValue(response, 'data', {});
95176
95731
  return this.parseTransaction(data, currency);
95177
95732
  }
95733
+ async fetchDepositAddressesByNetwork(code, params = {}) {
95734
+ /**
95735
+ * @method
95736
+ * @name ascendex#fetchDepositAddress
95737
+ * @description fetch the deposit address for a currency associated with this account
95738
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postcoinbaseaccountaddresses
95739
+ * @param {string} code unified currency code
95740
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
95741
+ * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
95742
+ */
95743
+ await this.loadMarkets();
95744
+ const currency = this.currency(code);
95745
+ let request = undefined;
95746
+ [request, params] = await this.prepareAccountRequestWithCurrencyCode(currency['code']);
95747
+ const response = await this.v2PrivateGetAccountsAccountIdAddresses(this.extend(request, params));
95748
+ //
95749
+ // {
95750
+ // pagination: {
95751
+ // ending_before: null,
95752
+ // starting_after: null,
95753
+ // previous_ending_before: null,
95754
+ // next_starting_after: null,
95755
+ // limit: '25',
95756
+ // order: 'desc',
95757
+ // previous_uri: null,
95758
+ // next_uri: null
95759
+ // },
95760
+ // data: [
95761
+ // {
95762
+ // id: '64ceb5f1-5fa2-5310-a4ff-9fd46271003d',
95763
+ // address: '5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk',
95764
+ // address_info: { address: '5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk' },
95765
+ // name: null,
95766
+ // created_at: '2023-05-29T21:12:12Z',
95767
+ // updated_at: '2023-05-29T21:12:12Z',
95768
+ // network: 'solana',
95769
+ // uri_scheme: 'solana',
95770
+ // resource: 'address',
95771
+ // resource_path: '/v2/accounts/a7b3d387-bfb8-5ce7-b8da-1f507e81cf25/addresses/64ceb5f1-5fa2-5310-a4ff-9fd46271003d',
95772
+ // warnings: [
95773
+ // {
95774
+ // type: 'correct_address_warning',
95775
+ // title: 'This is an ERC20 USDC address.',
95776
+ // details: 'Only send ERC20 USD Coin (USDC) to this address.',
95777
+ // image_url: 'https://www.coinbase.com/assets/addresses/global-receive-warning-a3d91807e61c717e5a38d270965003dcc025ca8a3cea40ec3d7835b7c86087fa.png',
95778
+ // options: [ { text: 'I understand', style: 'primary', id: 'dismiss' } ]
95779
+ // }
95780
+ // ],
95781
+ // qr_code_image_url: 'https://static-assets.coinbase.com/p2p/l2/asset_network_combinations/v5/usdc-solana.png',
95782
+ // address_label: 'USDC address (Solana)',
95783
+ // default_receive: true,
95784
+ // deposit_uri: 'solana:5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk?spl-token=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
95785
+ // callback_url: null,
95786
+ // share_address_copy: {
95787
+ // line1: '5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk',
95788
+ // line2: 'This address can only receive USDC-SPL from Solana network. Don’t send USDC from other networks, other SPL tokens or NFTs, or it may result in a loss of funds.'
95789
+ // },
95790
+ // receive_subtitle: 'ERC-20',
95791
+ // inline_warning: {
95792
+ // text: 'This address can only receive USDC-SPL from Solana network. Don’t send USDC from other networks, other SPL tokens or NFTs, or it may result in a loss of funds.',
95793
+ // tooltip: {
95794
+ // title: 'USDC (Solana)',
95795
+ // subtitle: 'This address can only receive USDC-SPL from Solana network.'
95796
+ // }
95797
+ // }
95798
+ // },
95799
+ // ...
95800
+ // ]
95801
+ // }
95802
+ //
95803
+ const data = this.safeList(response, 'data', []);
95804
+ const addressStructures = this.parseDepositAddresses(data, undefined, false);
95805
+ return this.indexBy(addressStructures, 'network');
95806
+ }
95807
+ parseDepositAddress(depositAddress, currency = undefined) {
95808
+ //
95809
+ // {
95810
+ // id: '64ceb5f1-5fa2-5310-a4ff-9fd46271003d',
95811
+ // address: '5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk',
95812
+ // address_info: {
95813
+ // address: 'GCF74576I7AQ56SLMKBQAP255EGUOWCRVII3S44KEXVNJEOIFVBDMXVL',
95814
+ // destination_tag: '3722061866'
95815
+ // },
95816
+ // name: null,
95817
+ // created_at: '2023-05-29T21:12:12Z',
95818
+ // updated_at: '2023-05-29T21:12:12Z',
95819
+ // network: 'solana',
95820
+ // uri_scheme: 'solana',
95821
+ // resource: 'address',
95822
+ // resource_path: '/v2/accounts/a7b3d387-bfb8-5ce7-b8da-1f507e81cf25/addresses/64ceb5f1-5fa2-5310-a4ff-9fd46271003d',
95823
+ // warnings: [
95824
+ // {
95825
+ // type: 'correct_address_warning',
95826
+ // title: 'This is an ERC20 USDC address.',
95827
+ // details: 'Only send ERC20 USD Coin (USDC) to this address.',
95828
+ // image_url: 'https://www.coinbase.com/assets/addresses/global-receive-warning-a3d91807e61c717e5a38d270965003dcc025ca8a3cea40ec3d7835b7c86087fa.png',
95829
+ // options: [ { text: 'I understand', style: 'primary', id: 'dismiss' } ]
95830
+ // }
95831
+ // ],
95832
+ // qr_code_image_url: 'https://static-assets.coinbase.com/p2p/l2/asset_network_combinations/v5/usdc-solana.png',
95833
+ // address_label: 'USDC address (Solana)',
95834
+ // default_receive: true,
95835
+ // deposit_uri: 'solana:5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk?spl-token=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
95836
+ // callback_url: null,
95837
+ // share_address_copy: {
95838
+ // line1: '5xjPKeAXpnhA2kHyinvdVeui6RXVdEa3B2J3SCAwiKnk',
95839
+ // line2: 'This address can only receive USDC-SPL from Solana network. Don’t send USDC from other networks, other SPL tokens or NFTs, or it may result in a loss of funds.'
95840
+ // },
95841
+ // receive_subtitle: 'ERC-20',
95842
+ // inline_warning: {
95843
+ // text: 'This address can only receive USDC-SPL from Solana network. Don’t send USDC from other networks, other SPL tokens or NFTs, or it may result in a loss of funds.',
95844
+ // tooltip: {
95845
+ // title: 'USDC (Solana)',
95846
+ // subtitle: 'This address can only receive USDC-SPL from Solana network.'
95847
+ // }
95848
+ // }
95849
+ // }
95850
+ //
95851
+ const address = this.safeString(depositAddress, 'address');
95852
+ this.checkAddress(address);
95853
+ const networkId = this.safeString(depositAddress, 'network');
95854
+ const code = this.safeCurrencyCode(undefined, currency);
95855
+ const addressLabel = this.safeString(depositAddress, 'address_label');
95856
+ const splitAddressLabel = addressLabel.split(' ');
95857
+ const marketId = this.safeString(splitAddressLabel, 0);
95858
+ const addressInfo = this.safeDict(depositAddress, 'address_info');
95859
+ return {
95860
+ 'info': depositAddress,
95861
+ 'currency': this.safeCurrencyCode(marketId, currency),
95862
+ 'address': address,
95863
+ 'tag': this.safeString(addressInfo, 'destination_tag'),
95864
+ 'network': this.networkIdToCode(networkId, code),
95865
+ };
95866
+ }
95178
95867
  sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
95179
95868
  const version = api[0];
95180
95869
  const signed = api[1] === 'private';
@@ -122544,7 +123233,7 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
122544
123233
  const amount = this.safeString(order, 'amount');
122545
123234
  let cost = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(filledString, averageString);
122546
123235
  if (market['inverse']) {
122547
- if (this.parseNumber(averageString) !== 0) {
123236
+ if (averageString !== '0') {
122548
123237
  cost = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringDiv(amount, averageString);
122549
123238
  }
122550
123239
  }
@@ -243214,6 +243903,7 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
243214
243903
  /**
243215
243904
  * @method
243216
243905
  * @name gate#watchTicker
243906
+ * @see https://www.gate.io/docs/developers/apiv4/ws/en/#tickers-channel
243217
243907
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
243218
243908
  * @param {string} symbol unified symbol of the market to fetch the ticker for
243219
243909
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -243222,45 +243912,21 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
243222
243912
  await this.loadMarkets();
243223
243913
  const market = this.market(symbol);
243224
243914
  symbol = market['symbol'];
243225
- const marketId = market['id'];
243226
- const url = this.getUrlByMarket(market);
243227
- const messageType = this.getTypeByMarket(market);
243228
- const [topic, query] = this.handleOptionAndParams(params, 'watchTicker', 'name', 'tickers');
243229
- const channel = messageType + '.' + topic;
243230
- const messageHash = 'ticker:' + symbol;
243231
- const payload = [marketId];
243232
- return await this.subscribePublic(url, messageHash, payload, channel, query);
243915
+ params['callerMethodName'] = 'watchTicker';
243916
+ const result = await this.watchTickers([symbol], params);
243917
+ return this.safeValue(result, symbol);
243233
243918
  }
243234
243919
  async watchTickers(symbols = undefined, params = {}) {
243235
243920
  /**
243236
243921
  * @method
243237
243922
  * @name gate#watchTickers
243923
+ * @see https://www.gate.io/docs/developers/apiv4/ws/en/#tickers-channel
243238
243924
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
243239
243925
  * @param {string[]} symbols unified symbol of the market to fetch the ticker for
243240
243926
  * @param {object} [params] extra parameters specific to the exchange API endpoint
243241
243927
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
243242
243928
  */
243243
- await this.loadMarkets();
243244
- symbols = this.marketSymbols(symbols);
243245
- if (symbols === undefined) {
243246
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' watchTickers requires symbols');
243247
- }
243248
- const market = this.market(symbols[0]);
243249
- const messageType = this.getTypeByMarket(market);
243250
- const marketIds = this.marketIds(symbols);
243251
- const [topic, query] = this.handleOptionAndParams(params, 'watchTicker', 'method', 'tickers');
243252
- const channel = messageType + '.' + topic;
243253
- const messageHash = 'tickers';
243254
- const url = this.getUrlByMarket(market);
243255
- const ticker = await this.subscribePublic(url, messageHash, marketIds, channel, query);
243256
- let result = {};
243257
- if (this.newUpdates) {
243258
- result[ticker['symbol']] = ticker;
243259
- }
243260
- else {
243261
- result = this.tickers;
243262
- }
243263
- return this.filterByArray(result, 'symbol', symbols, true);
243929
+ return await this.subscribeWatchTickersAndBidsAsks(symbols, 'watchTickers', this.extend({ 'method': 'tickers' }, params));
243264
243930
  }
243265
243931
  handleTicker(client, message) {
243266
243932
  //
@@ -243280,6 +243946,24 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
243280
243946
  // "low_24h": "42721.03"
243281
243947
  // }
243282
243948
  // }
243949
+ //
243950
+ this.handleTickerAndBidAsk('ticker', client, message);
243951
+ }
243952
+ async watchBidsAsks(symbols = undefined, params = {}) {
243953
+ /**
243954
+ * @method
243955
+ * @name gate#watchBidsAsks
243956
+ * @see https://www.gate.io/docs/developers/apiv4/ws/en/#best-bid-or-ask-price
243957
+ * @see https://www.gate.io/docs/developers/apiv4/ws/en/#order-book-channel
243958
+ * @description watches best bid & ask for symbols
243959
+ * @param {string[]} symbols unified symbol of the market to fetch the ticker for
243960
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
243961
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
243962
+ */
243963
+ return await this.subscribeWatchTickersAndBidsAsks(symbols, 'watchBidsAsks', this.extend({ 'method': 'book_ticker' }, params));
243964
+ }
243965
+ handleBidAsk(client, message) {
243966
+ //
243283
243967
  // {
243284
243968
  // "time": 1671363004,
243285
243969
  // "time_ms": 1671363004235,
@@ -243296,24 +243980,63 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
243296
243980
  // }
243297
243981
  // }
243298
243982
  //
243983
+ this.handleTickerAndBidAsk('bidask', client, message);
243984
+ }
243985
+ async subscribeWatchTickersAndBidsAsks(symbols = undefined, callerMethodName = undefined, params = {}) {
243986
+ await this.loadMarkets();
243987
+ [callerMethodName, params] = this.handleParamString(params, 'callerMethodName', callerMethodName);
243988
+ symbols = this.marketSymbols(symbols, undefined, false);
243989
+ const market = this.market(symbols[0]);
243990
+ const messageType = this.getTypeByMarket(market);
243991
+ const marketIds = this.marketIds(symbols);
243992
+ let channelName = undefined;
243993
+ [channelName, params] = this.handleOptionAndParams(params, callerMethodName, 'method');
243994
+ const url = this.getUrlByMarket(market);
243995
+ const channel = messageType + '.' + channelName;
243996
+ const isWatchTickers = callerMethodName.indexOf('watchTicker') >= 0;
243997
+ const prefix = isWatchTickers ? 'ticker' : 'bidask';
243998
+ const messageHashes = [];
243999
+ for (let i = 0; i < symbols.length; i++) {
244000
+ const symbol = symbols[i];
244001
+ messageHashes.push(prefix + ':' + symbol);
244002
+ }
244003
+ const tickerOrBidAsk = await this.subscribePublicMultiple(url, messageHashes, marketIds, channel, params);
244004
+ if (this.newUpdates) {
244005
+ const items = {};
244006
+ items[tickerOrBidAsk['symbol']] = tickerOrBidAsk;
244007
+ return items;
244008
+ }
244009
+ const result = isWatchTickers ? this.tickers : this.bidsasks;
244010
+ return this.filterByArray(result, 'symbol', symbols, true);
244011
+ }
244012
+ handleTickerAndBidAsk(objectName, client, message) {
243299
244013
  const channel = this.safeString(message, 'channel');
243300
244014
  const parts = channel.split('.');
243301
244015
  const rawMarketType = this.safeString(parts, 0);
243302
244016
  const marketType = (rawMarketType === 'futures') ? 'contract' : 'spot';
243303
- let result = this.safeValue(message, 'result');
243304
- if (!Array.isArray(result)) {
243305
- result = [result];
244017
+ let results = [];
244018
+ if (marketType === 'contract') {
244019
+ results = this.safeList(message, 'result', []);
243306
244020
  }
243307
- for (let i = 0; i < result.length; i++) {
243308
- const ticker = result[i];
243309
- const marketId = this.safeString(ticker, 's');
244021
+ else {
244022
+ const rawTicker = this.safeDict(message, 'result', {});
244023
+ results = [rawTicker];
244024
+ }
244025
+ const isTicker = (objectName === 'ticker'); // whether ticker or bid-ask
244026
+ for (let i = 0; i < results.length; i++) {
244027
+ const rawTicker = results[i];
244028
+ const marketId = this.safeString(rawTicker, 's');
243310
244029
  const market = this.safeMarket(marketId, undefined, '_', marketType);
243311
- const parsed = this.parseTicker(ticker, market);
243312
- const symbol = parsed['symbol'];
243313
- this.tickers[symbol] = parsed;
243314
- const messageHash = 'ticker:' + symbol;
243315
- client.resolve(parsed, messageHash);
243316
- client.resolve(parsed, 'tickers');
244030
+ const parsedItem = this.parseTicker(rawTicker, market);
244031
+ const symbol = parsedItem['symbol'];
244032
+ if (isTicker) {
244033
+ this.tickers[symbol] = parsedItem;
244034
+ }
244035
+ else {
244036
+ this.bidsasks[symbol] = parsedItem;
244037
+ }
244038
+ const messageHash = objectName + ':' + symbol;
244039
+ client.resolve(parsedItem, messageHash);
243317
244040
  }
243318
244041
  }
243319
244042
  async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
@@ -244114,7 +244837,7 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
244114
244837
  'orders': this.handleOrder,
244115
244838
  'positions': this.handlePositions,
244116
244839
  'tickers': this.handleTicker,
244117
- 'book_ticker': this.handleTicker,
244840
+ 'book_ticker': this.handleBidAsk,
244118
244841
  'trades': this.handleTrades,
244119
244842
  'order_book_update': this.handleOrderBook,
244120
244843
  'balances': this.handleBalance,
@@ -245544,6 +246267,7 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
245544
246267
  const messageHash = channel + '::' + symbol;
245545
246268
  client.resolve(newTickers, messageHash);
245546
246269
  }
246270
+ client.resolve(newTickers, 'tickers');
245547
246271
  const messageHashes = this.findMessageHashes(client, 'tickers::');
245548
246272
  for (let i = 0; i < messageHashes.length; i++) {
245549
246273
  const messageHash = messageHashes[i];
@@ -272111,12 +272835,12 @@ class probit extends _abstract_probit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
272111
272835
  const currencyId = this.safeString(transaction, 'currency_id');
272112
272836
  const code = this.safeCurrencyCode(currencyId);
272113
272837
  const status = this.parseTransactionStatus(this.safeString(transaction, 'status'));
272114
- const feeCost = this.safeNumber(transaction, 'fee');
272838
+ const feeCostString = this.safeString(transaction, 'fee');
272115
272839
  let fee = undefined;
272116
- if (feeCost !== undefined && feeCost !== 0) {
272840
+ if (feeCostString !== undefined && feeCostString !== '0') {
272117
272841
  fee = {
272118
272842
  'currency': code,
272119
- 'cost': feeCost,
272843
+ 'cost': this.parseNumber(feeCostString),
272120
272844
  };
272121
272845
  }
272122
272846
  return {
@@ -305584,7 +306308,7 @@ SOFTWARE.
305584
306308
 
305585
306309
  //-----------------------------------------------------------------------------
305586
306310
  // this is updated by vss.js when building
305587
- const version = '4.2.44';
306311
+ const version = '4.2.45';
305588
306312
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
305589
306313
  //-----------------------------------------------------------------------------
305590
306314