Skip to content

Commit

Permalink
calculateDiff is migrated. The old implementation is calculateOldPrices
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitardanailov committed May 29, 2024
1 parent 030045a commit b618b6a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions apps/website/src/utils/historic/calculateDiff.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const calculateHistoricDiff = (currentPrice: number, percent: number) => {
let indexChange = Math.abs(percent) / 100
const dif = currentPrice * indexChange
const sign = Math.sign(percent) * -1

return currentPrice + sign * dif
}

export default calculateHistoricDiff

0 comments on commit b618b6a

Please sign in to comment.