ccxt 4.2.43 → 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.
Files changed (46) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +1489 -463
  3. package/dist/ccxt.browser.min.js +6 -6
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/base/Exchange.js +54 -0
  6. package/dist/cjs/src/binance.js +627 -51
  7. package/dist/cjs/src/bingx.js +46 -6
  8. package/dist/cjs/src/bitstamp.js +1 -1
  9. package/dist/cjs/src/blofin.js +2 -1
  10. package/dist/cjs/src/bybit.js +96 -43
  11. package/dist/cjs/src/coinbase.js +221 -41
  12. package/dist/cjs/src/deribit.js +1 -1
  13. package/dist/cjs/src/krakenfutures.js +3 -2
  14. package/dist/cjs/src/kucoin.js +9 -5
  15. package/dist/cjs/src/mexc.js +348 -266
  16. package/dist/cjs/src/pro/gate.js +76 -42
  17. package/dist/cjs/src/pro/hitbtc.js +1 -0
  18. package/dist/cjs/src/probit.js +3 -3
  19. package/js/ccxt.d.ts +1 -1
  20. package/js/ccxt.js +1 -1
  21. package/js/src/abstract/coinbase.d.ts +1 -0
  22. package/js/src/base/Exchange.d.ts +4 -0
  23. package/js/src/base/Exchange.js +54 -0
  24. package/js/src/binance.d.ts +1 -0
  25. package/js/src/binance.js +627 -51
  26. package/js/src/bingx.d.ts +2 -1
  27. package/js/src/bingx.js +46 -6
  28. package/js/src/bitstamp.js +1 -1
  29. package/js/src/blofin.js +2 -1
  30. package/js/src/bybit.d.ts +4 -1
  31. package/js/src/bybit.js +96 -43
  32. package/js/src/coinbase.d.ts +10 -4
  33. package/js/src/coinbase.js +221 -41
  34. package/js/src/coinbasepro.d.ts +1 -1
  35. package/js/src/deribit.js +1 -1
  36. package/js/src/krakenfutures.js +3 -2
  37. package/js/src/kucoin.js +9 -5
  38. package/js/src/mexc.d.ts +4 -5
  39. package/js/src/mexc.js +348 -266
  40. package/js/src/pro/gate.d.ts +4 -0
  41. package/js/src/pro/gate.js +76 -42
  42. package/js/src/pro/hitbtc.js +1 -0
  43. package/js/src/probit.js +3 -3
  44. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  45. package/package.json +1 -1
  46. package/skip-tests.json +2 -0
