Skip to content

Commit

Permalink
Hotfix/price change usd (#1121)
Browse files Browse the repository at this point in the history
* fix: correct price change calculation in getPriceUsdChange function

* fix: update getPriceUsdChange function to handle startValue correctly
  • Loading branch information
trungbach authored Jan 7, 2025
1 parent 7f0b690 commit 439f2d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pages/UniversalSwap/hooks/useChartUsdPrice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,6 @@ export const getDataPriceMarket = async (tokenDenom: string, type: FILTER_TIME_C
};

export const getPriceUsdChange = (startValue: number, endValue: number) => {
if (!endValue) return '0.00';
return toFixedIfNecessary((((endValue - startValue) / endValue) * 100).toString(), 2);
if (!startValue) return '0.00';
return toFixedIfNecessary((((endValue - startValue) / startValue) * 100).toString(), 2);
};

0 comments on commit 439f2d3

Please sign in to comment.