?whatIf
This commit is contained in:
@@ -73,6 +73,11 @@
|
||||
<input name="predictFixedGrowth" type="text" value="VBTLX=0.02&predictFixedGrowth=GLD=0.02&predictFixedGrowth=FXAIX=0.03&predictFixedGrowth=FSPSX=0.03"/>
|
||||
</span>
|
||||
|
||||
<span>
|
||||
<label for="whatIf">whatIf</label>
|
||||
<input name="whatIf" type="text" value="AssetAccount:Cash $ -1.00"/>
|
||||
</span>
|
||||
|
||||
<span>
|
||||
<input type="submit"/>
|
||||
</span>
|
||||
|
||||
@@ -93,11 +93,31 @@ func main() {
|
||||
foolike = like
|
||||
}
|
||||
|
||||
register := deltas.Like(foolike...).Register()
|
||||
deltas := deltas.Like(foolike...)
|
||||
|
||||
// MODIFIERS
|
||||
for i, whatIf := range r.URL.Query()["whatIf"] {
|
||||
fields := strings.Fields(whatIf)
|
||||
date := "2001-01"
|
||||
name := fields[0]
|
||||
currency := ledger.Currency(fields[1])
|
||||
value, err := strconv.ParseFloat(fields[2], 64)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
deltas = append(deltas, ledger.Delta{
|
||||
Date: date,
|
||||
Name: name,
|
||||
Value: value,
|
||||
Currency: currency,
|
||||
Description: fmt.Sprintf("?whatIf[%d]", i),
|
||||
})
|
||||
}
|
||||
|
||||
register := deltas.Register()
|
||||
predicted := make(ledger.Register)
|
||||
bpis := maps.Clone(bpis)
|
||||
|
||||
// MODIFIERS
|
||||
if predictionMonths, err := strconv.ParseInt(r.URL.Query().Get("predictionMonths"), 10, 16); err == nil && predictionMonths > 0 {
|
||||
window := time.Hour * 24.0 * 365.0 / 12.0 * time.Duration(predictionMonths)
|
||||
// TODO whatif
|
||||
|
||||
Reference in New Issue
Block a user