This commit is contained in:
Bel LaPointe
2023-10-26 18:18:38 -06:00
parent e511da2e70
commit 596c20d76c
2 changed files with 46 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ package ana
import (
"maps"
"math"
"regexp"
"time"
@@ -27,7 +28,8 @@ func NewInterestPredictor(namePattern string, currencyPattern string, apy float6
if !currencyMatcher.MatchString(string(currency)) {
continue
}
result[name][currency] *= 1.0 + apy/12.0
percentOfYearPassed := float64(delta) / float64(time.Hour*365)
result[name][currency] *= math.Pow(1.0+apy/12.0, percentOfYearPassed)
}
}
return result