fix
This commit is contained in:
@@ -46,6 +46,12 @@ func (r *RuleFactory) RunRsi(code string) {
|
||||
return
|
||||
}
|
||||
|
||||
if args.RsiOversold == 0 {
|
||||
r.Model.ScoreRsi = -1
|
||||
r.Model.AddDesc("RSI RsiOversold=0,参数错误!")
|
||||
return
|
||||
}
|
||||
|
||||
if conf.BestByProfit != "rsi" {
|
||||
r.Model.ScoreRsi = -1
|
||||
r.Model.AddDesc("BestByProfit不是RSI")
|
||||
@@ -72,6 +78,12 @@ func (r *RuleFactory) RunRsi(code string) {
|
||||
prveRsiInt := int(prveRsi)
|
||||
lastRsiInt := int(lastRsi)
|
||||
|
||||
if lastRsiInt == 0 {
|
||||
r.Model.ScoreRsi = -1
|
||||
r.Model.AddDesc("RSI lastRsiInt=0,计算错误!")
|
||||
return
|
||||
}
|
||||
|
||||
// 跌破RSI下轨
|
||||
if lastRsiInt > args.RsiOversold {
|
||||
if CheckLowest(close, lastRsiInt, 14) {
|
||||
|
||||
23
internal/logic/strategy/total.go
Normal file
23
internal/logic/strategy/total.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package strategy
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"git.apinb.com/bsm-sdk/core/utils"
|
||||
"git.apinb.com/quant/gostock/internal/impl"
|
||||
"git.apinb.com/quant/gostock/internal/models"
|
||||
)
|
||||
|
||||
func TotalScore(ymd int) {
|
||||
log.Println("Total Score", ymd)
|
||||
impl.DBService.Model(&models.StratModel{}).Where("ymd=?", ymd).Update("total_score", 0)
|
||||
where := "where up_date_day>180 and st_score>0 and gt_amount>0 and gt_price>0 and gt_roe>0 and score_rsi>0 and ai_score>=5 and ymd=" + utils.Int2String(ymd)
|
||||
sql := "update strat_model set total_score=industry_score+val_roe+ai_score " + where
|
||||
|
||||
log.Println("SQL:", sql)
|
||||
err := impl.DBService.Exec(sql).Error
|
||||
if err != nil {
|
||||
log.Println("Failed to update total score:", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user