export existing contribution predictor
parent
04a79add26
commit
7e7488af2e
|
|
@ -44,10 +44,10 @@ func NewInterestPredictor(namePattern string, currencyPattern string, apy float6
|
||||||
|
|
||||||
func NewAutoContributionPredictor(reg ledger.Register) Predictor {
|
func NewAutoContributionPredictor(reg ledger.Register) Predictor {
|
||||||
monthlyRate := getMonthlyAutoContributionRates(reg)
|
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 {
|
return func(given ledger.Balances, delta time.Duration) ledger.Balances {
|
||||||
months := float64(delta) / float64(month)
|
months := float64(delta) / float64(month)
|
||||||
result := make(ledger.Balances)
|
result := make(ledger.Balances)
|
||||||
|
|
|
||||||
|
|
@ -98,10 +98,10 @@ func TestGetMonthlyAutoContributionRate(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNewAutoContributionPredictor(t *testing.T) {
|
func TestNewContributionPredictor(t *testing.T) {
|
||||||
name := "x"
|
name := "x"
|
||||||
currency := ledger.USD
|
currency := ledger.USD
|
||||||
predictor := newAutoContributionPredictor(map[string]ledger.Balance{
|
predictor := NewContributionPredictor(map[string]ledger.Balance{
|
||||||
name: {currency: 10},
|
name: {currency: 10},
|
||||||
"y": {"XYZ": 3},
|
"y": {"XYZ": 3},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue