Files
gostock/internal/logic/restful/starter.go
2026-02-09 18:28:00 +08:00

44 lines
1.2 KiB
Go

package restful
import (
"log"
"git.apinb.com/quant/gostock/internal/logic/mock"
"git.apinb.com/quant/gostock/internal/logic/strategy"
"git.apinb.com/quant/gostock/internal/logic/strategy/rule"
"git.apinb.com/quant/gostock/internal/models"
"github.com/gin-gonic/gin"
)
func Starter(ctx *gin.Context) {
log.Println("Strategy START.")
ymd := models.GetYmd()
for _, code := range strategy.GetStocks() {
strategy.InitCacheByCode(code)
model := models.NewStratModel("selector", code, ymd)
stratRule := rule.NewRule(model)
{
stratRule.RunUpDate(strategy.Cache[code].Basic.ListDate)
stratRule.RunST(strategy.Cache[code].Basic.Name)
stratRule.RunIndustry(strategy.Cache[code].Basic.Industry)
stratRule.RunPrice(code)
stratRule.RunAmount(code)
stratRule.RunRoe(code)
stratRule.RunRsi(code)
// 过滤无需AI分析
if model.StScore > 0 && model.IndustryScore > 0 && model.GtPrice > 0 && model.GtAmount > 0 && model.GtRoe > 0 && model.ScoreRsi > 0 {
model.AiScore = 0 // 待分析
} else {
model.AiScore = -2
model.AddDesc("无需AI分析")
}
}
model.Save()
}
strategy.BootAiStart("selector", ymd)
log.Println("Strategy END.")
mock.Run("selector", ymd)
}