增加income,用于计算未来收益

This commit is contained in:
injoyai
2025-05-20 17:10:10 +08:00
parent 73d068002c
commit 84b0ec6f6c
2 changed files with 101 additions and 0 deletions

36
example/Income/main.go Normal file
View File

@@ -0,0 +1,36 @@
package main
import (
"github.com/injoyai/logs"
"github.com/injoyai/tdx/extend"
"time"
)
func main() {
code := "sz000001"
pull := extend.NewPullKline(extend.PullKlineConfig{
Codes: []string{code},
Tables: []string{extend.Day},
})
//m, err := tdx.NewManage(nil)
//logs.PanicErr(err)
//err = pull.Run(context.Background(), m)
//logs.PanicErr(err)
ks, err := pull.DayKlines(code)
logs.PanicErr(err)
t := time.Now().AddDate(0, -1, -9)
logs.Debug(t.Format(time.DateOnly))
ls := extend.DoIncomes(ks, t, 5, 10, 20)
logs.Debug(len(ls))
for _, v := range ls {
logs.Info(v)
}
}