diff --git a/cmd/cli/main.go b/cmd/cli/main.go index 24c1f96..2173533 100644 --- a/cmd/cli/main.go +++ b/cmd/cli/main.go @@ -36,7 +36,7 @@ func main() { stratRule.RunRsi(code) // 过滤无需AI分析 - if model.StScore > 0 && model.IndustryScore > 0 && model.GtPrice > 0 && model.GtAmount > 0 && model.GtRoe > 0 { + if model.StScore > 0 && model.IndustryScore > 0 && model.GtPrice > 0 && model.GtAmount > 0 && model.GtRoe > 0 && model.ScoreRsi > 0 { stratRule.RunAi(code) } else { model.AiScrore = -2 diff --git a/internal/logic/strategy/rule/rsi.go b/internal/logic/strategy/rule/rsi.go index 684bf66..9c2bc52 100644 --- a/internal/logic/strategy/rule/rsi.go +++ b/internal/logic/strategy/rule/rsi.go @@ -10,6 +10,10 @@ import ( talib "github.com/markcheno/go-talib" ) +var ( + offset = 3 // 偏移量 +) + type StockArgConf struct { BestByDrawdown string `json:"best_by_drawdown"` BestByProfit string `json:"best_by_profit"` @@ -57,6 +61,7 @@ func (r *RuleFactory) RunRsi(code string) { } newCloses := reverseSlice(close) + args.RsiOversold = args.RsiOversold + offset rsiResult := talib.Rsi(newCloses, args.RsiPeriod) prveRsi := utils.FloatRound(rsiResult[len(rsiResult)-2], 2)