@orderly.network/markets 2.9.1-alpha.0 → 2.10.0-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.js CHANGED
@@ -4142,6 +4142,23 @@ var init_column4 = __esm({
4142
4142
  )
4143
4143
  ] });
4144
4144
  }
4145
+ },
4146
+ {
4147
+ title: t("markets.openInterest"),
4148
+ dataIndex: "openInterest",
4149
+ align: "right",
4150
+ onSort: true,
4151
+ width: 80,
4152
+ render: (value) => /* @__PURE__ */ jsxRuntime.jsx(
4153
+ ui.Text.numeral,
4154
+ {
4155
+ rule: "human",
4156
+ dp: 2,
4157
+ rm: utils.Decimal.ROUND_DOWN,
4158
+ size: "2xs",
4159
+ children: value
4160
+ }
4161
+ )
4145
4162
  }
4146
4163
  ];
4147
4164
  },
@@ -5222,25 +5239,17 @@ init_useFavoritesExtraProps();
5222
5239
  // src/components/marketsSheet/column.tsx
5223
5240
  init_icons();
5224
5241
  init_favoritesDropdownMenu();
5242
+ init_rwaDotTooltip();
5225
5243
  init_symbolDisplay();
5226
5244
  var getMarketsSheetColumns = (favorite, isFavoriteList = false) => {
5227
5245
  return [
5228
5246
  {
5229
- title: `${i18n.i18n.t("markets.column.market")} / ${i18n.i18n.t("common.volume")}`,
5230
- dataIndex: "24h_amount",
5231
- multiSort: {
5232
- fields: [
5233
- {
5234
- sortKey: "symbol",
5235
- label: i18n.i18n.t("markets.column.market")
5236
- },
5237
- {
5238
- sortKey: "24h_amount",
5239
- label: i18n.i18n.t("common.volume")
5240
- }
5241
- ]
5242
- },
5247
+ title: i18n.i18n.t("common.symbol"),
5248
+ dataIndex: "symbol",
5249
+ align: "left",
5250
+ onSort: true,
5243
5251
  className: "oui-h-[36px]",
5252
+ width: 124,
5244
5253
  render: (value, record) => {
5245
5254
  let favoritesIcon;
5246
5255
  if (!isFavoriteList) {
@@ -5262,31 +5271,56 @@ var getMarketsSheetColumns = (favorite, isFavoriteList = false) => {
5262
5271
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gapX: 1, children: [
5263
5272
  /* @__PURE__ */ jsxRuntime.jsx(ui.TokenIcon, { symbol: record.symbol, className: "oui-size-[18px]" }),
5264
5273
  /* @__PURE__ */ jsxRuntime.jsx(exports.SymbolDisplay, { formatString: "base", size: "2xs", children: record.symbol }),
5265
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Badge, { size: "xs", color: "primary", children: [
5266
- record.leverage,
5267
- "x"
5268
- ] })
5274
+ /* @__PURE__ */ jsxRuntime.jsx(RwaDotTooltip, { record })
5269
5275
  ] }),
5270
- /* @__PURE__ */ jsxRuntime.jsx(
5271
- ui.Text.numeral,
5272
- {
5273
- intensity: 54,
5274
- rule: "human",
5275
- dp: 2,
5276
- rm: utils.Decimal.ROUND_DOWN,
5277
- children: value
5278
- }
5279
- )
5276
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Badge, { size: "xs", color: "primary", children: [
5277
+ record.leverage,
5278
+ "x"
5279
+ ] })
5280
5280
  ] })
5281
5281
  ] });
5282
5282
  }
5283
5283
  },
