deving
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"git.apinb.com/bsm-sdk/core/utils"
|
||||
"git.apinb.com/quant/gostock/internal/impl"
|
||||
"git.apinb.com/quant/gostock/internal/logic/types"
|
||||
"git.apinb.com/quant/gostock/internal/models"
|
||||
@@ -65,9 +66,10 @@ func (r *Rsi) Run(code string) *types.RuleResult {
|
||||
|
||||
rsiResult := talib.Rsi(close, r.Args.RsiPeriod)
|
||||
lastRsi := rsiResult[len(rsiResult)-1]
|
||||
lastRsi = utils.FloatRound(lastRsi, 2)
|
||||
if lastRsi > float64(r.Args.RsiOversold) {
|
||||
return &types.RuleResult{Key: r.Key, Name: r.Name, Score: -1, Desc: fmt.Sprintf("RSI=%.2f 高于%d", lastRsi, r.Args.RsiOversold)}
|
||||
}
|
||||
|
||||
return &types.RuleResult{Key: r.Key, Name: r.Name, Score: 1, Desc: fmt.Sprintf("RSI=%.2f 低于%d", lastRsi, r.Args.RsiOversold)}
|
||||
return &types.RuleResult{Key: r.Key, Name: r.Name, Score: 1, Rsi: lastRsi, Desc: fmt.Sprintf("RSI=%.2f 低于%d", lastRsi, r.Args.RsiOversold)}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user