export existing contribution predictor

main
Bel LaPointe 2023-10-27 19:28:48 -06:00
parent 04a79add26
commit 7e7488af2e
2 changed files with 4 additions and 4 deletions

View File

@ -44,10 +44,10 @@ func NewInterestPredictor(namePattern string, currencyPattern string, apy float6
func NewAutoContributionPredictor(reg ledger.Register) Predictor {
monthlyRate := getMonthlyAutoContributionRates(reg)
return newAutoContributionPredictor(monthlyRate)
return NewContributionPredictor(monthlyRate)
}
func newAutoContributionPredictor(monthlyRate map[string]ledger.Balance) Predictor {
func NewContributionPredictor(monthlyRate ledger.Balances) Predictor {
return func(given ledger.Balances, delta time.Duration) ledger.Balances {
months := float64(delta) / float64(month)
result := make(ledger.Balances)

View File

@ -98,10 +98,10 @@ func TestGetMonthlyAutoContributionRate(t *testing.T) {
}
}
func TestNewAutoContributionPredictor(t *testing.T) {
func TestNewContributionPredictor(t *testing.T) {
name := "x"
currency := ledger.USD
predictor := newAutoContributionPredictor(map[string]ledger.Balance{
predictor := NewContributionPredictor(map[string]ledger.Balance{
name: {currency: 10},
"y": {"XYZ": 3},
})