5284
5284
  {
5285
- title: i18n.i18n.t("markets.column.price&Change"),
5285
+ title: i18n.i18n.t("markets.column.24hVolOI"),
5286
+ dataIndex: "24h_amount",
5287
+ align: "right",
5288
+ className: "oui-h-[36px]",
5289
+ width: 100,
5290
+ multiSort: {
5291
+ fields: [
5292
+ {
5293
+ sortKey: "24h_amount",
5294
+ label: i18n.i18n.t("markets.column.24hVol")
5295
+ },
5296
+ {
5297
+ sortKey: "openInterest",
5298
+ label: i18n.i18n.t("markets.column.OI")
5299
+ }
5300
+ ]
5301
+ },
5302
+ render: (value, record) => /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", itemAlign: "end", gapY: 1, children: [
5303
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text.numeral, { rule: "human", dp: 2, rm: utils.Decimal.ROUND_DOWN, children: value }),
5304
+ /* @__PURE__ */ jsxRuntime.jsx(
5305
+ ui.Text.numeral,
5306
+ {
5307
+ rule: "human",
5308
+ dp: 2,
5309
+ rm: utils.Decimal.ROUND_DOWN,
5310
+ size: "2xs",
5311
+ intensity: 54,
5312
+ children: record.openInterest
5313
+ }
5314
+ )
5315
+ ] })
5316
+ },
5317
+ {
5318
+ title: i18n.i18n.t("markets.column.last&24hPercentage"),
5286
5319
  dataIndex: "change",
5287
5320
  align: "right",
5288
5321
  onSort: true,
5289
5322
  className: "oui-h-[36px]",
5323
+ width: 100,
5290
5324
  render: (value, record) => {
5291
5325
  const onDelSymbol = (e) => {
5292
5326
  favorite.updateSymbolFavoriteState(
@@ -5708,10 +5742,9 @@ var FundingRateHint = (props) => {
5708
5742
  capFunding,
5709
5743
  floorFunding,
5710
5744
  lastFundingRate,
5711
- estFundingRate,
5712
5745
  estFundingFee,
5713
5746
  lastFundingRateAnnualized,
5714
- estFundingRateAnnualized
5747
+ estFundingRateByTimeframe
5715
5748
  } = props;
5716
5749
  const renderRow = (label, value, annualizedValue) => {
5717
5750
  if (!value) {
@@ -5740,19 +5773,35 @@ var FundingRateHint = (props) => {
5740
5773
  lastFundingRate,
5741
5774
  lastFundingRateAnnualized
5742
5775
  ),
5743
- renderRow(
5744
- t("trading.fundingRate.estimatedFundingRate"),
5745
- estFundingRate,
5746
- estFundingRateAnnualized
5776
+ estFundingRateByTimeframe.map(
5777
+ ({ timeframe, value }) => renderRow(
5778
+ t("trading.fundingRate.estFundingRateWithTimeframe", {
5779
+ timeframe
5780
+ }),
5781
+ value
5782
+ )
5747
5783
  ),
5748
5784
  renderRow(t("trading.fundingRate.estimatedFundingFee"), estFundingFee),
5749
5785
  /* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { className: "oui-w-full", intensity: 8 }),
5750
5786
  t("markets.symbolInfoBar.predFundingRate.tooltip")
5751
5787
  ] });
5752
5788
  };
5789
+ var TIMEFRAME_CONFIG = [
5790
+ { key: "1H", hours: 1 },
5791
+ { key: "4H", hours: 4 },
5792
+ { key: "1D", hours: 24 },
5793
+ { key: "7D", hours: 168 },
5794
+ { key: "30D", hours: 720 },
5795
+ { key: "1Y", hours: 8760 }
5796
+ ];
5753
5797
  var useFundingRateHintScript = (symbol) => {
5754
5798
  const { data: fundingDetails, isLoading: isFundingLoading } = hooks.useFundingDetails(symbol);
5755
- const { last_funding_rate, est_funding_rate } = hooks.useFundingRateBySymbol(symbol) ?? {};
5799
+ const {
5800
+ last_funding_rate,
5801
+ est_funding_rate,
5802
+ next_funding_time,
5803
+ last_funding_rate_timestamp
5804
+ } = hooks.useFundingRateBySymbol(symbol) ?? {};
5756
5805
  const [{ aggregated, rows }] = hooks.usePositionStream(symbol);
5757
5806
  const { notional } = aggregated ?? {};
5758
5807
  const fundingPeriod = React6.useMemo(() => {
@@ -5779,12 +5828,6 @@ var useFundingRateHintScript = (symbol) => {
5779
5828
  }
5780
5829
  return `${new utils.Decimal(last_funding_rate).mul(100).toNumber()}%`;
5781
5830
  }, [last_funding_rate]);
5782
- const estFundingRate = React6.useMemo(() => {
5783
- if (!est_funding_rate) {
5784
- return void 0;
5785
- }
5786
- return `${new utils.Decimal(est_funding_rate).mul(100).toNumber()}%`;
5787
- }, [est_funding_rate]);
5788
5831
  const estFundingFee = React6.useMemo(() => {
5789
5832
  if (!est_funding_rate || !notional || rows.length === 0) {
5790
5833
  return "--";
@@ -5807,37 +5850,40 @@ var useFundingRateHintScript = (symbol) => {
5807
5850
  );
5808
5851
  return annualized ? `${annualized}%` : void 0;
5809
5852
  }, [last_funding_rate, fundingDetails?.funding_period]);
5810
- const estFundingRateAnnualized = React6.useMemo(() => {
5811
- if (!est_funding_rate || !fundingDetails?.funding_period) {
5812
- return void 0;
5853
+ const settlementIntervalHours = React6.useMemo(() => {
5854
+ if (!next_funding_time || !last_funding_rate_timestamp) return 8;
5855
+ const diff = next_funding_time - last_funding_rate_timestamp;
5856
+ return diff / 36e5;
5857
+ }, [next_funding_time, last_funding_rate_timestamp]);
5858
+ const estFundingRateByTimeframe = React6.useMemo(() => {
5859
+ if (est_funding_rate === void 0 || est_funding_rate === null || settlementIntervalHours <= 0) {
5860
+ return [];
5813
5861
  }
5814
- const rate = new utils.Decimal(est_funding_rate).mul(100).toNumber();
5815
- const annualized = calculateAnnualizedRate(
5816
- rate,
5817
- fundingDetails.funding_period
5818
- );
5819
- return annualized ? `${annualized}%` : void 0;
5820
- }, [est_funding_rate, fundingDetails?.funding_period]);
5862
+ return TIMEFRAME_CONFIG.map(({ key, hours }) => {
5863
+ const rate = new utils.Decimal(est_funding_rate).mul(hours).div(settlementIntervalHours).mul(100);
5864
+ const str = rate.toFixed(5);
5865
+ const trimmed = str.replace(/\.?0+$/, "") || "0";
5866
+ return { timeframe: key, value: `${trimmed}%` };
5867
+ });
5868
+ }, [est_funding_rate, settlementIntervalHours]);
5821
5869
  return React6.useMemo(() => {
5822
5870
  return {
5823
5871
  fundingPeriod,
5824
5872
  capFunding,
5825
5873
  floorFunding,
5826
5874
  lastFundingRate,
5827
- estFundingRate,
5828
5875
  estFundingFee,
5829
5876
  lastFundingRateAnnualized,
5830
- estFundingRateAnnualized
5877
+ estFundingRateByTimeframe
5831
5878
  };
5832
5879
  }, [
5833
5880
  fundingPeriod,
5834
5881
  capFunding,
5835
5882
  floorFunding,
5836
5883
  lastFundingRate,
5837
- estFundingRate,
5838
5884
  estFundingFee,
5839
5885
  lastFundingRateAnnualized,
5840
- estFundingRateAnnualized,
5886
+ estFundingRateByTimeframe,
5841
5887
  symbol
5842
5888
  ]);
5843
5889
  };
@@ -5909,7 +5955,7 @@ var SymbolInfoBarFull = (props) => {
5909
5955
  /* @__PURE__ */ jsxRuntime.jsx(
5910
5956
  LazyDropDownMarketsWidget,
5911
5957
  {
5912
- contentClassName: "oui-w-[429px] oui-h-[496px]",
5958
+ contentClassName: "oui-w-[580px] oui-h-[496px]",
5913
5959
  symbol: props.symbol,
5914
5960
  onSymbolChange: props.onSymbolChange,
5915
5961
  children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gapX: 1, className: "oui-cursor-pointer", children: [
@@ -5992,7 +6038,14 @@ var SymbolInfoBarFull = (props) => {
5992
6038
  intensity: 8
5993
6039
  }
5994
6040
  ),
5995
- price,
6041
+ /* @__PURE__ */ jsxRuntime.jsx(
6042
+ ui.Tooltip,
6043
+ {
6044
+ content: t("markets.symbolInfoBar.lastPrice.tooltip"),
6045
+ className: "oui-max-w-[240px]",
6046
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "oui-cursor-pointer oui-border-b oui-border-dashed oui-border-line-12 oui-inline-block", children: price })
6047
+ }
6048
+ ),
5996
6049
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-relative oui-h-full oui-overflow-hidden", children: [
5997
6050
  /* @__PURE__ */ jsxRuntime.jsx(
5998
6051
  "div",