predictor for interest is k
This commit is contained in:
@@ -20,6 +20,8 @@ func NewInterestPredictor(namePattern string, currencyPattern string, apy float6
|
||||
result[k] = maps.Clone(v)
|
||||
}
|
||||
|
||||
monthsPassed := float64(delta) / float64(time.Hour*24.0*365.0/12.0)
|
||||
scalar := math.Pow(1.0+apy/12.0, monthsPassed)
|
||||
for name := range result {
|
||||
if !nameMatcher.MatchString(name) {
|
||||
continue
|
||||
@@ -28,8 +30,7 @@ func NewInterestPredictor(namePattern string, currencyPattern string, apy float6
|
||||
if !currencyMatcher.MatchString(string(currency)) {
|
||||
continue
|
||||
}
|
||||
percentOfYearPassed := float64(delta) / float64(time.Hour*365)
|
||||
result[name][currency] *= math.Pow(1.0+apy/12.0, percentOfYearPassed)
|
||||
result[name][currency] *= scalar
|
||||
}
|
||||
}
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user