bpis predictFixedGrowth fixed
cicd / ci (push) Successful in 1m15s
Details
cicd / ci (push) Successful in 1m15s
Details
parent
fe7c3a9682
commit
6aa549cb02
|
|
@ -297,6 +297,11 @@ func (router Router) APIReg(w http.ResponseWriter, r *http.Request) {
|
|||
register := deltas.Register()
|
||||
predicted := make(ledger.Register)
|
||||
|
||||
bpis, err := router.bpis()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
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
|
||||
|
|
@ -334,10 +339,6 @@ func (router Router) APIReg(w http.ResponseWriter, r *http.Request) {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
bpis, err := router.bpis()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
bpis, err = ana.BPIsWithFixedGrowthPrediction(bpis, window, currency, rate)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
|
@ -346,10 +347,6 @@ func (router Router) APIReg(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
if r.URL.Query().Get("bpi") == "true" {
|
||||
bpis, err := router.bpis()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
register = register.WithBPIs(bpis)
|
||||
predicted = predicted.WithBPIs(bpis)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue