Skip to content

Commit

Permalink
Display latest price from pool instead of historical price data (#3275)
Browse files Browse the repository at this point in the history
* 10s

* Revert "10s"

This reverts commit a8bc9f5.

* CL liquidity historical chart: get latest price from pool

* remove log
  • Loading branch information
jonator authored May 23, 2024
1 parent 86d806f commit 5f3df1e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
14 changes: 11 additions & 3 deletions packages/web/components/cards/my-position/expanded.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,14 @@ const Chart: FunctionComponent<{
config: ObservableHistoricalAndLiquidityData;
position: UserPosition;
}> = observer(({ config, position: { isFullRange } }) => {
const { historicalChartData, yRange, setHoverPrice, lastChartData, range } =
config;
const {
historicalChartData,
yRange,
setHoverPrice,
lastChartData,
range,
currentPrice,
} = config;

return (
<HistoricalPriceChart
Expand All @@ -551,7 +557,9 @@ const Chart: FunctionComponent<{
domain={yRange}
onPointerHover={(price) => setHoverPrice(price)}
onPointerOut={
lastChartData ? () => setHoverPrice(lastChartData.close) : undefined
lastChartData
? () => setHoverPrice(Number(currentPrice.toString()))
: undefined
}
/>
);
Expand Down
10 changes: 8 additions & 2 deletions packages/web/components/pool-detail/concentrated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,13 @@ const ChartHeader: FunctionComponent<{
const Chart: FunctionComponent<{
config: ObservableHistoricalAndLiquidityData;
}> = observer(({ config }) => {
const { historicalChartData, yRange, setHoverPrice, lastChartData } = config;
const {
historicalChartData,
yRange,
setHoverPrice,
lastChartData,
currentPrice,
} = config;

return (
<HistoricalPriceChart
Expand All @@ -432,7 +438,7 @@ const Chart: FunctionComponent<{
onPointerHover={setHoverPrice}
onPointerOut={() => {
if (lastChartData) {
setHoverPrice(Number(lastChartData.close));
setHoverPrice(Number(currentPrice.toString()));
}
}}
/>
Expand Down

0 comments on commit 5f3df1e

Please sign in to comment.