@@ -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 = {};
@@ -10173,6 +10174,9 @@ class Exchange {
10173
10174
  * @param {string} currencyCode unified currency code, but this argument is not required by default, unless there is an exchange (like huobi) that needs an override of the method to be able to pass currencyCode argument additionally
10174
10175
  * @returns {string|undefined} exchange-specific network id
10175
10176
  */
10177
+ if (networkCode === undefined) {
10178
+ return undefined;
10179
+ }
10176
10180
  const networkIdsByCodes = this.safeValue(this.options, 'networks', {});
10177
10181
  let networkId = this.safeString(networkIdsByCodes, networkCode);
10178
10182
  // for example, if 'ETH' is passed for networkCode, but 'ETH' key not defined in `options->networks` object
@@ -10216,6 +10220,9 @@ class Exchange {
10216
10220
  * @param {string|undefined} currencyCode unified currency code, but this argument is not required by default, unless there is an exchange (like huobi) that needs an override of the method to be able to pass currencyCode argument additionally
10217
10221
  * @returns {string|undefined} unified network code
10218
10222
  */
10223
+ if (networkId === undefined) {
10224
+ return undefined;
10225
+ }
10219
10226
  const networkCodesByIds = this.safeDict(this.options, 'networksById', {});
10220
10227
  let networkCode = this.safeString(networkCodesByIds, networkId, networkId);
10221
10228
  // replace mainnet network-codes (i.e. ERC20->ETH)
@@ -10457,12 +10464,46 @@ class Exchange {
10457
10464
  const market = this.market(symbol);
10458
10465
  return this.safeString(market, 'symbol', symbol);
10459
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
+ }
10460
10474
  resolvePath(path, params) {
10461
10475
  return [
10462
10476
  this.implodeParams(path, params),
10463
10477
  this.omit(params, this.extractParams(path)),
10464
10478
  ];
10465
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
+ }
10466
10507
  filterByArray(objects, key, values = undefined, indexed = true) {
10467
10508
  objects = this.toArray(objects);
10468
10509
  // return all of them if no values were passed
@@ -11388,6 +11429,19 @@ class Exchange {
11388
11429
  return depositAddress;
11389
11430
  }
11390
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
+ }
11391
11445
  else {
11392
11446
  throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchDepositAddress() is not supported yet');
11393
11447
  }
@@ -18096,7 +18150,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
18096
18150
  'fetchOHLCV': true,
18097
18151
  'fetchOpenInterest': true,
18098
18152
  'fetchOpenInterestHistory': true,
18099
- 'fetchOpenOrder': false,
18153
+ 'fetchOpenOrder': true,
18100
18154
  'fetchOpenOrders': true,
18101
18155
  'fetchOrder': true,
18102
18156
  'fetchOrderBook': true,
@@ -20649,9 +20703,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
20649
20703
  const networkList = this.safeList(entry, 'networkList', []);
20650
20704
  const fees = {};
20651
20705
  let fee = undefined;
20706
+ const networks = {};
20652
20707
  for (let j = 0; j < networkList.length; j++) {
20653
20708
  const networkItem = networkList[j];
20654
20709
  const network = this.safeString(networkItem, 'network');
20710
+ const networkCode = this.networkIdToCode(network);
20655
20711
  // const name = this.safeString (networkItem, 'name');
20656
20712
  const withdrawFee = this.safeNumber(networkItem, 'withdrawFee');
20657
20713
  const depositEnable = this.safeBool(networkItem, 'depositEnable');
@@ -20669,6 +20725,26 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
20669
20725
  if (!_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringEq(precisionTick, '0')) {
20670
20726
  minPrecision = (minPrecision === undefined) ? precisionTick : _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMin(minPrecision, precisionTick);
20671
20727
  }
20728
+ networks[networkCode] = {
20729
+ 'info': networkItem,
20730
+ 'id': network,
20731
+ 'network': networkCode,
20732
+ 'active': depositEnable && withdrawEnable,
20733
+ 'deposit': depositEnable,
20734
+ 'withdraw': withdrawEnable,
20735
+ 'fee': this.parseNumber(fee),
20736
+ 'precision': minPrecision,
20737
+ 'limits': {
20738
+ 'withdraw': {
20739
+ 'min': this.safeNumber(networkItem, 'withdrawMin'),
20740
+ 'max': this.safeNumber(networkItem, 'withdrawMax'),
20741
+ },
20742
+ 'deposit': {
20743
+ 'min': undefined,
20744
+ 'max': undefined,
20745
+ },
20746
+ },
20747
+ };
20672
20748
  }
20673
20749
  const trading = this.safeBool(entry, 'trading');
20674
20750
  const active = (isWithdrawEnabled && isDepositEnabled && trading);
@@ -20685,7 +20761,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
20685
20761
  'active': active,
20686
20762
  'deposit': isDepositEnabled,
20687
20763
  'withdraw': isWithdrawEnabled,
20688
- 'networks': networkList,
20764
+ 'networks': networks,
20689
20765
  'fee': fee,
20690
20766
  'fees': fees,
20691
20767
  'limits': this.limits,
@@ -23098,7 +23174,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23098
23174
  // "msg": "Quantity greater than max quantity."
23099
23175
  // }
23100
23176
  //
23101
- // createOrder, fetchOpenOrders, fetchOrder, cancelOrder: portfolio margin linear swap and future
23177
+ // createOrder, fetchOpenOrders, fetchOrder, cancelOrder, fetchOrders: portfolio margin linear swap and future
23102
23178
  //
23103
23179
  // {
23104
23180
  // "symbol": "BTCUSDT",
@@ -23121,7 +23197,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23121
23197
  // "status": "NEW"
23122
23198
  // }
23123
23199
  //
23124
- // createOrder, fetchOpenOrders, fetchOrder, cancelOrder: portfolio margin inverse swap and future
23200
+ // createOrder, fetchOpenOrders, fetchOrder, cancelOrder, fetchOrders: portfolio margin inverse swap and future
23125
23201
  //
23126
23202
  // {
23127
23203
  // "symbol": "ETHUSD_PERP",
@@ -23143,7 +23219,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23143
23219
  // "status": "NEW"
23144
23220
  // }
23145
23221
  //
23146
- // createOrder, fetchOpenOrders: portfolio margin linear swap and future conditional
23222
+ // createOrder, fetchOpenOrders, fetchOpenOrder: portfolio margin linear swap and future conditional
23147
23223
  //
23148
23224
  // {
23149
23225
  // "newClientStrategyId": "x-xcKtGhcu27f109953d6e4dc0974006",
@@ -23206,7 +23282,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23206
23282
  // "type": "LIMIT"
23207
23283
  // }
23208
23284
  //
23209
- // fetchOpenOrders, fetchOrder: portfolio margin spot margin
23285
+ // fetchOpenOrders, fetchOrder, fetchOrders: portfolio margin spot margin
23210
23286
  //
23211
23287
  // {
23212
23288
  // "symbol": "BTCUSDT",
@@ -23256,6 +23332,156 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23256
23332
  // "selfTradePreventionMode": "NONE"
23257
23333
  // }
23258
23334
  //
23335
+ // fetchOrders: portfolio margin linear and inverse swap conditional
23336
+ //
23337
+ // {
23338
+ // "newClientStrategyId": "x-xcKtGhcuaf166172ed504cd1bc0396",
23339
+ // "strategyId": 3733211,
23340
+ // "strategyStatus": "CANCELLED",
23341
+ // "strategyType": "STOP",
23342
+ // "origQty": "0.010",
23343
+ // "price": "35000",
23344
+ // "orderId": 0,
23345
+ // "reduceOnly": false,
23346
+ // "side": "BUY",
23347
+ // "positionSide": "BOTH",
23348
+ // "stopPrice": "50000",
23349
+ // "symbol": "BTCUSDT",
23350
+ // "type": "LIMIT",
23351
+ // "bookTime": 1707270098774,
23352
+ // "updateTime": 1707270119261,
23353
+ // "timeInForce": "GTC",
23354
+ // "triggerTime": 0,
23355
+ // "workingType": "CONTRACT_PRICE",
23356
+ // "priceProtect": false,
23357
+ // "goodTillDate": 0,
23358
+ // "selfTradePreventionMode": "NONE"
23359
+ // }
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
+ //
23259
23485
  const code = this.safeString(order, 'code');
23260
23486
  if (code !== undefined) {
23261
23487
  // cancelOrders/createOrders might have a partial success
@@ -23314,7 +23540,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23314
23540
  }
23315
23541
  return this.safeOrder({
23316
23542
  'info': order,
23317
- 'id': this.safeString2(order, 'orderId', 'strategyId'),
23543
+ 'id': this.safeString2(order, 'strategyId', 'orderId'),
23318
23544
  'clientOrderId': this.safeString2(order, 'clientOrderId', 'newClientStrategyId'),
23319
23545
  'timestamp': timestamp,
23320
23546
  'datetime': this.iso8601(timestamp),
@@ -23949,13 +24175,20 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23949
24175
  * @see https://binance-docs.github.io/apidocs/delivery/en/#all-orders-user_data
23950
24176
  * @see https://binance-docs.github.io/apidocs/voptions/en/#query-option-order-history-trade
23951
24177
  * @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-orders-user_data
24178
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-orders-user_data
24179
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-orders-user_data
24180
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-conditional-orders-user_data
24181
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-conditional-orders-user_data
24182
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-margin-account-orders-user_data
23952
24183
  * @param {string} symbol unified market symbol of the market orders were made in
23953
24184
  * @param {int} [since] the earliest time in ms to fetch orders for
23954
24185
  * @param {int} [limit] the maximum number of order structures to retrieve
23955
24186
  * @param {object} [params] extra parameters specific to the exchange API endpoint
23956
24187
  * @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
23957
24188
  * @param {int} [params.until] the latest time in ms to fetch orders for
23958
- * @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)
24189
+ * @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)
24190
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch orders in a portfolio margin account
24191
+ * @param {boolean} [params.stop] set to true if you would like to fetch portfolio margin account stop or conditional orders
23959
24192
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
23960
24193
  */
23961
24194
  if (symbol === undefined) {
@@ -23968,17 +24201,18 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23968
24201
  return await this.fetchPaginatedCallDynamic('fetchOrders', symbol, since, limit, params);
23969
24202
  }
23970
24203
  const market = this.market(symbol);
23971
- const defaultType = this.safeString2(this.options, 'fetchOrders', 'defaultType', 'spot');
24204
+ const defaultType = this.safeString2(this.options, 'fetchOrders', 'defaultType', market['type']);
23972
24205
  const type = this.safeString(params, 'type', defaultType);
23973
- const [marginMode, query] = this.handleMarginModeAndParams('fetchOrders', params);
23974
- const request = {
24206
+ let marginMode = undefined;
24207
+ [marginMode, params] = this.handleMarginModeAndParams('fetchOrders', params);
24208
+ let isPortfolioMargin = undefined;
24209
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchOrders', 'papi', 'portfolioMargin', false);
24210
+ const isConditional = this.safeBool2(params, 'stop', 'conditional');
24211
+ params = this.omit(params, ['stop', 'conditional', 'type']);
24212
+ let request = {
23975
24213
  'symbol': market['id'],
23976
24214
  };
23977
- const until = this.safeInteger(params, 'until');
23978
- if (until !== undefined) {
23979
- params = this.omit(params, 'until');
23980
- request['endTime'] = until;
23981
- }
24215
+ [request, params] = this.handleUntilOption('endTime', request, params);
23982
24216
  if (since !== undefined) {
23983
24217
  request['startTime'] = since;
23984
24218
  }
@@ -23987,22 +24221,47 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23987
24221
  }
23988
24222
  let response = undefined;
23989
24223
  if (market['option']) {
23990
- response = await this.eapiPrivateGetHistoryOrders(this.extend(request, query));
24224
+ response = await this.eapiPrivateGetHistoryOrders(this.extend(request, params));
23991
24225
  }
23992
24226
  else if (market['linear']) {
23993
- response = await this.fapiPrivateGetAllOrders(this.extend(request, query));
24227
+ if (isPortfolioMargin) {
24228
+ if (isConditional) {
24229
+ response = await this.papiGetUmConditionalAllOrders(this.extend(request, params));
24230
+ }
24231
+ else {
24232
+ response = await this.papiGetUmAllOrders(this.extend(request, params));
24233
+ }
24234
+ }
24235
+ else {
24236
+ response = await this.fapiPrivateGetAllOrders(this.extend(request, params));
24237
+ }
23994
24238
  }
23995
24239
  else if (market['inverse']) {
23996
- response = await this.dapiPrivateGetAllOrders(this.extend(request, query));
23997
- }
23998
- else if (type === 'margin' || marginMode !== undefined) {
23999
- if (marginMode === 'isolated') {
24000
- request['isIsolated'] = true;
24240
+ if (isPortfolioMargin) {
24241
+ if (isConditional) {
24242
+ response = await this.papiGetCmConditionalAllOrders(this.extend(request, params));
24243
+ }
24244
+ else {
24245
+ response = await this.papiGetCmAllOrders(this.extend(request, params));
24246
+ }
24247
+ }
24248
+ else {
24249
+ response = await this.dapiPrivateGetAllOrders(this.extend(request, params));
24001
24250
  }
24002
- response = await this.sapiGetMarginAllOrders(this.extend(request, query));
24003
24251
  }
24004
24252
  else {
24005
- response = await this.privateGetAllOrders(this.extend(request, query));
24253
+ if (isPortfolioMargin) {
24254
+ response = await this.papiGetMarginAllOrders(this.extend(request, params));
24255
+ }
24256
+ else if (type === 'margin' || marginMode !== undefined) {
24257
+ if (marginMode === 'isolated') {
24258
+ request['isIsolated'] = true;
24259
+ }
24260
+ response = await this.sapiGetMarginAllOrders(this.extend(request, params));
24261
+ }
24262
+ else {
24263
+ response = await this.privateGetAllOrders(this.extend(request, params));
24264
+ }
24006
24265
  }
24007
24266
  //
24008
24267
  // spot
@@ -24078,6 +24337,112 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24078
24337
  // }
24079
24338
  // ]
24080
24339
  //
24340
+ // inverse portfolio margin
24341
+ //
24342
+ // [
24343
+ // {
24344
+ // "orderId": 71328442983,
24345
+ // "symbol": "ETHUSD_PERP",
24346
+ // "pair": "ETHUSD",
24347
+ // "status": "CANCELED",
24348
+ // "clientOrderId": "x-xcKtGhcu4b3e3d8515dd4dc5ba9ccc",
24349
+ // "price": "2000",
24350
+ // "avgPrice": "0.00",
24351
+ // "origQty": "1",
24352
+ // "executedQty": "0",
24353
+ // "cumBase": "0",
24354
+ // "timeInForce": "GTC",
24355
+ // "type": "LIMIT",
24356
+ // "reduceOnly": false,
24357
+ // "side": "BUY",
24358
+ // "origType": "LIMIT",
24359
+ // "time": 1707197843046,
24360
+ // "updateTime": 1707197941373,
24361
+ // "positionSide": "BOTH"
24362
+ // },
24363
+ // ]
24364
+ //
24365
+ // linear portfolio margin
24366
+ //
24367
+ // [
24368
+ // {
24369
+ // "orderId": 259235347005,
24370
+ // "symbol": "BTCUSDT",
24371
+ // "status": "CANCELED",
24372
+ // "clientOrderId": "x-xcKtGhcu402881c9103f42bdb4183b",
24373
+ // "price": "35000",
24374
+ // "avgPrice": "0.00000",
24375
+ // "origQty": "0.010",
24376
+ // "executedQty": "0",
24377
+ // "cumQuote": "0",
24378
+ // "timeInForce": "GTC",
24379
+ // "type": "LIMIT",
24380
+ // "reduceOnly": false,
24381
+ // "side": "BUY",
24382
+ // "origType": "LIMIT",
24383
+ // "time": 1707194702167,
24384
+ // "updateTime": 1707197804748,
24385
+ // "positionSide": "BOTH",
24386
+ // "selfTradePreventionMode": "NONE",
24387
+ // "goodTillDate": 0
24388
+ // },
24389
+ // ]
24390
+ //
24391
+ // conditional portfolio margin
24392
+ //
24393
+ // [
24394
+ // {
24395
+ // "newClientStrategyId": "x-xcKtGhcuaf166172ed504cd1bc0396",
24396
+ // "strategyId": 3733211,
24397
+ // "strategyStatus": "CANCELLED",
24398
+ // "strategyType": "STOP",
24399
+ // "origQty": "0.010",
24400
+ // "price": "35000",
24401
+ // "orderId": 0,
24402
+ // "reduceOnly": false,
24403
+ // "side": "BUY",
24404
+ // "positionSide": "BOTH",
24405
+ // "stopPrice": "50000",
24406
+ // "symbol": "BTCUSDT",
24407
+ // "type": "LIMIT",
24408
+ // "bookTime": 1707270098774,
24409
+ // "updateTime": 1707270119261,
24410
+ // "timeInForce": "GTC",
24411
+ // "triggerTime": 0,
24412
+ // "workingType": "CONTRACT_PRICE",
24413
+ // "priceProtect": false,
24414
+ // "goodTillDate": 0,
24415
+ // "selfTradePreventionMode": "NONE"
24416
+ // },
24417
+ // ]
24418
+ //
24419
+ // spot margin portfolio margin
24420
+ //
24421
+ // [
24422
+ // {
24423
+ // "symbol": "BTCUSDT",
24424
+ // "orderId": 24684460474,
24425
+ // "clientOrderId": "x-R4BD3S82e9ef29d8346440f0b28b86",
24426
+ // "price": "35000.00000000",
24427
+ // "origQty": "0.00100000",
24428
+ // "executedQty": "0.00000000",
24429
+ // "cummulativeQuoteQty": "0.00000000",
24430
+ // "status": "CANCELED",
24431
+ // "timeInForce": "GTC",
24432
+ // "type": "LIMIT",
24433
+ // "side": "BUY",
24434
+ // "stopPrice": "0.00000000",
24435
+ // "icebergQty": "0.00000000",
24436
+ // "time": 1707113538870,
24437
+ // "updateTime": 1707113797688,
24438
+ // "isWorking": true,
24439
+ // "accountId": 200180970,
24440
+ // "selfTradePreventionMode": "EXPIRE_MAKER",
24441
+ // "preventedMatchId": null,
24442
+ // "preventedQuantity": null
24443
+ // },
24444
+ // ]
24445
+ //
24081
24446
  return this.parseOrders(response, market, since, limit);
24082
24447
  }
24083
24448
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -24116,7 +24481,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24116
24481
  [marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
24117
24482
  let isPortfolioMargin = undefined;
24118
24483
  [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchOpenOrders', 'papi', 'portfolioMargin', false);
24119
- const isConditional = this.safeBool2(params, 'stop', 'conditional');
24484
+ const isConditional = this.safeBoolN(params, ['stop', 'conditional', 'trigger']);
24120
24485
  if (symbol !== undefined) {
24121
24486
  market = this.market(symbol);
24122
24487
  request['symbol'] = market['id'];
@@ -24136,7 +24501,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24136
24501
  }
24137
24502
  let subType = undefined;
24138
24503
  [subType, params] = this.handleSubTypeAndParams('fetchOpenOrders', market, params);
24139
- params = this.omit(params, ['type', 'stop', 'conditional']);
24504
+ params = this.omit(params, ['type', 'stop', 'conditional', 'trigger']);
24140
24505
  let response = undefined;
24141
24506
  if (type === 'option') {
24142
24507
  if (since !== undefined) {
@@ -24192,6 +24557,223 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24192
24557
  }
24193
24558
  return this.parseOrders(response, market, since, limit);
24194
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
+ }
24195
24777
  async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
24196
24778
  /**
24197
24779
  * @method
@@ -24202,13 +24784,23 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24202
24784
  * @see https://binance-docs.github.io/apidocs/delivery/en/#all-orders-user_data
24203
24785
  * @see https://binance-docs.github.io/apidocs/voptions/en/#query-option-order-history-trade
24204
24786
  * @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-orders-user_data
24787
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-orders-user_data
24788
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-orders-user_data
24789
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-conditional-orders-user_data
24790
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-conditional-orders-user_data
24791
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-margin-account-orders-user_data
24205
24792
  * @param {string} symbol unified market symbol of the market orders were made in
24206
24793
  * @param {int} [since] the earliest time in ms to fetch orders for
24207
24794
  * @param {int} [limit] the maximum number of order structures to retrieve
24208
24795
  * @param {object} [params] extra parameters specific to the exchange API endpoint
24209
- * @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)
24796
+ * @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)
24797
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch orders in a portfolio margin account
24798
+ * @param {boolean} [params.stop] set to true if you would like to fetch portfolio margin account stop or conditional orders
24210
24799
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
24211
24800
  */
24801
+ if (symbol === undefined) {
24802
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchClosedOrders() requires a symbol argument');
24803
+ }
24212
24804
  const orders = await this.fetchOrders(symbol, since, undefined, params);
24213
24805
  const filteredOrders = this.filterBy(orders, 'status', 'closed');
24214
24806
  return this.filterBySinceLimit(filteredOrders, since, limit);
@@ -24221,22 +24813,23 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24221
24813
  * @see https://binance-docs.github.io/apidocs/spot/en/#all-orders-user_data
24222
24814
  * @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-orders-user_data
24223
24815
  * @see https://binance-docs.github.io/apidocs/voptions/en/#query-option-order-history-trade
24816
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-orders-user_data
24817
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-orders-user_data
24818
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-conditional-orders-user_data
24819
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-conditional-orders-user_data
24820
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-all-margin-account-orders-user_data
24224
24821
  * @param {string} symbol unified market symbol of the market the orders were made in
24225
24822
  * @param {int} [since] the earliest time in ms to fetch orders for
24226
24823
  * @param {int} [limit] the maximum number of order structures to retrieve
24227
24824
  * @param {object} [params] extra parameters specific to the exchange API endpoint
24228
- * @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)
24825
+ * @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)
24826
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch orders in a portfolio margin account
24827
+ * @param {boolean} [params.stop] set to true if you would like to fetch portfolio margin account stop or conditional orders
24229
24828
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
24230
24829
  */
24231
24830
  if (symbol === undefined) {
24232
24831
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchCanceledOrders() requires a symbol argument');
24233
24832
  }
24234
- await this.loadMarkets();
24235
- const market = this.market(symbol);
24236
- if (market['swap'] || market['future']) {
24237
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchCanceledOrders() supports spot, margin and option markets only');
24238
- }
24239
- params = this.omit(params, 'type');
24240
24833
  const orders = await this.fetchOrders(symbol, since, undefined, params);
24241
24834
  const filteredOrders = this.filterBy(orders, 'status', 'canceled');
24242
24835
  return this.filterBySinceLimit(filteredOrders, since, limit);
@@ -25985,35 +26578,48 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
25985
26578
  * @see https://binance-docs.github.io/apidocs/spot/en/#trade-fee-user_data
25986
26579
  * @see https://binance-docs.github.io/apidocs/futures/en/#user-commission-rate-user_data
25987
26580
  * @see https://binance-docs.github.io/apidocs/delivery/en/#user-commission-rate-user_data
26581
+ * @see https://binance-docs.github.io/apidocs/pm/en/#get-user-commission-rate-for-um-user_data
26582
+ * @see https://binance-docs.github.io/apidocs/pm/en/#get-user-commission-rate-for-cm-user_data
25988
26583
  * @param {string} symbol unified market symbol
25989
26584
  * @param {object} [params] extra parameters specific to the exchange API endpoint
26585
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch trading fees in a portfolio margin account
25990
26586
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
25991
26587
  */
25992
26588
  await this.loadMarkets();
25993
26589
  const market = this.market(symbol);
25994
- const defaultType = this.safeString2(this.options, 'fetchTradingFee', 'defaultType', 'linear');
25995
- const type = this.safeString(params, 'type', defaultType);
25996
- params = this.omit(params, 'type');
26590
+ const type = market['type'];
25997
26591
  let subType = undefined;
25998
26592
  [subType, params] = this.handleSubTypeAndParams('fetchTradingFee', market, params);
25999
- const isSpotOrMargin = (type === 'spot') || (type === 'margin');
26593
+ let isPortfolioMargin = undefined;
26594
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchTradingFee', 'papi', 'portfolioMargin', false);
26000
26595
  const isLinear = this.isLinear(type, subType);
26001
26596
  const isInverse = this.isInverse(type, subType);
26002
26597
  const request = {
26003
26598
  'symbol': market['id'],
26004
26599
  };
26005
26600
  let response = undefined;
26006
- if (isSpotOrMargin) {
26007
- response = await this.sapiGetAssetTradeFee(this.extend(request, params));
26008
- }
26009
- else if (isLinear) {
26010
- response = await this.fapiPrivateGetCommissionRate(this.extend(request, params));
26601
+ if (isLinear) {
26602
+ if (isPortfolioMargin) {
26603
+ response = await this.papiGetUmCommissionRate(this.extend(request, params));
26604
+ }
26605
+ else {
26606
+ response = await this.fapiPrivateGetCommissionRate(this.extend(request, params));
26607
+ }
26011
26608
  }
26012
26609
  else if (isInverse) {
26013
- response = await this.dapiPrivateGetCommissionRate(this.extend(request, params));
26610
+ if (isPortfolioMargin) {
26611
+ response = await this.papiGetCmCommissionRate(this.extend(request, params));
26612
+ }
26613
+ else {
26614
+ response = await this.dapiPrivateGetCommissionRate(this.extend(request, params));
26615
+ }
26616
+ }
26617
+ else {
26618
+ response = await this.sapiGetAssetTradeFee(this.extend(request, params));
26014
26619
  }
26015
26620
  //
26016
26621
  // spot
26622
+ //
26017
26623
  // [
26018
26624
  // {
26019
26625
  // "symbol": "BTCUSDT",
@@ -26023,6 +26629,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26023
26629
  // ]
26024
26630
  //
26025
26631
  // swap
26632
+ //
26026
26633
  // {
26027
26634
  // "symbol": "BTCUSD_PERP",
26028
26635
  // "makerCommissionRate": "0.00015", // 0.015%
@@ -26033,7 +26640,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
26033
26640
  if (Array.isArray(data)) {
26034
26641
  data = this.safeDict(data, 0, {});
26035
26642
  }
26036
- return this.parseTradingFee(data);
26643
+ return this.parseTradingFee(data, market);
26037
26644
  }
26038
26645
  async fetchTradingFees(params = {}) {
26039
26646
  /**
@@ -29080,12 +29687,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
29080
29687
  * @see https://binance-docs.github.io/apidocs/spot/en/#get-force-liquidation-record-user_data
29081
29688
  * @see https://binance-docs.github.io/apidocs/futures/en/#user-39-s-force-orders-user_data
29082
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
29083
29693
  * @param {string} [symbol] unified CCXT market symbol
29084
29694
  * @param {int} [since] the earliest time in ms to fetch liquidations for
29085
29695
  * @param {int} [limit] the maximum number of liquidation structures to retrieve
29086
29696
  * @param {object} [params] exchange specific parameters for the binance api endpoint
29087
29697
  * @param {int} [params.until] timestamp in ms of the latest liquidation
29088
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
29089
29700
  * @returns {object} an array of [liquidation structures]{@link https://docs.ccxt.com/#/?id=liquidation-structure}
29090
29701
  */
29091
29702
  await this.loadMarkets();
@@ -29102,13 +29713,17 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
29102
29713
  [type, params] = this.handleMarketTypeAndParams('fetchMyLiquidations', market, params);
29103
29714
  let subType = undefined;
29104
29715
  [subType, params] = this.handleSubTypeAndParams('fetchMyLiquidations', market, params, 'linear');
29716
+ let isPortfolioMargin = undefined;
29717
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchMyLiquidations', 'papi', 'portfolioMargin', false);
29105
29718
  let request = {};
29106
29719
  if (type !== 'spot') {
29107
29720
  request['autoCloseType'] = 'LIQUIDATION';
29108
29721
  }
29109
29722
  if (market !== undefined) {
29110
29723
  const symbolKey = market['spot'] ? 'isolatedSymbol' : 'symbol';
29111
- request[symbolKey] = market['id'];
29724
+ if (!isPortfolioMargin) {
29725
+ request[symbolKey] = market['id'];
29726
+ }
29112
29727
  }
29113
29728
  if (since !== undefined) {
29114
29729
  request['startTime'] = since;
@@ -29124,13 +29739,28 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
29124
29739
  [request, params] = this.handleUntilOption('endTime', request, params);
29125
29740
  let response = undefined;
29126
29741
  if (type === 'spot') {
29127
- 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
+ }
29128
29748
  }
29129
29749
  else if (subType === 'linear') {
29130
- 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
+ }
29131
29756
  }
29132
29757
  else if (subType === 'inverse') {
29133
- 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
+ }
29134
29764
  }
29135
29765
  else {
29136
29766
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchMyLiquidations() does not support ' + market['type'] + ' markets');
@@ -29212,7 +29842,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
29212
29842
  // },
29213
29843
  // ]
29214
29844
  //
29215
- const liquidations = this.safeValue(response, 'rows', response);
29845
+ const liquidations = this.safeList(response, 'rows', response);
29216
29846
  return this.parseLiquidations(liquidations, market, since, limit);
29217
29847
  }
29218
29848
  parseLiquidation(liquidation, market = undefined) {
@@ -29771,6 +30401,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
29771
30401
  'fetchClosedOrders': true,
29772
30402
  'fetchCurrencies': true,
29773
30403
  'fetchDepositAddress': true,
30404
+ 'fetchDepositAddressesByNetwork': true,
29774
30405
  'fetchDeposits': true,
29775
30406
  'fetchDepositWithdrawFee': 'emulated',
29776
30407
  'fetchDepositWithdrawFees': true,
@@ -30106,7 +30737,9 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
30106
30737
  },
30107
30738
  'broad': {},
30108
30739
  },
