@orderly.network/markets 2.9.1 → 2.10.0-alpha.1

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
@@ -4136,6 +4136,23 @@ var init_column4 = __esm({
4136
4136
  )
4137
4137
  ] });
4138
4138
  }
4139
+ },
4140
+ {
4141
+ title: t("markets.openInterest"),
4142
+ dataIndex: "openInterest",
4143
+ align: "right",
4144
+ onSort: true,
4145
+ width: 80,
4146
+ render: (value) => /* @__PURE__ */ jsx(
4147
+ Text.numeral,
4148
+ {
4149
+ rule: "human",
4150
+ dp: 2,
4151
+ rm: Decimal.ROUND_DOWN,
4152
+ size: "2xs",
4153
+ children: value
4154
+ }
4155
+ )
4139
4156
  }
4140
4157
  ];
4141
4158
  },
@@ -5216,25 +5233,17 @@ init_useFavoritesExtraProps();
5216
5233
  // src/components/marketsSheet/column.tsx
5217
5234
  init_icons();
5218
5235
  init_favoritesDropdownMenu();
5236
+ init_rwaDotTooltip();
5219
5237
  init_symbolDisplay();
5220
5238
  var getMarketsSheetColumns = (favorite, isFavoriteList = false) => {
5221
5239
  return [
5222
5240
  {
5223
- title: `${i18n.t("markets.column.market")} / ${i18n.t("common.volume")}`,
5224
- dataIndex: "24h_amount",
5225
- multiSort: {
5226
- fields: [
5227
- {
5228
- sortKey: "symbol",
5229
- label: i18n.t("markets.column.market")
5230
- },
5231
- {
5232
- sortKey: "24h_amount",
5233
- label: i18n.t("common.volume")
5234
- }
5235
- ]
5236
- },
5241
+ title: i18n.t("common.symbol"),
5242
+ dataIndex: "symbol",
5243
+ align: "left",
5244
+ onSort: true,
5237
5245
  className: "oui-h-[36px]",
5246
+ width: 124,
5238
5247
  render: (value, record) => {
5239
5248
  let favoritesIcon;
5240
5249
  if (!isFavoriteList) {
@@ -5256,31 +5265,56 @@ var getMarketsSheetColumns = (favorite, isFavoriteList = false) => {
5256
5265
  /* @__PURE__ */ jsxs(Flex, { gapX: 1, children: [
5257
5266
  /* @__PURE__ */ jsx(TokenIcon, { symbol: record.symbol, className: "oui-size-[18px]" }),
5258
5267
  /* @__PURE__ */ jsx(SymbolDisplay, { formatString: "base", size: "2xs", children: record.symbol }),
5259
- /* @__PURE__ */ jsxs(Badge, { size: "xs", color: "primary", children: [
5260
- record.leverage,
5261
- "x"
5262
- ] })
5268
+ /* @__PURE__ */ jsx(RwaDotTooltip, { record })
5263
5269
  ] }),
5264
- /* @__PURE__ */ jsx(
5265
- Text.numeral,
5266
- {
5267
- intensity: 54,
5268
- rule: "human",
5269
- dp: 2,
5270
- rm: Decimal.ROUND_DOWN,
5271
- children: value
5272
- }
5273
- )
5270
+ /* @__PURE__ */ jsxs(Badge, { size: "xs", color: "primary", children: [
5271
+ record.leverage,
5272
+ "x"
5273
+ ] })
5274
5274
  ] })
5275
5275
  ] });
5276
5276
  }
5277
5277
  },
