wip
parent
31e1a86795
commit
bc9da905a7
|
|
@ -13,18 +13,41 @@ func RegisterWithContributionPrediction(reg map[string]Balances, windowAsPercent
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
windowDuration := time.Second * time.Duration(float64(slices.Max(times)-slices.Min(times))*windowAsPercentOfTotalDuration)
|
||||
log.Println(windowDuration)
|
||||
|
||||
lastReal := time.Unix(slices.Max(times), 0)
|
||||
lastPredicted := lastReal
|
||||
for lastPredicted.Before(lastReal.Add(windowDuration)) {
|
||||
lastPredicted = lastPredicted.Add(time.Hour * 24 * time.Duration((45 - lastPredicted.Day())))
|
||||
log.Println(lastPredicted)
|
||||
}
|
||||
datesToPredict := func() []string {
|
||||
result := make([]string, 0)
|
||||
windowDuration := time.Second * time.Duration(float64(slices.Max(times)-slices.Min(times))*windowAsPercentOfTotalDuration)
|
||||
|
||||
lastReal := time.Unix(slices.Max(times), 0)
|
||||
lastPredicted := lastReal
|
||||
for lastPredicted.Before(lastReal.Add(windowDuration)) {
|
||||
lastPredicted = lastPredicted.Add(time.Hour * 24 * time.Duration((45 - lastPredicted.Day())))
|
||||
result = append(result, lastPredicted.Format("2006-01"))
|
||||
}
|
||||
return result
|
||||
}()
|
||||
log.Print(datesToPredict)
|
||||
|
||||
namesDatesContributions := func() map[string]map[string]Balances {
|
||||
panic("todo")
|
||||
}()
|
||||
|
||||
result := make(map[string]Balances)
|
||||
return result, io.EOF
|
||||
for name, datesContributions := range namesDatesContributions {
|
||||
result[name] = func() Balances {
|
||||
dates := func() []string {
|
||||
result := make([]string, 0)
|
||||
for k := range datesContributions {
|
||||
result = append(result, k)
|
||||
}
|
||||
return result
|
||||
}()
|
||||
slices.Sort(dates)
|
||||
//var half, threeQuarter, sevenEighths string
|
||||
panic(fmt.Sprint(name, dates))
|
||||
}()
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func RegisterWithCompoundingInterestPrediction(reg map[string]Balances, windowAsPercentOfTotalDuration float64, name string, rate float64) (map[string]Balances, error) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue