This commit is contained in:
2026-02-27 13:26:22 +08:00
parent 4dde784047
commit fc5a1be7e1
8 changed files with 47 additions and 40 deletions

View File

@@ -16,7 +16,7 @@ func Boot() {
// 启动 AI 分析任务
func BootAiStart(key string, ymd int) error {
var datas []models.StratModel
err := impl.DBService.Where("strat_key=? and ymd=? and ai_score=0 and rsi_score>0 and macd_score>0", key, ymd).Find(&datas).Error
err := impl.DBService.Where("strat_key=? and ymd=? and status=2", key, ymd).Find(&datas).Error
if err != nil {
log.Printf("Failed to query data: %v", err)
return fmt.Errorf("query failed: %w", err)
@@ -25,8 +25,9 @@ func BootAiStart(key string, ymd int) error {
// 构造任务列表
var tasks []func()
for _, row := range datas {
r := row
tasks = append(tasks, func() {
BootAiTask(row.ID, row.Code)
BootAiTask(r.ID, r.Code)
})
}

View File

@@ -21,7 +21,7 @@ func (r *RuleFactory) RunAmount(code string) {
check := true
for _, row := range data {
if row.Amount < MinPrice {
if row.Amount < MinAmount {
check = false
break
}

View File

@@ -1,21 +1,14 @@
package strategy
import (
"log"
// func TotalScore(ymd int) {
// log.Println("Total Score", ymd)
// where := " where up_date_day>360 and ymd=" + utils.Int2String(ymd)
// sql := "update strat_model set total_score=industry_score+st_score+gt_amount+gt_price+roe_score+rsi_score" + where
"git.apinb.com/bsm-sdk/core/utils"
"git.apinb.com/quant/gostock/internal/impl"
)
func TotalScore(ymd int) {
log.Println("Total Score", ymd)
where := " where up_date_day>360 and ymd=" + utils.Int2String(ymd)
sql := "update strat_model set total_score=industry_score+st_score+gt_amount+gt_price+roe_score+rsi_score" + where
log.Println("SQL:", sql)
err := impl.DBService.Exec(sql).Error
if err != nil {
log.Println("Failed to update total score:", err)
return
}
}
// log.Println("SQL:", sql)
// err := impl.DBService.Exec(sql).Error
// if err != nil {
// log.Println("Failed to update total score:", err)
// return
// }
// }