30109
- 'commonCurrencies': {},
30740
+ 'commonCurrencies': {
30741
+ 'SNOW': 'Snowman', // Snowman vs SnowSwap conflict
30742
+ },
30110
30743
  'options': {
30111
30744
  'defaultType': 'spot',
30112
30745
  'accountsByType': {
@@ -30121,6 +30754,13 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
30121
30754
  },
30122
30755
  'recvWindow': 5 * 1000,
30123
30756
  'broker': 'CCXT',
30757
+ 'defaultNetworks': {
30758
+ 'ETH': 'ETH',
30759
+ 'USDT': 'ERC20',
30760
+ 'USDC': 'ERC20',
30761
+ 'BTC': 'BTC',
30762
+ 'LTC': 'LTC',
30763
+ },
30124
30764
  },
30125
30765
  });
30126
30766
  }
@@ -32804,15 +33444,15 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
32804
33444
  'status': status,
32805
33445
  };
32806
33446
  }
32807
- async fetchDepositAddress(code, params = {}) {
33447
+ async fetchDepositAddressesByNetwork(code, params = {}) {
32808
33448
  /**
32809
33449
  * @method
32810
- * @name bingx#fetchDepositAddress
32811
- * @description fetch the deposit address for a currency associated with this account
32812
- * @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
32813
33453
  * @param {string} code unified currency code
32814
33454
  * @param {object} [params] extra parameters specific to the exchange API endpoint
32815
- * @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
32816
33456
  */
32817
33457
  await this.loadMarkets();
32818
33458
  const currency = this.currency(code);
@@ -32847,6 +33487,36 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
32847
33487
  const parsed = this.parseDepositAddresses(data, [currency['code']], false);
32848
33488
  return this.indexBy(parsed, 'network');
32849
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
+ }
32850
33520
  parseDepositAddress(depositAddress, currency = undefined) {
32851
33521
  //
32852
33522
  // {
@@ -68910,7 +69580,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
68910
69580
  for (let i = 0; i < ids.length; i++) {
68911
69581
  const id = ids[i];
68912
69582
  if (id.indexOf('_') < 0) {
68913
- const value = this.safeNumber(transaction, id);
69583
+ const value = this.safeInteger(transaction, id);
68914
69584
  if ((value !== undefined) && (value !== 0)) {
68915
69585
  return id;
68916
69586
  }
@@ -77324,7 +77994,8 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
77324
77994
  const request = {};
77325
77995
  let response = undefined;
77326
77996
  if (accountType !== undefined) {
77327
- const parsedAccountType = this.safeString(this.options, 'accountsByType', accountType);
77997
+ const options = this.safeDict(this.options, 'accountsByType', {});
77998
+ const parsedAccountType = this.safeString(options, accountType, accountType);
77328
77999
  request['accountType'] = parsedAccountType;
77329
78000
  response = await this.privateGetAssetBalances(this.extend(request, params));
77330
78001
  }
@@ -82276,7 +82947,9 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
82276
82947
  'fetchBorrowInterest': false,
82277
82948
  'fetchBorrowRateHistories': false,
82278
82949
  'fetchBorrowRateHistory': false,
82950
+ 'fetchCanceledAndClosedOrders': true,
82279
82951
  'fetchCanceledOrders': true,
82952
+ 'fetchClosedOrder': true,
82280
82953
  'fetchClosedOrders': true,
82281
82954
  'fetchCrossBorrowRate': true,
82282
82955
  'fetchCrossBorrowRates': false,
@@ -82304,10 +82977,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
82304
82977
  'fetchOHLCV': true,
82305
82978
  'fetchOpenInterest': true,
82306
82979
  'fetchOpenInterestHistory': true,
82980
+ 'fetchOpenOrder': true,
82307
82981
  'fetchOpenOrders': true,
82308
- 'fetchOrder': true,
82982
+ 'fetchOrder': false,
82309
82983
  'fetchOrderBook': true,
82310
- 'fetchOrders': true,
82984
+ 'fetchOrders': false,
82311
82985
  'fetchOrderTrades': true,
82312
82986
  'fetchPosition': true,
82313
82987
  'fetchPositions': true,
@@ -85661,35 +86335,6 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
85661
86335
  'trades': undefined,
85662
86336
  }, market);
85663
86337
  }
85664
- async fetchOrder(id, symbol = undefined, params = {}) {
85665
- /**
85666
- * @method
85667
- * @name bybit#fetchOrder
85668
- * @description fetches information on an order made by the user
85669
- * @see https://bybit-exchange.github.io/docs/v5/order/order-list
85670
- * @param {string} symbol unified symbol of the market the order was made in
85671
- * @param {object} [params] extra parameters specific to the exchange API endpoint
85672
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
85673
- */
85674
- if (symbol === undefined) {
85675
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
85676
- }
85677
- await this.loadMarkets();
85678
- const request = {
85679
- 'orderId': id,
85680
- };
85681
- const result = await this.fetchOrders(symbol, undefined, undefined, this.extend(request, params));
85682
- const length = result.length;
85683
- if (length === 0) {
85684
- const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
85685
- const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
85686
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
85687
- }
85688
- if (length > 1) {
85689
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' returned more than one order');
85690
- }
85691
- return this.safeValue(result, 0);
85692
- }
85693
86338
  async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
