auto contributions only if at least 4 (3 deltas) in 6 months

This commit is contained in:
Bel LaPointe
2023-10-27 19:05:59 -06:00
parent 6d97ce773b
commit 6f8d049a08
2 changed files with 5 additions and 1 deletions

View File

@@ -99,6 +99,9 @@ func getMonthlyAutoContributionRateForCurrency(contributions []ledger.Balance, w
} }
} }
slices.Sort(values) slices.Sort(values)
if len(values) < 3 {
return 0
}
start := int(len(values) / 4) start := int(len(values) / 4)
end := min(1+max(0, len(values)-len(values)/4), len(values)) end := min(1+max(0, len(values)-len(values)/4), len(values))

View File

@@ -1,5 +1,4 @@
todo: todo:
- require at least N contributions in N months before autoContributions!=0
- ?prediction=contributions=x y z&prediction=contribution=x y z - ?prediction=contributions=x y z&prediction=contribution=x y z
- ana/predictor for bpi or de-legacy - ana/predictor for bpi or de-legacy
- predictWhatIf=2023-10=AssetAccount:Cash=$=-7000 changes too much when removing 7k - predictWhatIf=2023-10=AssetAccount:Cash=$=-7000 changes too much when removing 7k
@@ -61,3 +60,5 @@ done:
ts: Fri Oct 27 18:49:37 MDT 2023 ts: Fri Oct 27 18:49:37 MDT 2023
- todo: ana/legacy_* drop - todo: ana/legacy_* drop
ts: Fri Oct 27 18:50:08 MDT 2023 ts: Fri Oct 27 18:50:08 MDT 2023
- todo: require at least N contributions in N months before autoContributions!=0
ts: Fri Oct 27 19:05:40 MDT 2023