maybe
This commit is contained in:
@@ -86,6 +86,26 @@ func main() {
|
|||||||
window := time.Hour * 24.0 * 365.0 / 12.0 * time.Duration(predictionMonths)
|
window := time.Hour * 24.0 * 365.0 / 12.0 * time.Duration(predictionMonths)
|
||||||
// TODO whatif
|
// TODO whatif
|
||||||
// TODO ana.Prediction
|
// TODO ana.Prediction
|
||||||
|
prediction := make(ana.Prediction, 0)
|
||||||
|
for _, spec := range r.URL.Query()["prediction"] {
|
||||||
|
idx := strings.Index(spec, "=")
|
||||||
|
k := spec[:idx]
|
||||||
|
fields := strings.Fields(spec[idx+1:])
|
||||||
|
switch k {
|
||||||
|
case "interest":
|
||||||
|
apy, err := strconv.ParseFloat(fields[2], 64)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
prediction = append(prediction, ana.NewInterestPredictor(fields[0], fields[1], apy))
|
||||||
|
case "contributions":
|
||||||
|
prediction = append(prediction, ana.NewContributionPredictor(register))
|
||||||
|
default:
|
||||||
|
panic(k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
predicted := prediction.Predict(register, window)
|
||||||
|
register.PushAll(predicted) // TODO draw line separately
|
||||||
for _, currencyRate := range r.URL.Query()["predictFixedGrowth"] {
|
for _, currencyRate := range r.URL.Query()["predictFixedGrowth"] {
|
||||||
currency := strings.Split(currencyRate, "=")[0]
|
currency := strings.Split(currencyRate, "=")[0]
|
||||||
rate, err := strconv.ParseFloat(strings.Split(currencyRate, "=")[1], 64)
|
rate, err := strconv.ParseFloat(strings.Split(currencyRate, "=")[1], 64)
|
||||||
|
|||||||
Reference in New Issue
Block a user