This commit is contained in:
yanweidong
2026-02-02 12:17:37 +08:00
parent e55ed7a7a2
commit 84e3dbf401
3 changed files with 556 additions and 1 deletions

View File

@@ -1,14 +1,21 @@
package cron
import (
"os"
"git.apinb.com/bsm-sdk/core/utils"
"git.apinb.com/dataset/stock/internal/logic/a"
"github.com/robfig/cron/v3"
)
func Boot() {
if !utils.PathExists("./markdata/") {
os.MkdirAll("./markdata/", 0755)
}
scheduler := cron.New()
// 每天运行3次来更新数据
scheduler.AddFunc("* 1,20,22 * * *", func() {
scheduler.AddFunc("30 21 * * *", func() {
updateTask()
})
scheduler.Start()
@@ -24,4 +31,6 @@ func updateTask() {
a.GetStockIndicator()
// 获取股票财务指标数据
a.GetFinaIndicator()
// 生成Markdown文件
a.GenMarkData()
}