Initial commit
This commit is contained in:
36
internal/cron/boot.go
Normal file
36
internal/cron/boot.go
Normal file
@@ -0,0 +1,36 @@
|
||||
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("30 20 * * *", func() {
|
||||
updateTask()
|
||||
})
|
||||
scheduler.Start()
|
||||
}
|
||||
|
||||
func updateTask() {
|
||||
a.NewApiClient()
|
||||
// 获取股票列表
|
||||
a.GetStockBasic()
|
||||
// 获取股票日线
|
||||
a.GetStockDaily()
|
||||
// 获取股票指标
|
||||
a.GetStockIndicator()
|
||||
// 获取股票财务指标数据
|
||||
a.GetFinaIndicator()
|
||||
// 生成Markdown文件
|
||||
a.GenMarkData()
|
||||
}
|
||||
Reference in New Issue
Block a user