This commit is contained in:
yanweidong
2026-02-11 18:33:59 +08:00
parent 29baa4d138
commit 2918eee808
5 changed files with 18 additions and 6 deletions

View File

@@ -14,6 +14,8 @@ func Boot() {
os.MkdirAll("./markdata/", 0755)
}
UpdateTask()
scheduler := cron.New()
// 每天运行3次来更新数据
scheduler.AddFunc("0 18 * * *", func() {

View File

@@ -1,6 +1,7 @@
package a
import (
"encoding/json"
"log"
"time"
@@ -32,7 +33,13 @@ func GetStockDaily() {
reply, err := TushareClient.Daily(params, fields)
if err != nil {
log.Println("ERROR", "GetStockDaily", err)
return
continue
}
if len(reply.Data.Items) == 0 {
json, _ := json.Marshal(reply)
log.Println("ERROR", "GetStockDailyReply", string(json))
continue
}
records := make([]*models.StockDaily, 0)
@@ -65,7 +72,7 @@ func GetStockDaily() {
impl.DBService.CreateInBatches(records, 50)
}
time.Sleep(200 * time.Microsecond)
time.Sleep(200 * time.Millisecond)
}

View File

@@ -95,7 +95,7 @@ func GetFinaIndicator() {
}
}
time.Sleep(200 * time.Microsecond)
time.Sleep(200 * time.Millisecond)
}
}

View File

@@ -73,6 +73,6 @@ func GetStockIndicator() {
impl.DBService.CreateInBatches(records, 100)
}
time.Sleep(200 * time.Microsecond)
time.Sleep(200 * time.Millisecond)
}
}