85694
86339
  /**
85695
86340
  * @method
@@ -86725,29 +87370,99 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
86725
87370
  const data = this.safeValue(result, 'dataList', []);
86726
87371
  return this.parseOrders(data, market, since, limit);
86727
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
+ }
86728
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 = {}) {
86729
87380
  /**
86730
87381
  * @method
86731
- * @name bybit#fetchOrders
86732
- * @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
86733
87384
  * @see https://bybit-exchange.github.io/docs/v5/order/order-list
86734
- * @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
86735
87450
  * @param {int} [since] the earliest time in ms to fetch orders for
86736
87451
  * @param {int} [limit] the maximum number of order structures to retrieve
86737
87452
  * @param {object} [params] extra parameters specific to the exchange API endpoint
86738
- * @param {boolean} [params.stop] true if stop order
87453
+ * @param {boolean} [params.stop] set to true for fetching stop orders
86739
87454
  * @param {string} [params.type] market type, ['swap', 'option', 'spot']
86740
87455
  * @param {string} [params.subType] market subType, ['linear', 'inverse']
86741
87456
  * @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
86742
87457
  * @param {int} [params.until] the latest time in ms to fetch entries for
86743
- * @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)
86744
87459
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
86745
87460
  */
86746
87461
  await this.loadMarkets();
86747
87462
  let paginate = false;
86748
- [paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
87463
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchCanceledAndClosedOrders', 'paginate');
86749
87464
  if (paginate) {
86750
- 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);
86751
87466
  }
86752
87467
  const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
86753
87468
  const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
@@ -86760,7 +87475,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
86760
87475
  request['symbol'] = market['id'];
86761
87476
  }
86762
87477
  let type = undefined;
86763
- [type, params] = this.getBybitType('fetchOrders', market, params);
87478
+ [type, params] = this.getBybitType('fetchCanceledAndClosedOrders', market, params);
86764
87479
  if (((type === 'option') || isUsdcSettled) && !isUnifiedAccount) {
86765
87480
  return await this.fetchUsdcOrders(symbol, since, limit, params);
86766
87481
  }
@@ -86842,17 +87557,23 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
86842
87557
  * @name bybit#fetchClosedOrders
86843
87558
  * @description fetches information on multiple closed orders made by the user
86844
87559
  * @see https://bybit-exchange.github.io/docs/v5/order/order-list
86845
- * @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
86846
87561
  * @param {int} [since] the earliest time in ms to fetch orders for
86847
87562
  * @param {int} [limit] the maximum number of order structures to retrieve
86848
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)
86849
87570
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
86850
87571
  */
86851
87572
  await this.loadMarkets();
86852
87573
  const request = {
86853
87574
  'orderStatus': 'Filled',
86854
87575
  };
86855
- return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
87576
+ return await this.fetchCanceledAndClosedOrders(symbol, since, limit, this.extend(request, params));
86856
87577
  }
86857
87578
  async fetchCanceledOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
86858
87579
  /**
@@ -86860,20 +87581,23 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
86860
87581
  * @name bybit#fetchCanceledOrders
86861
87582
  * @description fetches information on multiple canceled orders made by the user
86862
87583
  * @see https://bybit-exchange.github.io/docs/v5/order/order-list
86863
- * @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
86864
87585
  * @param {int} [since] timestamp in ms of the earliest order, default is undefined
86865
87586
  * @param {int} [limit] max number of orders to return, default is undefined
86866
87587
  * @param {object} [params] extra parameters specific to the exchange API endpoint
86867
87588
  * @param {boolean} [params.stop] true if stop order
86868
87589
  * @param {string} [params.type] market type, ['swap', 'option', 'spot']
86869
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)
86870
87594
  * @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
86871
87595
  */
86872
87596
  await this.loadMarkets();
86873
87597
  const request = {
86874
87598
  'orderStatus': 'Cancelled',
86875
87599
  };
86876
- return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
87600
+ return await this.fetchCanceledAndClosedOrders(symbol, since, limit, this.extend(request, params));
86877
87601
  }
86878
87602
  async fetchUsdcOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
86879
87603
  await this.loadMarkets();
@@ -91670,6 +92394,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
91670
92394
  'fetchCrossBorrowRate': false,
91671
92395
  'fetchCrossBorrowRates': false,
91672
92396
  'fetchCurrencies': true,
92397
+ 'fetchDepositAddressesByNetwork': true,
91673
92398
  'fetchDeposits': true,
91674
92399
  'fetchFundingHistory': false,
91675
92400
  'fetchFundingRate': false,
@@ -91737,6 +92462,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
91737
92462
  'public': {
91738
92463
  'get': [
91739
92464
  'currencies',
92465
+ 'currencies/crypto',
91740
92466
  'time',
91741
92467
  'exchange-rates',
91742
92468
  'users/{user_id}',
@@ -91931,6 +92657,10 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
91931
92657
  'ACCOUNT_TYPE_CRYPTO',
91932
92658
  'ACCOUNT_TYPE_FIAT',
91933
92659
  ],
92660
+ 'networks': {
92661
+ 'ERC20': 'ethereum',
92662
+ 'XLM': 'stellar',
92663
+ },
91934
92664
  'createMarketBuyOrderRequiresPrice': true,
91935
92665
  'advanced': true,
91936
92666
  'fetchMarkets': 'fetchMarketsV3',
@@ -92286,10 +93016,10 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
92286
93016
  return this.parseTrades(buys['data'], undefined, since, limit);
92287
93017
  }
92288
93018
  async fetchTransactionsWithMethod(method, code = undefined, since = undefined, limit = undefined, params = {}) {
92289
- const request = await this.prepareAccountRequestWithCurrencyCode(code, limit, params);
93019
+ let request = undefined;
93020
+ [request, params] = await this.prepareAccountRequestWithCurrencyCode(code, limit, params);
92290
93021
  await this.loadMarkets();
92291
- const query = this.omit(params, ['account_id', 'accountId']);
92292
- const response = await this[method](this.extend(request, query));
93022
+ const response = await this[method](this.extend(request, params));
92293
93023
  return this.parseTransactions(response['data'], undefined, since, limit);
92294
93024
  }
92295
93025
  async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
@@ -92841,15 +93571,45 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
92841
93571
  const expires = this.safeInteger(options, 'expires', 1000);
92842
93572
  const now = this.milliseconds();
92843
93573
  if ((timestamp === undefined) || ((now - timestamp) > expires)) {
92844
- 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', []);
92845
93605
  const exchangeRates = await this.v2PublicGetExchangeRates(params);
92846
93606
  this.options['fetchCurrencies'] = this.extend(options, {
92847
- 'currencies': currencies,
93607
+ 'currencies': this.arrayConcat(fiatData, cryptoData),
92848
93608
  'exchangeRates': exchangeRates,
92849
93609
  'timestamp': now,
92850
93610
  });
92851
93611
  }
92852
- return this.safeValue(this.options, 'fetchCurrencies', {});
93612
+ return this.safeDict(this.options, 'fetchCurrencies', {});
92853
93613
  }
92854
93614
  async fetchCurrencies(params = {}) {
92855
93615
  /**
@@ -92864,18 +93624,27 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
92864
93624
  const response = await this.fetchCurrenciesFromCache(params);
92865
93625
  const currencies = this.safeValue(response, 'currencies', {});
92866
93626
  //
92867
- // {
92868
- // "data":[
92869
- // {"id":"AED","name":"United Arab Emirates Dirham","min_size":"0.01000000"},
92870
- // {"id":"AFN","name":"Afghan Afghani","min_size":"0.01000000"},
92871
- // {"id":"ALL","name":"Albanian Lek","min_size":"0.01000000"},
92872
- // {"id":"AMD","name":"Armenian Dram","min_size":"0.01000000"},
92873
- // {"id":"ANG","name":"Netherlands Antillean Gulden","min_size":"0.01000000"},
92874
- // ...
92875
- // ],
92876
- // }
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
+ // }
92877
93647
  //
92878
- const exchangeRates = this.safeValue(response, 'exchangeRates', {});
92879
93648
  //
92880
93649
  // {
92881
93650
  // "data":{
@@ -92891,24 +93660,23 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
92891
93660
  // }
92892
93661
  // }
92893
93662
  //
92894
- const data = this.safeValue(currencies, 'data', []);
92895
- const dataById = this.indexBy(data, 'id');
92896
- const rates = this.safeValue(this.safeValue(exchangeRates, 'data', {}), 'rates', {});
92897
- const keys = Object.keys(rates);
92898
93663
  const result = {};
92899
- for (let i = 0; i < keys.length; i++) {
92900
- const key = keys[i];
92901
- const type = (key in dataById) ? 'fiat' : 'crypto';
92902
- const currency = this.safeValue(dataById, key, {});
92903
- const id = this.safeString(currency, 'id', key);
92904
- 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');
92905
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();
92906
93674
  result[code] = {
93675
+ 'info': currency,
92907
93676
  'id': id,
92908
93677
  'code': code,
92909
- 'info': currency,
92910
- 'type': type,
92911
- 'name': name,
93678
+ 'type': (assetId !== undefined) ? 'crypto' : 'fiat',
93679
+ 'name': this.safeString(currency, 'name'),
92912
93680
  'active': true,
92913
93681
  'deposit': undefined,
92914
93682
  'withdraw': undefined,
@@ -92925,7 +93693,14 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
92925
93693
  },
92926
93694
  },
92927
93695
  };
93696
+ if (assetId !== undefined) {
93697
+ const lowerCaseName = name.toLowerCase();
93698
+ networks[code] = lowerCaseName;
93699
+ networksById[lowerCaseName] = code;
93700
+ }
92928
93701
  }
93702
+ this.options['networks'] = this.extend(networks, this.options['networks']);
93703
+ this.options['networksById'] = this.extend(networksById, this.options['networksById']);
92929
93704
  return result;
92930
93705
  }
92931
93706
  async fetchTickers(symbols = undefined, params = {}) {
@@ -93403,12 +94178,12 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
93403
94178
  if (code !== undefined) {
93404
94179
  currency = this.currency(code);
93405
94180
  }
93406
- const request = await this.prepareAccountRequestWithCurrencyCode(code, limit, params);
93407
- const query = this.omit(params, ['account_id', 'accountId']);
94181
+ let request = undefined;
94182
+ [request, params] = await this.prepareAccountRequestWithCurrencyCode(code, limit, params);
93408
94183
  // for pagination use parameter 'starting_after'
93409
94184
  // the value for the next page can be obtained from the result of the previous call in the 'pagination' field
93410
94185
  // eg: instance.last_json_response.pagination.next_starting_after
93411
- const response = await this.v2PrivateGetAccountsAccountIdTransactions(this.extend(request, query));
94186
+ const response = await this.v2PrivateGetAccountsAccountIdTransactions(this.extend(request, params));
93412
94187
  return this.parseLedger(response['data'], currency, since, limit);
93413
94188
  }
93414
94189
  parseLedgerEntryStatus(status) {
@@ -93766,6 +94541,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
93766
94541
  }
93767
94542
  async prepareAccountRequestWithCurrencyCode(code = undefined, limit = undefined, params = {}) {
93768
94543
  let accountId = this.safeString2(params, 'account_id', 'accountId');
94544
+ params = this.omit(params, ['account_id', 'accountId']);
93769
94545
  if (accountId === undefined) {
93770
94546
  if (code === undefined) {
93771
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');
@@ -93781,7 +94557,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
93781
94557
  if (limit !== undefined) {
93782
94558
  request['limit'] = limit;
93783
94559
  }
93784
- return request;
94560
+ return [request, params];
93785
94561
  }
93786
94562
  async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
93787
94563
  /**
@@ -94954,6 +95730,140 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
94954
95730
  const data = this.safeValue(response, 'data', {});
94955
95731
  return this.parseTransaction(data, currency);
94956
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
+ }
94957
95867
  sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
94958
95868
  const version = api[0];
94959
95869
  const signed = api[1] === 'private';
@@ -94996,13 +95906,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
94996
95906
  payload = body;
94997
95907
  }
94998
95908
  }
94999
- let auth = undefined;
95000
- if (version === 'v3') {
95001
- auth = nonce + method + savedPath + payload;
95002
- }
95003
- else {
95004
- auth = nonce + method + fullPath + payload;
95005
- }
95909
+ const auth = nonce + method + savedPath + payload;
95006
95910
  const signature = this.hmac(this.encode(auth), this.encode(this.secret), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_4__/* .sha256 */ .J);
