Skip to content

Commit

Permalink
Merge pull request #139 from nguvictor/price-info-percent-change
Browse files Browse the repository at this point in the history
Price info percent change calculation
  • Loading branch information
EvgeniiaVak authored Sep 29, 2023
2 parents a49f31f + d122698 commit fab3d5f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/app/redux/priceInfoSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export const priceInfoSlice = createSlice({
const currentPairInfo = action.payload.currentPairInfo;
state.lastPrice = currentPairInfo.lastPrice;
state.open24h = currentPairInfo.open24h;
state.change24h = currentPairInfo.change24h;
state.change24h =
((currentPairInfo.lastPrice - currentPairInfo.open24h) /
currentPairInfo.open24h) *
100;
state.high24h = currentPairInfo.high24h;
state.low24h = currentPairInfo.low24h;
state.value24h = currentPairInfo.value24h;
Expand Down

0 comments on commit fab3d5f

Please sign in to comment.