5278
5278
  {
5279
- title: i18n.t("markets.column.price&Change"),
5279
+ title: i18n.t("markets.column.24hVolOI"),
5280
+ dataIndex: "24h_amount",
5281
+ align: "right",
5282
+ className: "oui-h-[36px]",
5283
+ width: 100,
5284
+ multiSort: {
5285
+ fields: [
5286
+ {
5287
+ sortKey: "24h_amount",
5288
+ label: i18n.t("markets.column.24hVol")
5289
+ },
5290
+ {
5291
+ sortKey: "openInterest",
5292
+ label: i18n.t("markets.column.OI")
5293
+ }
5294
+ ]
5295
+ },
5296
+ render: (value, record) => /* @__PURE__ */ jsxs(Flex, { direction: "column", itemAlign: "end", gapY: 1, children: [
5297
+ /* @__PURE__ */ jsx(Text.numeral, { rule: "human", dp: 2, rm: Decimal.ROUND_DOWN, children: value }),
5298
+ /* @__PURE__ */ jsx(
5299
+ Text.numeral,
5300
+ {
5301
+ rule: "human",
5302
+ dp: 2,
5303
+ rm: Decimal.ROUND_DOWN,
5304
+ size: "2xs",
5305
+ intensity: 54,
5306
+ children: record.openInterest
5307
+ }
5308
+ )
5309
+ ] })
5310
+ },
5311
+ {
5312
+ title: i18n.t("markets.column.last&24hPercentage"),
5280
5313
  dataIndex: "change",
5281
5314
  align: "right",
5282
5315
  onSort: true,
5283
5316
  className: "oui-h-[36px]",
5317
+ width: 100,
5284
5318
  render: (value, record) => {
5285
5319
  const onDelSymbol = (e) => {
5286
5320
  favorite.updateSymbolFavoriteState(
@@ -5702,10 +5736,9 @@ var FundingRateHint = (props) => {
5702
5736
  capFunding,
5703
5737
  floorFunding,
5704
5738
  lastFundingRate,
5705
- estFundingRate,
5706
5739
  estFundingFee,
5707
5740
  lastFundingRateAnnualized,
5708
- estFundingRateAnnualized
5741
+ estFundingRateByTimeframe
5709
5742
  } = props;
5710
5743
  const renderRow = (label, value, annualizedValue) => {
5711
5744
  if (!value) {
@@ -5734,19 +5767,35 @@ var FundingRateHint = (props) => {
5734
5767
  lastFundingRate,
5735
5768
  lastFundingRateAnnualized
5736
5769
  ),
5737
- renderRow(
5738
- t("trading.fundingRate.estimatedFundingRate"),
5739
- estFundingRate,
5740
- estFundingRateAnnualized
5770
+ estFundingRateByTimeframe.map(
5771
+ ({ timeframe, value }) => renderRow(
5772
+ t("trading.fundingRate.estFundingRateWithTimeframe", {
5773
+ timeframe
5774
+ }),
5775
+ value
5776
+ )
5741
5777
  ),
5742
5778
  renderRow(t("trading.fundingRate.estimatedFundingFee"), estFundingFee),
5743
5779
  /* @__PURE__ */ jsx(Divider, { className: "oui-w-full", intensity: 8 }),
5744
5780
  t("markets.symbolInfoBar.predFundingRate.tooltip")
5745
5781
  ] });
5746
5782
  };
5783
+ var TIMEFRAME_CONFIG = [
5784
+ { key: "1H", hours: 1 },
5785
+ { key: "4H", hours: 4 },
5786
+ { key: "1D", hours: 24 },
5787
+ { key: "7D", hours: 168 },
5788
+ { key: "30D", hours: 720 },
5789
+ { key: "1Y", hours: 8760 }
5790
+ ];
5747
5791
  var useFundingRateHintScript = (symbol) => {
5748
5792
  const { data: fundingDetails, isLoading: isFundingLoading } = useFundingDetails(symbol);
5749
- const { last_funding_rate, est_funding_rate } = useFundingRateBySymbol(symbol) ?? {};
5793
+ const {
5794
+ last_funding_rate,
5795
+ est_funding_rate,
5796
+ next_funding_time,
5797
+ last_funding_rate_timestamp
5798
+ } = useFundingRateBySymbol(symbol) ?? {};
5750
5799
  const [{ aggregated, rows }] = usePositionStream(symbol);
5751
5800
  const { notional } = aggregated ?? {};
5752
5801
  const fundingPeriod = useMemo(() => {
@@ -5773,12 +5822,6 @@ var useFundingRateHintScript = (symbol) => {
5773
5822
  }
5774
5823
  return `${new Decimal(last_funding_rate).mul(100).toNumber()}%`;
5775
5824
  }, [last_funding_rate]);
5776
- const estFundingRate = useMemo(() => {
5777
- if (!est_funding_rate) {
5778
- return void 0;
5779
- }
5780
- return `${new Decimal(est_funding_rate).mul(100).toNumber()}%`;
5781
- }, [est_funding_rate]);
5782
5825
  const estFundingFee = useMemo(() => {
5783
5826
  if (!est_funding_rate || !notional || rows.length === 0) {
5784
5827
  return "--";
@@ -5801,37 +5844,40 @@ var useFundingRateHintScript = (symbol) => {
5801
5844
  );
5802
5845
  return annualized ? `${annualized}%` : void 0;
5803
5846
  }, [last_funding_rate, fundingDetails?.funding_period]);
5804
- const estFundingRateAnnualized = useMemo(() => {
5805
- if (!est_funding_rate || !fundingDetails?.funding_period) {
5806
- return void 0;
5847
+ const settlementIntervalHours = useMemo(() => {
5848
+ if (!next_funding_time || !last_funding_rate_timestamp) return 8;
5849
+ const diff = next_funding_time - last_funding_rate_timestamp;
5850
+ return diff / 36e5;
5851
+ }, [next_funding_time, last_funding_rate_timestamp]);
5852
+ const estFundingRateByTimeframe = useMemo(() => {
5853
+ if (est_funding_rate === void 0 || est_funding_rate === null || settlementIntervalHours <= 0) {
5854
+ return [];
5807
5855
  }
5808
- const rate = new Decimal(est_funding_rate).mul(100).toNumber();
5809
- const annualized = calculateAnnualizedRate(
5810
- rate,
5811
- fundingDetails.funding_period
5812
- );
5813
- return annualized ? `${annualized}%` : void 0;
5814
- }, [est_funding_rate, fundingDetails?.funding_period]);
5856
+ return TIMEFRAME_CONFIG.map(({ key, hours }) => {
5857
+ const rate = new Decimal(est_funding_rate).mul(hours).div(settlementIntervalHours).mul(100);
5858
+ const str = rate.toFixed(5);
5859
+ const trimmed = str.replace(/\.?0+$/, "") || "0";
5860
+ return { timeframe: key, value: `${trimmed}%` };
5861
+ });
5862
+ }, [est_funding_rate, settlementIntervalHours]);
5815
5863
  return useMemo(() => {
5816
5864
  return {
5817
5865
  fundingPeriod,
5818
5866
  capFunding,
5819
5867
  floorFunding,
5820
5868
  lastFundingRate,
5821
- estFundingRate,
5822
5869
  estFundingFee,
5823
5870
  lastFundingRateAnnualized,
5824
- estFundingRateAnnualized
5871
+ estFundingRateByTimeframe
5825
5872
  };
5826
5873
  }, [
5827
5874
  fundingPeriod,
5828
5875
  capFunding,
5829
5876
  floorFunding,
5830
5877
  lastFundingRate,
5831
- estFundingRate,
5832
5878
  estFundingFee,
5833
5879
  lastFundingRateAnnualized,
5834
- estFundingRateAnnualized,
5880
+ estFundingRateByTimeframe,
5835
5881
  symbol
5836
5882
  ]);
5837
5883
  };
@@ -5903,7 +5949,7 @@ var SymbolInfoBarFull = (props) => {
5903
5949
  /* @__PURE__ */ jsx(
5904
5950
  LazyDropDownMarketsWidget,
5905
5951
  {
5906
- contentClassName: "oui-w-[429px] oui-h-[496px]",
5952
+ contentClassName: "oui-w-[580px] oui-h-[496px]",
5907
5953
  symbol: props.symbol,
5908
5954
  onSymbolChange: props.onSymbolChange,
5909
5955
  children: /* @__PURE__ */ jsxs(Flex, { gapX: 1, className: "oui-cursor-pointer", children: [
@@ -5986,7 +6032,14 @@ var SymbolInfoBarFull = (props) => {
5986
6032
  intensity: 8
5987
6033
  }
5988
6034
  ),
5989
- price,
6035
+ /* @__PURE__ */ jsx(
6036
+ Tooltip,
6037
+ {
6038
+ content: t("markets.symbolInfoBar.lastPrice.tooltip"),
6039
+ className: "oui-max-w-[240px]",
6040
+ children: /* @__PURE__ */ jsx("span", { className: "oui-cursor-pointer oui-border-b oui-border-dashed oui-border-line-12 oui-inline-block", children: price })
6041
+ }
6042
+ ),
5990
6043
  /* @__PURE__ */ jsxs("div", { className: "oui-relative oui-h-full oui-overflow-hidden", children: [
5991
6044
  /* @__PURE__ */ jsx(
5992
6045
  "div",