@orderly.network/hooks 2.8.9 → 2.8.10-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -38,9 +38,9 @@ var __export = (target, all) => {
38
38
  // src/version.ts
39
39
  if (typeof window !== "undefined") {
40
40
  window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
41
- window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.8.9";
41
+ window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.8.10-alpha.0";
42
42
  }
43
- var version_default = "2.8.9";
43
+ var version_default = "2.8.10-alpha.0";
44
44
  var fetcher = (url, init2 = {}, queryOptions) => get(url, init2, queryOptions?.formatter);
45
45
  var noCacheConfig = {
46
46
  dedupingInterval: 0,
@@ -5443,12 +5443,18 @@ var PositionCalculator = class extends BaseCalculator {
5443
5443
  if (portfolio) {
5444
5444
  const { totalValue, totalCollateral } = portfolio;
5445
5445
  rows = rows.map((item) => {
5446
+ const info = symbolsInfo[item.symbol];
5446
5447
  const est_liq_price = positions.liqPrice({
5448
+ symbol: item.symbol,
5447
5449
  markPrice: item.mark_price,
5448
5450
  totalCollateral: totalCollateral.toNumber(),
5449
5451
  positionQty: item.position_qty,
5450
5452
  positions: rows,
5451
- MMR: item.mmr
5453
+ MMR: item.mmr,
5454
+ baseMMR: info?.["base_mmr"],
5455
+ baseIMR: info?.["base_imr"],
5456
+ IMRFactor: accountInfo.imr_factor[item.symbol],
5457
+ costPosition: item.cost_position
5452
5458
  });
5453
5459
  return {
5454
5460
  ...item,
@@ -6037,9 +6043,22 @@ var useOrderStream = (params, options) => {
6037
6043
  })
6038
6044
  ]);
6039
6045
  }, [normalOrdersResponse.data, algoOrdersResponse.data]);
6040
- const cancelAllPendingOrders = useCallback((symbol2) => {
6041
- doCancelAllOrders(null, { ...symbol2 && { symbol: symbol2 } });
6042
- }, []);
6046
+ const cancelAllPendingOrders = useCallback(
6047
+ (symbol2) => {
6048
+ return Promise.all([
6049
+ doCancelAllOrders(null, { ...symbol2 && { symbol: symbol2 } }),
6050
+ doCancelAllAlgoOrders(null, {
6051
+ algo_type: AlgoOrderRootType.STOP,
6052
+ ...symbol2 && { symbol: symbol2 }
6053
+ }),
6054
+ doCancelAllAlgoOrders(null, {
6055
+ algo_type: AlgoOrderRootType.TRAILING_STOP,
6056
+ ...symbol2 && { symbol: symbol2 }
6057
+ })
6058
+ ]);
6059
+ },
6060
+ [symbol]
6061
+ );
6043
6062
  const cancelPostionOrdersByTypes = useCallback(
6044
6063
  (symbol2, types) => {
6045
6064
  return doCancelAllAlgoOrders(null, {