work on calculations

This commit is contained in:
Bojan Kucera 2025-06-04 18:16:16 -04:00
parent 3d910a13e0
commit ab7ef2b678
20 changed files with 1343 additions and 222 deletions

View file

@ -30,7 +30,7 @@ export function logReturn(initialPrice: number, finalPrice: number): number {
/**
* Calculate compound annual growth rate (CAGR)
*/
export function calculateCAGR(startValue: number, endValue: number, years: number): number {
export function cagr(startValue: number, endValue: number, years: number): number {
if (years <= 0 || startValue <= 0 || endValue <= 0) return 0;
return Math.pow(endValue / startValue, 1 / years) - 1;
}