95007
95911
  headers = {
95008
95912
  'CB-ACCESS-KEY': this.apiKey,
@@ -122329,7 +123233,7 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
122329
123233
  const amount = this.safeString(order, 'amount');
122330
123234
  let cost = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(filledString, averageString);
122331
123235
  if (market['inverse']) {
122332
- if (this.parseNumber(averageString) !== 0) {
123236
+ if (averageString !== '0') {
122333
123237
  cost = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringDiv(amount, averageString);
122334
123238
  }
122335
123239
  }
@@ -164117,6 +165021,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
164117
165021
  }
164118
165022
  createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
164119
165023
  const market = this.market(symbol);
165024
+ symbol = market['symbol'];
164120
165025
  type = this.safeString(params, 'orderType', type);
164121
165026
  const timeInForce = this.safeString(params, 'timeInForce');
164122
165027
  let postOnly = false;
@@ -164136,7 +165041,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
164136
165041
  const request = {
164137
165042
  'symbol': market['id'],
164138
165043
  'side': side,
164139
- 'size': amount,
165044
+ 'size': this.amountToPrecision(symbol, amount),
164140
165045
  };
164141
165046
  const clientOrderId = this.safeString2(params, 'clientOrderId', 'cliOrdId');
164142
165047
  if (clientOrderId !== undefined) {
@@ -164174,7 +165079,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
164174
165079
  }
164175
165080
  request['orderType'] = type;
164176
165081
  if (price !== undefined) {
164177
- request['limitPrice'] = price;
165082
+ request['limitPrice'] = this.priceToPrecision(symbol, price);
164178
165083
  }
164179
165084
  params = this.omit(params, ['clientOrderId', 'timeInForce', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice']);
164180
165085
  return this.extend(request, params);
@@ -169672,11 +170577,11 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
169672
170577
  }
169673
170578
  }
169674
170579
  let fee = undefined;
169675
- const feeCost = this.safeNumber(item, 'fee');
170580
+ const feeCost = this.safeString(item, 'fee');
169676
170581
  let feeCurrency = undefined;
169677
- if (feeCost !== 0) {
170582
+ if (feeCost !== '0') {
169678
170583
  feeCurrency = code;
169679
- fee = { 'cost': feeCost, 'currency': feeCurrency };
170584
+ fee = { 'cost': this.parseNumber(feeCost), 'currency': feeCurrency };
169680
170585
  }
169681
170586
  return {
169682
170587
  'id': id,
@@ -169790,8 +170695,12 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
169790
170695
  // }
169791
170696
  // }
169792
170697
  //
169793
- const data = this.safeValue(response, 'data');
169794
- const items = this.safeValue(data, 'items', data);
170698
+ const dataList = this.safeList(response, 'data');
170699
+ if (dataList !== undefined) {
170700
+ return this.parseLedger(dataList, currency, since, limit);
170701
+ }
170702
+ const data = this.safeDict(response, 'data');
170703
+ const items = this.safeList(data, 'items', []);
169795
170704
  return this.parseLedger(items, currency, since, limit);
169796
170705
  }
169797
170706
  calculateRateLimiterCost(api, method, path, params, config = {}) {
@@ -183211,247 +184120,353 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
183211
184120
  'defaultNetwork': 'ETH',
183212
184121
  'defaultNetworks': {
183213
184122
  'ETH': 'ETH',
183214
- 'USDT': 'TRC20',
184123
+ 'USDT': 'ERC20',
184124
+ 'USDC': 'ERC20',
184125
+ 'BTC': 'BTC',
184126
+ 'LTC': 'LTC',
183215
184127
  },
183216
184128
  'networks': {
183217
- 'BTC': 'BTC',
183218
- 'BCH': 'BCH',
183219
- 'TRC20': 'Tron(TRC20)',
183220
- 'ERC20': 'Ethereum(ERC20)',
183221
- 'BEP20': 'BNB Smart Chain(BEP20)',
183222
- 'OPTIMISM': 'Optimism(OP)',
183223
- 'SOL': 'Solana(SOL)',
183224
- 'CRC20': 'CRONOS',
184129
+ 'ABBC': 'ABBC',
184130
+ 'ACA': 'ACALA',
184131
+ 'ADA': 'Cardano(ADA)',
184132
+ 'AE': 'AE',
183225
184133
  'ALGO': 'Algorand(ALGO)',
183226
- 'XRP': 'XRP',
183227
- 'MATIC': 'Polygon(MATIC)',
183228
- 'AVAXX': 'AVAX_XCHAIN',
183229
- 'AVAXC': 'AvalancheCChain(AVAXCCHAIN)',
183230
- 'ARBONE': 'ArbitrumOne(ARB)',
184134
+ 'ALPH': 'Alephium(ALPH)',
184135
+ 'AME': 'AME',
184136
+ 'AOK': 'AOK',
184137
+ 'APT': 'APTOS(APT)',
184138
+ 'AR': 'AR',
184139
+ 'ARB': 'Arbitrum One(ARB)',
183231
184140
  'ARBNOVA': 'ARBNOVA',
183232
- 'FTM': 'FTM',
183233
- 'WAVES': 'WAVES',
183234
- 'CHZ': 'Chiliz Chain(CHZ)',
183235
- 'HRC20': 'HECO',
183236
- 'TRC10': 'TRC10',
183237
- 'DASH': 'DASH',
183238
- 'LTC': 'LTC',
183239
- // 'DOGECOIN': [ 'DOGE', 'DOGECHAIN' ], // todo after unification
183240
- 'XTZ': 'XTZ',
183241
- 'OMNI': 'OMNI',
183242
- 'APT': 'APTOS',
183243
- 'ONT': 'ONT',
183244
- 'BSV': 'BSV',
183245
- 'OKC': 'OKT',
184141
+ 'ARBONE': 'ArbitrumOne(ARB)',
184142
+ 'ARK': 'ARK',
184143
+ 'ASTR': 'ASTAR',
184144
+ 'ATOM': 'Cosmos(ATOM)',
184145
+ 'AVAXC': 'Avalanche C Chain(AVAX CCHAIN)',
184146
+ 'AVAXX': 'Avalanche X Chain(AVAX XCHAIN)',
184147
+ 'AZERO': 'Aleph Zero(AZERO)',
184148
+ 'BCH': 'Bitcoin Cash(BCH)',
184149
+ 'BDX': 'BDX',
184150
+ 'BEAM': 'BEAM',
184151
+ 'BEP2': 'BNB Beacon Chain(BEP2)',
184152
+ 'BEP20': 'BNB Smart Chain(BEP20)',
184153
+ 'BITCI': 'BITCI',
184154
+ 'BNC': 'BNC',
184155
+ 'BNCDOT': 'BNCPOLKA',
184156
+ 'BOBA': 'BOBA',
184157
+ 'BSC': 'BEP20(BSC)',
184158
+ 'BSV': 'Bitcoin SV(BSV)',
184159
+ 'BTC': 'Bitcoin(BTC)',
184160
+ 'BTM': 'BTM2',
183246
184161
  'CELO': 'CELO',
183247
- 'KLAY': 'KLAY',
183248
- 'BEP2': 'BEP2',
184162
+ 'CFX': 'CFX',
184163
+ 'CHZ': 'Chiliz Legacy Chain(CHZ)',
184164
+ 'CHZ2': 'Chiliz Chain(CHZ2)',
184165
+ 'CKB': 'CKB',
184166
+ 'CLORE': 'Clore.ai(CLORE)',
184167
+ 'CRC20': 'CRONOS',
184168
+ 'CSPR': 'CSPR',
184169
+ 'DASH': 'DASH',
184170
+ 'DC': 'Dogechain(DC)',
184171
+ 'DCR': 'DCR',
184172
+ 'DNX': 'Dynex(DNX)',
184173
+ 'DOGE': 'Dogecoin(DOGE)',
184174
+ 'DOT': 'Polkadot(DOT)',
184175
+ 'DYM': 'Dymension(DYM)',
184176
+ 'EDG': 'EDG',
183249
184177
  'EGLD': 'EGLD',
183250
184178
  'EOS': 'EOS',
183251
- 'ZIL': 'ZIL',
184179
+ 'ERC20': 'Ethereum(ERC20)',
184180
+ 'ETC': 'Ethereum Classic(ETC)',
184181
+ 'ETHF': 'ETF',
183252
184182
  'ETHW': 'ETHW',
183253
- 'IOTX': 'IOTX',
184183
+ 'EVER': 'EVER',
184184
+ 'FET': 'FET',
184185
+ 'FIL': 'FIL',
184186
+ 'FIO': 'FIO',
184187
+ 'FLOW': 'FLOW',
184188
+ 'FSN': 'FSN',
184189
+ 'FTM': 'Fantom(FTM)',
184190
+ 'FUSE': 'FUSE',
184191
+ 'GLMR': 'GLMR',
184192
+ 'GRIN': 'GRIN',
184193
+ 'HBAR': 'Hedera(HBAR)',
184194
+ 'HIVE': 'HIVE',
184195
+ 'HRC20': 'HECO',
184196
+ 'HYDRA': 'HYDRA',
184197
+ 'ICP': 'Internet Computer(ICP)',
184198
+ 'INDEX': 'Index Chain',
184199
+ 'IOST': 'IOST',
183254
184200
  'IOTA': 'IOTA',
183255
- 'SYS': 'SYS',
183256
- 'XCH': 'CHIA',
183257
- 'KMA': 'KMA',
183258
- 'ONE': 'ONE',
183259
- 'METIS': 'METIS',
184201
+ 'IOTX': 'IOTX',
184202
+ 'IRIS': 'IRIS',
184203
+ 'KAR': 'KAR',
184204
+ 'KAS': 'Kaspa(KAS)',
183260
184205
  'KAVA': 'KAVA',
183261
184206
  'KDA': 'KDA',
183262
- 'IOST': 'IOST',
183263
- 'XEC': 'XEC',
183264
- 'VET': 'VET',
183265
- 'XLM': 'XLM',
184207
+ 'KILT': 'KILT',
184208
+ 'KLAY': 'Klaytn(KLAY)',
184209
+ 'KMA': 'KMA',
183266
184210
  'KSM': 'KSM',
183267
- 'MOVR': 'MOVR',
183268
- 'XMR': 'XMR',
183269
184211
  'LAT': 'LAT',
183270
- 'ETC': 'ETC',
183271
- // 'TLOS': 'TELOS', // todo
183272
- // 'TELOSCOIN': 'TLOS', // todo
183273
- 'GLMR': 'GLMR',
183274
- 'DOT': 'DOT',
183275
- 'SC': 'SC',
183276
- 'ICP': 'ICP',
183277
- 'AOK': 'AOK',
183278
- 'ZEC': 'ZEC',
183279
- 'ACA': 'ACALA',
183280
- 'ASTR': 'ASTAR',
183281
- 'FIL': 'FIL',
183282
- 'NEAR': 'NEAR',
183283
- 'OSMO': 'OSMO',
183284
- 'SDN': 'SDN',
183285
- 'BITCI': 'BITCI',
184212
+ 'LAVA': 'Elysium(LAVA)',
184213
+ 'LTC': 'Litecoin(LTC)',
184214
+ 'LUNA': 'Terra(LUNA)',
184215
+ 'MASS': 'MASS',
184216
+ 'MATIC': 'Polygon(MATIC)',
184217
+ 'MCOIN': 'Mcoin Network',
184218
+ 'METIS': 'METIS',
184219
+ 'MINA': 'MINA',
184220
+ 'MNT': 'Mantle(MNT)',
184221
+ 'MOVR': 'MOVR',
184222
+ 'MTRG': 'Meter(MTRG)',
184223
+ 'NAS': 'NAS',
184224
+ 'NEAR': 'NEAR Protocol(NEAR)',
184225
+ 'NEBL': 'NEBL',
184226
+ 'NEM': 'NEM',
183286
184227
  'NEO': 'NEO',
183287
- 'ADA': 'ADA',
183288
- 'RVN': 'RVN',
183289
- 'BNC': 'BNC',
183290
- 'BNCDOT': 'BNCPOLKA',
183291
- 'ETHF': 'ETF',
183292
- 'STEEM': 'STEEM',
183293
- 'OASYS': 'OASYS',
183294
- 'BEAM': 'BEAM',
183295
- 'VSYS': 'VSYS',
184228
+ 'NEO3': 'NEO3',
184229
+ 'NEOXA': 'Neoxa Network',
184230
+ 'NULS': 'NULS',
183296
184231
  'OASIS': 'ROSE',
183297
- 'AR': 'AR',
183298
- 'AE': 'AE',
184232
+ 'OASYS': 'OASYS',
184233
+ 'OKC': 'OKT',
184234
+ 'OMN': 'Omega Network(OMN)',
184235
+ 'OMNI': 'OMNI',
184236
+ 'ONE': 'ONE',
184237
+ 'ONT': 'ONT',
184238
+ 'OPTIMISM': 'Optimism(OP)',
184239
+ 'OSMO': 'OSMO',
184240
+ 'PLCU': 'PLCU',
184241
+ 'POKT': 'POKT',
184242
+ 'QKC': 'QKC',
183299
184243
  'QTUM': 'QTUM',
183300
- 'ATOM': 'ATOM',
183301
- 'HBAR': 'HBAR',
183302
- 'CSPR': 'CSPR',
183303
- 'WEMIX': 'WEMIX',
183304
- 'SGB': 'SGB',
183305
- 'XPR': 'PROTON',
183306
- 'HYDRA': 'HYDRA',
184244
+ 'RAP20': 'RAP20 (Rangers Mainnet)',
184245
+ 'REI': 'REI',
184246
+ 'RSK': 'RBTC',
184247
+ 'RVN': 'Ravencoin(RVN)',
184248
+ 'SATOX': 'Satoxcoin(SATOX)',
184249
+ 'SC': 'SC',
183307
184250
  'SCRT': 'SCRT',
184251
+ 'SDN': 'SDN',
184252
+ 'SGB': 'SGB',
184253
+ 'SOL': 'Solana(SOL)',
184254
+ 'STAR': 'STAR',
184255
+ 'STARK': 'Starknet(STARK)',
184256
+ 'STEEM': 'STEEM',
184257
+ 'SYS': 'SYS',
184258
+ 'TAO': 'Bittensor(TAO)',
184259
+ 'TIA': 'Celestia(TIA)',
183308
184260
  'TOMO': 'TOMO',
184261
+ 'TON': 'Toncoin(TON)',
184262
+ 'TRC10': 'TRC10',
184263
+ 'TRC20': 'Tron(TRC20)',
184264
+ 'UGAS': 'UGAS(Ultrain)',
184265
+ 'VET': 'VeChain(VET)',
184266
+ 'VEX': 'Vexanium(VEX)',
184267
+ 'VSYS': 'VSYS',
184268
+ 'WAVES': 'WAVES',
183309
184269
  'WAX': 'WAX',
183310
- 'KAR': 'KAR',
183311
- 'KILT': 'KILT',
184270
+ 'WEMIX': 'WEMIX',
184271
+ 'XCH': 'Chia(XCH)',
183312
184272
  'XDC': 'XDC',
183313
- 'GRIN': 'GRIN',
183314
- 'PLCU': 'PLCU',
183315
- 'MINA': 'MINA',
183316
- 'ABBC': 'ABBC',
183317
- 'ZEN': 'ZEN',
183318
- 'FLOW': 'FLOW',
183319
- 'RSK': 'RBTC',
183320
- 'DCR': 'DCR',
183321
- 'HIVE': 'HIVE',
183322
- 'XYM': 'XYM',
183323
- 'CKB': 'CKB',
184273
+ 'XEC': 'XEC',
184274
+ 'XLM': 'Stellar(XLM)',
184275
+ 'XMR': 'Monero(XMR)',
184276
+ 'XNA': 'Neurai(XNA)',
184277
+ 'XPR': 'XPR Network',
183324
184278
  'XRD': 'XRD',
184279
+ 'XRP': 'Ripple(XRP)',
184280
+ 'XTZ': 'XTZ',
183325
184281
  'XVG': 'XVG',
183326
- 'BOBA': 'BOBA',
183327
- 'AZERO': 'AZERO',
183328
- 'ARK': 'ARK',
183329
- 'NULS': 'NULS',
183330
- 'POKT': 'POKT',
183331
- 'NEO3': 'NEO3',
183332
- 'FIO': 'FIO',
183333
- 'MASS': 'MASS',
183334
- 'AME': 'AME',
183335
- 'REI': 'REI',
183336
- 'IRIS': 'IRIS',
184282
+ 'XYM': 'XYM',
184283
+ 'ZEC': 'ZEC',
184284
+ 'ZEN': 'ZEN',
184285
+ 'ZIL': 'Zilliqa(ZIL)',
183337
184286
  'ZTG': 'ZTG',
183338
- 'EDG': 'EDG',
183339
- 'FUSE': 'FUSE',
183340
- 'EVER': 'EVER',
183341
- 'FET': 'FET',
183342
- 'CFX': 'CFX',
183343
- 'NEBL': 'NEBL',
183344
- 'STAR': 'STAR',
183345
- 'NEM': 'NEM',
183346
- 'BDX': 'BDX',
183347
- 'TON': 'TONCOIN',
183348
- 'NAS': 'NAS',
183349
- 'QKC': 'QKC',
183350
- 'BTM': 'BTM2',
183351
- 'FSN': 'FSN',
183352
184287
  // todo: uncomment below after concensus
183353
- // 'TERRACLASSIC': 'LUNC',
183354
- // 'TERRA': 'LUNA2',
183355
- // 'PHALA': 'Khala',
183356
- // 'NODLE': 'NODLE',
183357
- // 'KUJIRA': 'KUJI',
183358
- // 'HUAHUA': 'HUAHUA',
183359
- // 'FRUITS': 'FRTS',
183360
- // 'IOEX': 'IOEX',
183361
- // 'TOMAINFO': 'TON',
184288
+ // 'ALAYA': 'ATP',
184289
+ // 'ANDUSCHAIN': 'DEB',
184290
+ // 'ASSETMANTLE': 'MNTL',
184291
+ // 'AXE': 'AXE',
183362
184292
  // 'BITCOINHD': 'BHD',
184293
+ // 'BITCOINVAULT': 'BTCV',
184294
+ // 'BITKUB': 'KUB',
184295
+ // 'BITSHARES_OLD': 'BTS',
184296
+ // 'BITSHARES': 'NBS',
184297
+ // 'BYTZ': 'BYTZ',
184298
+ // 'CANTO': 'CANTO', // CANTOEVM
183363
184299
  // 'CENNZ': 'CENNZ',
183364
- // 'WAYKICHAIN': 'WICC',
183365
- // 'EMERALD': 'EMERALD', // sits on top of OASIS
184300
+ // 'CHAINX': 'PCX',
184301
+ // 'CONCODRIUM': 'CCD',
183366
184302
  // 'CONTENTVALUENETWORK': 'CVNT',
183367
- // 'ORIGYN': 'OGY',
183368
- // 'KASPA': 'KASPA',
183369
- // 'CANTO': 'CANTO', // CANTOEVM
184303
+ // 'CORTEX': 'CTXC',
184304
+ // 'CYPHERIUM': 'CPH',
184305
+ // 'DANGNN': 'DGC',
183370
184306
  // 'DARWINIASMARTCHAIN': 'Darwinia Smart Chain',
183371
- // 'KEKCHAIN': 'KEKCHAIN',
183372
- // 'ZENITH': 'ZENITH',
184307
+ // 'DHEALTH': 'DHP',
184308
+ // 'DOGECOIN': [ 'DOGE', 'DOGECHAIN' ], // todo after unification
184309
+ // 'DRAC': 'DRAC',
184310
+ // 'DRAKEN': 'DRK',
183373
184311
  // 'ECOCHAIN': 'ECOC',
183374
184312
  // 'ELECTRAPROTOCOL': 'XEP',
183375
- // 'KULUPU': 'KLP',
183376
- // 'KINTSUGI': 'KINT',
183377
- // 'PLEX': 'PLEX',
183378
- // 'CONCODRIUM': 'CCD',
183379
- // 'REBUS': 'REBUS', // REBUSEVM is different
183380
- // 'BITKUB': 'KUB',
183381
- // 'BITCOINVAULT': 'BTCV',
183382
- // 'PROXIMAX': 'XPX',
183383
- // 'PAC': 'PAC',
183384
- // 'CHAINX': 'PCX',
183385
- // 'DRAC': 'DRAC',
183386
- // 'WHITECOIN': 'XWC',
183387
- // 'TECHPAY': 'TPC',
183388
- // 'GXCHAIN': 'GXC',
183389
- // 'CYPHERIUM': 'CPH',
183390
- // 'LBRY': 'LBC',
183391
- // 'TONGTONG': 'TTC',
183392
- // 'LEDGIS': 'LED',
183393
- // 'PMG': 'PMG',
183394
- // 'PROOFOFMEMES': 'POM',
183395
- // 'SENTINEL': 'DVPN',
183396
- // 'METER': 'MTRG',
183397
- // 'YAS': 'YAS',
183398
- // 'ULTRAIN': 'UGAS',
183399
- // 'PASTEL': 'PSL',
183400
- // 'KONSTELLATION': 'DARC',
183401
- // 'ANDUSCHAIN': 'DEB',
184313
+ // 'EMERALD': 'EMERALD', // sits on top of OASIS
184314
+ // 'EVMOS': 'EVMOS', // EVMOSETH is different
184315
+ // 'EXOSAMA': 'SAMA',
184316
+ // 'FIBOS': 'FO',
184317
+ // 'FILECASH': 'FIC',
183402
184318
  // 'FIRMACHAIN': 'FCT',
184319
+ // 'FIRO': 'XZC',
184320
+ // 'FNCY': 'FNCY',
184321
+ // 'FRUITS': 'FRTS',
184322
+ // 'GLEEC': 'GLEEC',
184323
+ // 'GXCHAIN': 'GXC',
183403
184324
  // 'HANDSHAKE': 'HNS',
183404
- // 'DANGNN': 'DGC',
183405
- // 'SERO': 'SERO',
183406
184325
  // 'HPB': 'HPB',
183407
- // 'XDAI': 'XDAI',
183408
- // 'EXOSAMA': 'SAMA',
183409
- // 'DHEALTH': 'DHP',
183410
- // 'HUPAYX': 'HPX',
183411
- // 'GLEEC': 'GLEEC',
183412
- // 'FIBOS': 'FO',
183413
- // 'MDNA': 'DNA',
183414
184326
  // 'HSHARE': 'HC',
183415
- // 'BYTZ': 'BYTZ',
183416
- // 'DRAKEN': 'DRK',
184327
+ // 'HUAHUA': 'HUAHUA',
184328
+ // 'HUPAYX': 'HPX',
184329
+ // 'INDEXCHAIN': 'IDX',
184330
+ // 'INTCHAIN': 'INT',
184331
+ // 'INTEGRITEE': 'TEER',
184332
+ // 'INTERLAY': 'INTR',
184333
+ // 'IOEX': 'IOEX',
184334
+ // 'JUNO': 'JUNO',
184335
+ // 'KASPA': 'KASPA',
184336
+ // 'KEKCHAIN': 'KEKCHAIN',
184337
+ // 'KINTSUGI': 'KINT',
184338
+ // 'KOINOS': 'KOINOS',
184339
+ // 'KONSTELLATION': 'DARC',
184340
+ // 'KUJIRA': 'KUJI',
184341
+ // 'KULUPU': 'KLP',
184342
+ // 'LBRY': 'LBC',
184343
+ // 'LEDGIS': 'LED',
184344
+ // 'LIGHTNINGBITCOIN': 'LBTC',
183417
184345
  // 'LINE': 'LINE',
184346
+ // 'MDNA': 'DNA',
183418
184347
  // 'MDUKEY': 'MDU',
183419
- // 'KOINOS': 'KOINOS',
184348
+ // 'METAMUI': 'MMUI',
184349
+ // 'METAVERSE_ETP': 'ETP',
184350
+ // 'METER': 'MTRG',
183420
184351
  // 'MEVERSE': 'MEVerse',
184352
+ // 'NEWTON': 'NEW',
184353
+ // 'NODLE': 'NODLE',
184354
+ // 'ORIGYN': 'OGY',
184355
+ // 'PAC': 'PAC',
184356
+ // 'PASTEL': 'PSL',
184357
+ // 'PHALA': 'Khala',
184358
+ // 'PLEX': 'PLEX',
184359
+ // 'PMG': 'PMG',
183421
184360
  // 'POINT': 'POINT', // POINTEVM is different
183422
- // 'INDEXCHAIN': 'IDX',
183423
- // 'ULORD': 'UT',
183424
- // 'INTEGRITEE': 'TEER',
183425
- // 'XX': 'XX',
183426
- // 'CORTEX': 'CTXC',
184361
+ // 'PROOFOFMEMES': 'POM',
184362
+ // 'PROXIMAX': 'XPX',
184363
+ // 'RCHAIN': 'REV',
184364
+ // 'REBUS': 'REBUS', // REBUSEVM is different
183427
184365
  // 'RIZON': 'ATOLO',
184366
+ // 'SENTINEL': 'DVPN',
184367
+ // 'SERO': 'SERO',
184368
+ // 'TECHPAY': 'TPC',
184369
+ // 'TELOSCOIN': 'TLOS', // todo
184370
+ // 'TERRA': 'LUNA2',
184371
+ // 'TERRACLASSIC': 'LUNC',
184372
+ // 'TLOS': 'TELOS', // todo
184373
+ // 'TOMAINFO': 'TON',
184374
+ // 'TONGTONG': 'TTC',
184375
+ // 'TURTLECOIN': 'TRTL',
184376
+ // 'ULORD': 'UT',
184377
+ // 'ULTRAIN': 'UGAS',
184378
+ // 'UMEE': 'UMEE',
183428
184379
  // 'VDIMENSION': 'VOLLAR',
183429
- // 'JUNO': 'JUNO',
183430
184380
  // 'VEXANIUM': 'VEX',
183431
- // 'INTCHAIN': 'INT',
183432
- // 'METAMUI': 'MMUI',
183433
- // 'RCHAIN': 'REV',
183434
- // 'EVMOS': 'EVMOS', // EVMOSETH is different
183435
- // 'ZKSYNC': 'ZKSYNC',
183436
- // 'BITSHARES_OLD': 'BTS',
183437
- // 'BITSHARES': 'NBS',
183438
- // 'UMEE': 'UMEE',
183439
184381
  // 'VNT': 'VNT',
183440
- // 'TURTLECOIN': 'TRTL',
183441
- // 'METAVERSE_ETP': 'ETP',
183442
- // 'NEWTON': 'NEW',
183443
- // // 'BAJUN': '',
183444
- // 'INTERLAY': 'INTR',
183445
- // 'LIGHTNINGBITCOIN': 'LBTC',
183446
- // 'FIRO': 'XZC',
183447
- // 'ALAYA': 'ATP',
183448
- // 'AXE': 'AXE',
183449
- // 'FNCY': 'FNCY',
184382
+ // 'WAYKICHAIN': 'WICC',
184383
+ // 'WHITECOIN': 'XWC',
183450
184384
  // 'WITNET': 'WIT',
183451
- // 'FILECASH': 'FIC',
183452
- // 'ASSETMANTLE': 'MNTL',
184385
+ // 'XDAI': 'XDAI',
184386
+ // 'XX': 'XX',
184387
+ // 'YAS': 'YAS',
184388
+ // 'ZENITH': 'ZENITH',
184389
+ // 'ZKSYNC': 'ZKSYNC',
184390
+ // // 'BAJUN': '',
183453
184391
  // OKB <> OKT (for usdt it's exception) for OKC, PMEER, FLARE, STRD, ZEL, FUND, "NONE", CRING, FREETON, QTZ (probably unique network is meant), HT, BSC(RACAV1), BSC(RACAV2), AMBROSUS, BAJUN, NOM. their individual info is at https://www.mexc.com/api/platform/asset/spot/{COINNAME}
183454
184392
  },
184393
+ 'networksById': {
184394
+ 'Aleph Zero(AZERO)': 'AZERO',
184395
+ 'Alephium(ALPH)': 'ALPH',
184396
+ 'Algorand(ALGO)': 'ALGO',
184397
+ 'APTOS(APT)': 'APT',
184398
+ 'Arbitrum One(ARB)': 'ARB',
184399
+ 'Avalanche C Chain(AVAX CCHAIN)': 'AVAXC',
184400
+ 'Avalanche X Chain(AVAX XCHAIN)': 'AVAXX',
184401
+ 'BEP20(BSC)': 'BSC',
184402
+ 'Bitcoin Cash(BCH)': 'BCH',
184403
+ 'Bitcoin SV(BSV)': 'BSV',
184404
+ 'Bitcoin(BTC)': 'BTC',
184405
+ 'Bittensor(TAO)': 'TAO',
184406
+ 'BNB Beacon Chain(BEP2)': 'BEP2',
184407
+ 'BNB Smart Chain(BEP20-RACAV1)': 'BSC',
184408
+ 'BNB Smart Chain(BEP20-RACAV2)': 'BSC',
184409
+ 'BNB Smart Chain(BEP20)': 'BSC',
184410
+ 'Cardano(ADA)': 'ADA',
184411
+ 'Celestia(TIA)': 'TIA',
184412
+ 'Chia(XCH)': 'XCH',
184413
+ 'Chiliz Chain(CHZ2)': 'CHZ2',
184414
+ 'Chiliz Legacy Chain(CHZ)': 'CHZ',
184415
+ 'Clore.ai(CLORE)': 'CLORE',
184416
+ 'Cosmos(ATOM)': 'ATOM',
184417
+ 'Dogechain(DC)': 'DC',
184418
+ 'Dogecoin(DOGE)': 'DOGE',
184419
+ 'Dymension(DYM)': 'DYM',
184420
+ 'Dynex(DNX)': 'DNX',
184421
+ 'Elysium(LAVA)': 'LAVA',
184422
+ 'Ethereum Classic(ETC)': 'ETC',
184423
+ 'Ethereum(ERC20)': 'ERC20',
184424
+ 'Fantom(FTM)': 'FTM',
184425
+ 'Hedera(HBAR)': 'HBAR',
184426
+ 'Index Chain': 'INDEX',
184427
+ 'Internet Computer(ICP)': 'ICP',
184428
+ 'Kaspa(KAS)': 'KAS',
184429
+ 'Klaytn(KLAY)': 'KLAY',
184430
+ 'Litecoin(LTC)': 'LTC',
184431
+ 'Mantle(MNT)': 'MNT',
184432
+ 'Mcoin Network': 'MCOIN',
184433
+ 'Meter(MTRG)': 'MTRG',
184434
+ 'Monero(XMR)': 'XMR',
184435
+ 'NEAR Protocol(NEAR)': 'NEAR',
184436
+ 'Neoxa Network': 'NEOXA',
184437
+ 'Neurai(XNA)': 'XNA',
184438
+ 'Omega Network(OMN)': 'OMN',
184439
+ 'Optimism(OP)': 'OPTIMISM',
184440
+ 'Polkadot(DOT)': 'DOT',
184441
+ 'Polygon(MATIC)': 'MATIC',
184442
+ 'RAP20 (Rangers Mainnet)': 'RAP20',
184443
+ 'Ravencoin(RVN)': 'RVN',
184444
+ 'Ripple(XRP)': 'XRP',
184445
+ 'Satoxcoin(SATOX)': 'SATOX',
184446
+ 'Solana(SOL)': 'SOL',
184447
+ 'Starknet(STARK)': 'STARK',
184448
+ 'Stellar(XLM)': 'XLM',
184449
+ 'Terra(LUNA)': 'LUNA',
184450
+ 'Toncoin(TON)': 'TON',
184451
+ 'Tron(TRC20)': 'TRC20',
184452
+ 'UGAS(Ultrain)': 'UGAS',
184453
+ 'VeChain(VET)': 'VET',
184454
+ 'Vexanium(VEX)': 'VEX',
184455
+ 'XPR Network': 'XPR',
184456
+ 'Zilliqa(ZIL)': 'ZIL',
184457
+ // TODO: uncomment below after deciding unified name
184458
+ // 'PEPE COIN BSC':
184459
+ // 'SMART BLOCKCHAIN':
184460
+ // 'f(x)Core':
184461
+ // 'Syscoin Rollux':
184462
+ // 'Syscoin UTXO':
184463
+ // 'zkSync Era':
184464
+ // 'zkSync Lite':
184465
+ // 'Darwinia Smart Chain':
184466
+ // 'Arbitrum One(ARB-Bridged)':
184467
+ // 'Optimism(OP-Bridged)':
184468
+ // 'Polygon(MATIC-Bridged)':
184469
+ },
183455
184470
  'recvWindow': 5 * 1000,
183456
184471
  'maxTimeTillEnd': 90 * 86400 * 1000 - 1,
183457
184472
  'broker': 'CCXT',
@@ -183731,7 +184746,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
183731
184746
  for (let j = 0; j < chains.length; j++) {
183732
184747
  const chain = chains[j];
183733
184748
  const networkId = this.safeString(chain, 'network');
183734
- const network = this.safeNetwork(networkId);
184749
+ const network = this.networkIdToCode(networkId);
183735
184750
  const isDepositEnabled = this.safeBool(chain, 'depositEnable', false);
183736
184751
  const isWithdrawEnabled = this.safeBool(chain, 'withdrawEnable', false);
183737
184752
  const active = (isDepositEnabled && isWithdrawEnabled);
@@ -183804,26 +184819,6 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
183804
184819
  }
183805
184820
  return result;
183806
184821
  }
183807
- safeNetwork(networkId) {
183808
- if (networkId.indexOf('BSC') >= 0) {
183809
- return 'BEP20';
183810
- }
183811
- const parts = networkId.split(' ');
183812
- networkId = parts.join('');
183813
- networkId = networkId.replace('-20', '20');
183814
- const networksById = {
183815
- 'Ethereum(ERC20)': 'ERC20',
183816
- 'Algorand(ALGO)': 'ALGO',
183817
- 'ArbitrumOne(ARB)': 'ARBONE',
183818
- 'AvalancheCChain(AVAXCCHAIN)': 'AVAXC',
183819
- 'BNB Smart Chain(BEP20)': 'BEP20',
183820
- 'Polygon(MATIC)': 'MATIC',
183821
- 'Optimism(OP)': 'OPTIMISM',
183822
- 'Solana(SOL)': 'SOL',
183823
- 'Tron(TRC20)': 'TRC20',
183824
- };
183825
- return this.safeString(networksById, networkId, networkId);
183826
- }
183827
184822
  async fetchMarkets(params = {}) {
183828
184823
  /**
183829
184824
  * @method
@@ -187068,23 +188063,22 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
187068
188063
  }
187069
188064
  parseDepositAddress(depositAddress, currency = undefined) {
187070
188065
  //
187071
- // {"chain":"ERC-20","address":"0x55cbd73db24eafcca97369e3f2db74b2490586e6"},
187072
- // {"chain":"MATIC","address":"0x05aa3236f1970eae0f8feb17ec19435b39574d74"},
187073
- // {"chain":"TRC20","address":"TGaPfhW41EXD3sAfs1grLF6DKfugfqANNw"},
187074
- // {"chain":"SOL","address":"5FSpUKuh2gjw4mF89T2e7sEjzUA1SkRKjBChFqP43KhV"},
187075
- // {"chain":"ALGO","address":"B3XTZND2JJTSYR7R2TQVCUDT4QSSYVAIZYDPWVBX34DGAYATBU3AUV43VU"}
187076
- //
188066
+ // {
188067
+ // coin: "USDT",
188068
+ // network: "BNB Smart Chain(BEP20)",
188069
+ // address: "0x0d48003e0c27c5de62b97c9b4cdb31fdd29da619",
188070
+ // memo: null
188071
+ // }
187077
188072
  //
187078
188073
  const address = this.safeString(depositAddress, 'address');
187079
- const code = this.safeCurrencyCode(undefined, currency);
187080
- const networkId = this.safeString(depositAddress, 'chain');
187081
- const network = this.safeNetwork(networkId);
188074
+ const currencyId = this.safeString(depositAddress, 'coin');
188075
+ const networkId = this.safeString(depositAddress, 'network');
187082
188076
  this.checkAddress(address);
187083
188077
  return {
187084
- 'currency': code,
188078
+ 'currency': this.safeCurrencyCode(currencyId, currency),
187085
188079
  'address': address,
187086
- 'tag': undefined,
187087
- 'network': network,
188080
+ 'tag': this.safeString(depositAddress, 'memo'),
188081
+ 'network': this.networkIdToCode(networkId),
187088
188082
  'info': depositAddress,
187089
188083
  };
187090
188084
  }
@@ -187113,23 +188107,19 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
187113
188107
  }
187114
188108
  params = this.omit(params, 'network');
187115
188109
  const response = await this.spotPrivateGetCapitalDepositAddress(this.extend(request, params));
187116
- const result = [];
187117
- for (let i = 0; i < response.length; i++) {
187118
- const depositAddress = response[i];
187119
- const coin = this.safeString(depositAddress, 'coin');
187120
- const currencyInner = this.currency(coin);
187121
- const networkIdInner = this.safeString(depositAddress, 'network');
187122
- const network = this.safeNetwork(networkIdInner);
187123
- const address = this.safeString(depositAddress, 'address', undefined);
187124
- const tag = this.safeString2(depositAddress, 'tag', 'memo', undefined);
187125
- result.push({
187126
- 'currency': currencyInner['id'],
187127
- 'network': network,
187128
- 'address': address,
187129
- 'tag': tag,
187130
- });
187131
- }
187132
- return result;
188110
+ //
188111
+ // [
188112
+ // {
188113
+ // coin: "USDT",
188114
+ // network: "BNB Smart Chain(BEP20)",
188115
+ // address: "0x0d48003e0c27c5de62b97c9b4cdb31fdd29da619",
188116
+ // memo: null
188117
+ // }
188118
+ // ...
188119
+ // ]
188120
+ //
188121
+ const addressStructures = this.parseDepositAddresses(response, undefined, false);
188122
+ return this.indexBy(addressStructures, 'network');
187133
188123
  }
187134
188124
  async createDepositAddress(code, params = {}) {
187135
188125
  /**
@@ -187163,13 +188153,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
187163
188153
  // "address": "zzqqqqqqqqqq",
187164
188154
  // "memo": "MX10068"
187165
188155
  // }
187166
- return {
187167
- 'info': response,
187168
- 'currency': this.safeString(response, 'coin'),
187169
- 'network': this.safeString(response, 'network'),
187170
- 'address': this.safeString(response, 'address'),
187171
- 'tag': this.safeString(response, 'memo'),
187172
- };
188156
+ return this.parseDepositAddress(response, currency);
187173
188157
  }
187174
188158
  async fetchDepositAddress(code, params = {}) {
187175
188159
  /**
@@ -187179,23 +188163,30 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
187179
188163
  * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#deposit-address-supporting-network
187180
188164
  * @param {string} code unified currency code
187181
188165
  * @param {object} [params] extra parameters specific to the exchange API endpoint
188166
+ * @param {string} [params.network] the chain of currency, this only apply for multi-chain currency, and there is no need for single chain currency
187182
188167
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
187183
188168
  */
187184
- const rawNetwork = this.safeStringUpper(params, 'network');
187185
- params = this.omit(params, 'network');
187186
- const response = await this.fetchDepositAddressesByNetwork(code, params);
187187
- if (rawNetwork !== undefined) {
187188
- for (let i = 0; i < response.length; i++) {
187189
- const depositAddress = response[i];
187190
- const network = this.safeStringUpper(depositAddress, 'network');
187191
- if (rawNetwork === network) {
187192
- return depositAddress;
187193
- }
188169
+ const network = this.safeString(params, 'network');
188170
+ params = this.omit(params, ['network']);
188171
+ const addressStructures = await this.fetchDepositAddressesByNetwork(code, params);
188172
+ let result = undefined;
188173
+ if (network !== undefined) {
188174
+ result = this.safeDict(addressStructures, this.networkIdToCode(network, code));
188175
+ }
188176
+ else {
188177
+ const options = this.safeDict(this.options, 'defaultNetworks');
188178
+ const defaultNetworkForCurrency = this.safeString(options, code);
188179
+ if (defaultNetworkForCurrency !== undefined) {
188180
+ result = this.safeDict(addressStructures, defaultNetworkForCurrency);
188181
+ }
188182
+ else {
188183
+ const keys = Object.keys(addressStructures);
188184
+ const key = this.safeString(keys, 0);
188185
+ result = this.safeDict(addressStructures, key);
187194
188186
  }
187195
188187
  }
187196
- const result = this.safeValue(response, 0);
187197
188188
  if (result === undefined) {
187198
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidAddress(this.id + ' fetchDepositAddress() cannot find a deposit address for ' + code + ', consider creating one using the MEXC platform');
188189
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidAddress(this.id + ' fetchDepositAddress() cannot find a deposit address for ' + code + ', and network' + network + 'consider creating one using the MEXC platform');
187199
188190
  }
187200
188191
  return result;
187201
188192
  }
@@ -187367,7 +188358,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
187367
188358
  let network = undefined;
187368
188359
  const rawNetwork = this.safeString(transaction, 'network');
187369
188360
  if (rawNetwork !== undefined) {
187370
- network = this.safeNetwork(rawNetwork);
188361
+ network = this.networkIdToCode(rawNetwork);
187371
188362
  }
187372
188363
  const code = this.safeCurrencyCode(currencyId, currency);
187373
188364
  const status = this.parseTransactionStatusByType(this.safeString(transaction, 'status'), type);
@@ -242912,6 +243903,7 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
242912
243903
  /**
242913
243904
  * @method
242914
243905
  * @name gate#watchTicker
243906
+ * @see https://www.gate.io/docs/developers/apiv4/ws/en/#tickers-channel
242915
243907
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
242916
243908
  * @param {string} symbol unified symbol of the market to fetch the ticker for
242917
243909
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -242920,45 +243912,21 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
242920
243912
  await this.loadMarkets();
242921
243913
  const market = this.market(symbol);
242922
243914
  symbol = market['symbol'];
242923
- const marketId = market['id'];
242924
- const url = this.getUrlByMarket(market);
242925
- const messageType = this.getTypeByMarket(market);
242926
- const [topic, query] = this.handleOptionAndParams(params, 'watchTicker', 'name', 'tickers');
242927
- const channel = messageType + '.' + topic;
242928
- const messageHash = 'ticker:' + symbol;
242929
- const payload = [marketId];
242930
- 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);
242931
243918
  }
242932
243919
  async watchTickers(symbols = undefined, params = {}) {
242933
243920
  /**
242934
243921
  * @method
242935
243922
  * @name gate#watchTickers
243923
+ * @see https://www.gate.io/docs/developers/apiv4/ws/en/#tickers-channel
242936
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
242937
243925
  * @param {string[]} symbols unified symbol of the market to fetch the ticker for
242938
243926
  * @param {object} [params] extra parameters specific to the exchange API endpoint
242939
243927
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
242940
243928
  */
242941
- await this.loadMarkets();
242942
- symbols = this.marketSymbols(symbols);
242943
- if (symbols === undefined) {
242944
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' watchTickers requires symbols');
242945
- }
242946
- const market = this.market(symbols[0]);
242947
- const messageType = this.getTypeByMarket(market);
242948
- const marketIds = this.marketIds(symbols);
242949
- const [topic, query] = this.handleOptionAndParams(params, 'watchTicker', 'method', 'tickers');
242950
- const channel = messageType + '.' + topic;
242951
- const messageHash = 'tickers';
242952
- const url = this.getUrlByMarket(market);
242953
- const ticker = await this.subscribePublic(url, messageHash, marketIds, channel, query);
242954
- let result = {};
242955
- if (this.newUpdates) {
242956
- result[ticker['symbol']] = ticker;
242957
- }
242958
- else {
242959
- result = this.tickers;
242960
- }
242961
- return this.filterByArray(result, 'symbol', symbols, true);
243929
+ return await this.subscribeWatchTickersAndBidsAsks(symbols, 'watchTickers', this.extend({ 'method': 'tickers' }, params));
242962
243930
  }
242963
243931
  handleTicker(client, message) {
242964
243932
  //
@@ -242978,6 +243946,24 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
242978
243946
  // "low_24h": "42721.03"
242979
243947
  // }
242980
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
+ //
242981
243967
  // {
242982
243968
  // "time": 1671363004,
242983
243969
  // "time_ms": 1671363004235,
@@ -242994,24 +243980,63 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
242994
243980
  // }
242995
243981
  // }
242996
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) {
242997
244013
  const channel = this.safeString(message, 'channel');
242998
244014
  const parts = channel.split('.');
242999
244015
  const rawMarketType = this.safeString(parts, 0);
243000
244016
  const marketType = (rawMarketType === 'futures') ? 'contract' : 'spot';
243001
- let result = this.safeValue(message, 'result');
243002
- if (!Array.isArray(result)) {
243003
- result = [result];
244017
+ let results = [];
244018
+ if (marketType === 'contract') {
244019
+ results = this.safeList(message, 'result', []);
243004
244020
  }
243005
- for (let i = 0; i < result.length; i++) {
243006
- const ticker = result[i];
243007
- 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');
243008
244029
  const market = this.safeMarket(marketId, undefined, '_', marketType);
243009
- const parsed = this.parseTicker(ticker, market);
243010
- const symbol = parsed['symbol'];
243011
- this.tickers[symbol] = parsed;
243012
- const messageHash = 'ticker:' + symbol;
243013
- client.resolve(parsed, messageHash);
243014
- 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);
243015
244040
  }
243016
244041
  }
243017
244042
  async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
@@ -243812,7 +244837,7 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
243812
244837
  'orders': this.handleOrder,
243813
244838
  'positions': this.handlePositions,
243814
244839
  'tickers': this.handleTicker,
243815
- 'book_ticker': this.handleTicker,
244840
+ 'book_ticker': this.handleBidAsk,
243816
244841
  'trades': this.handleTrades,
243817
244842
  'order_book_update': this.handleOrderBook,
243818
244843
  'balances': this.handleBalance,
@@ -245242,6 +246267,7 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
245242
246267
  const messageHash = channel + '::' + symbol;
245243
246268
  client.resolve(newTickers, messageHash);
245244
246269
  }
246270
+ client.resolve(newTickers, 'tickers');
245245
246271
  const messageHashes = this.findMessageHashes(client, 'tickers::');
245246
246272
  for (let i = 0; i < messageHashes.length; i++) {
245247
246273
  const messageHash = messageHashes[i];
@@ -271809,12 +272835,12 @@ class probit extends _abstract_probit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
271809
272835
  const currencyId = this.safeString(transaction, 'currency_id');
271810
272836
  const code = this.safeCurrencyCode(currencyId);
271811
272837
  const status = this.parseTransactionStatus(this.safeString(transaction, 'status'));
271812
- const feeCost = this.safeNumber(transaction, 'fee');
272838
+ const feeCostString = this.safeString(transaction, 'fee');
271813
272839
  let fee = undefined;
271814
- if (feeCost !== undefined && feeCost !== 0) {
272840
+ if (feeCostString !== undefined && feeCostString !== '0') {
271815
272841
  fee = {
271816
272842
  'currency': code,
271817
- 'cost': feeCost,
272843
+ 'cost': this.parseNumber(feeCostString),
271818
272844
  };
271819
272845
  }
271820
272846
  return {
@@ -305282,7 +306308,7 @@ SOFTWARE.
305282
306308
 
305283
306309
  //-----------------------------------------------------------------------------
305284
306310
  // this is updated by vss.js when building
305285
- const version = '4.2.43';
306311
+ const version = '4.2.45';
305286
306312
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
305287
306313
  //-----------------------------------------------------------------------------
305288
306314