Skip to content

Commit

Permalink
Update market price calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
SorinC6 committed Dec 17, 2024
1 parent c0d90c0 commit 1ae421f
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,12 @@ export const TokenMarketPriceOverview = ({ chartData, detailInfo, tokenInfo, isD
tokenActivity: { data24h },
} = usePortfolioTokenActivity();

const deltaPriceChange =
!isPrimaryToken &&
!isEmpty(data24h) &&
data24h[tokenInfo?.info?.id][1].price?.close - data24h[tokenInfo?.info?.id][1].price?.open;
const deltaPriceChange = !isPrimaryToken && !isEmpty(data24h) && data24h[tokenInfo?.info?.id][1].price?.change;

const priceChangeProcent = isPrimaryToken ? detailInfo?.changePercent || changePercent : !isEmpty(data24h) && deltaPriceChange;
const priceChangeValue = isPrimaryToken
? detailInfo?.changeValue || changeValue
: !isEmpty(data24h) && data24h[tokenInfo?.info?.id][1].price?.close;
: !isEmpty(data24h) && data24h[tokenInfo?.info?.id][1].price?.close - data24h[tokenInfo?.info?.id][1].price?.open;
return (
<Stack
direction="row"
Expand Down

0 comments on commit 1ae421f

Please sign in to comment.