Created
May 10, 2024 10:11
-
-
Save vnegi10/0081084361d09e5044928c00db8dcbae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function getPertChange(breakdown, num_days) { | |
const change = (breakdown[breakdown.length - 1].value - | |
breakdown[breakdown.length - 1 - num_days].value) | |
/ breakdown[breakdown.length - 1- num_days].value | |
// Change % | |
const pert_change = change * 100; | |
// Round off to first digit after decimal | |
return Math.round(pert_change * 10) / 10 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment