This commit is contained in:
2026-02-14 13:38:23 +08:00
parent ffd174309e
commit 8885f665cd
3 changed files with 14 additions and 2 deletions

View File

@@ -1,6 +1,8 @@
package main
import (
"fmt"
"git.apinb.com/dataset/stock/internal/config"
"git.apinb.com/dataset/stock/internal/impl"
"git.apinb.com/dataset/stock/internal/logic/a"
@@ -17,5 +19,6 @@ func main() {
// 创建实现层
impl.NewImpl()
a.NewApiClient()
a.GetTushareMoneyFlow()
lastTradeDay := a.GetTradeDateBy(1, false)[0]
fmt.Println(lastTradeDay)
}

View File

@@ -1,6 +1,7 @@
package cron
import (
"log"
"os"
"time"
@@ -14,7 +15,7 @@ func Boot() {
os.MkdirAll("./markdata/", 0755)
}
UpdateTask()
//UpdateTask()
scheduler := cron.New()
// 每天运行3次来更新数据
@@ -30,6 +31,10 @@ func Boot() {
func UpdateTask() {
a.NewApiClient()
if a.ReturnLastTradeDay() != time.Now().Format("20060102") {
log.Println("Today Not Trade Day.")
return
}
// 获取股票列表
a.GetStockBasic()
// 更新资金流向

View File

@@ -40,6 +40,10 @@ func GetTradeDateBy(max int, asc bool) []string {
return days
}
func ReturnLastTradeDay() string {
return GetTradeDateBy(1, false)[0]
}
func ReturnLastDay() (string, string) {
now := time.Now()
end := now.Format("20060102")