This commit is contained in:
bel
2023-10-25 16:49:15 -06:00
parent bc9da905a7
commit 8d8be105a9

View File

@@ -28,23 +28,35 @@ func RegisterWithContributionPrediction(reg map[string]Balances, windowAsPercent
}()
log.Print(datesToPredict)
namesDatesContributions := func() map[string]map[string]Balances {
panic("todo")
namesDatesBalance := func() map[string]map[string]Balance {
result := make(map[string]map[string]Balance)
for date, balances := range reg {
for name, balance := range balances {
if _, ok := result[name]; !ok {
result[name] = make(map[string]Balance)
}
result[name][date] = balance
}
}
return result
}()
result := make(map[string]Balances)
for name, datesContributions := range namesDatesContributions {
for name, datesBalance := range namesDatesBalance {
result[name] = func() Balances {
dates := func() []string {
result := make([]string, 0)
for k := range datesContributions {
for k := range datesBalance {
result = append(result, k)
}
return result
}()
slices.Sort(dates)
//var half, threeQuarter, sevenEighths string
panic(fmt.Sprint(name, dates))
half := dates[len(dates)/2]
threeQuarter := dates[int(3.0*(len(dates)/4.0))]
sevenEighths := dates[int(7.0*(len(dates)/8.0))]
sum:= func(start, stop string) balance
panic(fmt.Sprintf("%s: %s .. %s .. %s (%v)", name, half, threeQuarter, sevenEighths, dates))
}()
}
return result, nil