This commit is contained in:
yanweidong
2026-02-01 14:57:20 +08:00
parent ec0fb57d1f
commit d89d7967b8
7 changed files with 108 additions and 60 deletions

View File

@@ -1,6 +1,7 @@
package models
import (
"fmt"
"time"
"git.apinb.com/bsm-sdk/core/database"
@@ -21,7 +22,14 @@ type StratModel struct {
GtAmount int // 每日交易额大于设定值
GtPrice int // 最近20日交易日价格大于设定值
GtRoe int // ROE 是否大于设定值
Desc string
ScoreRsi int
// 值
ValRoe float64
ValRsiOversold int
ValRsiPrve float64
ValRsiLast float64
Desc []StratDesc `gorm:"foreignKey:StratModelID"`
}
func init() {
@@ -43,7 +51,17 @@ func NewStratModel(key, code string) *StratModel {
}
func (s *StratModel) AddDesc(d string) {
s.Desc = s.Desc + "||" + d
hash := utils.Md5(fmt.Sprintf("%s-%d-%s:%s", s.StratKey, s.Ymd, s.Code, d))
var cnt int64
impl.DBService.Model(&StratDesc{}).Where("hash=?", hash).Count(&cnt)
if cnt > 0 {
return
}
s.Desc = append(s.Desc, StratDesc{
Hash: hash,
Desc: d,
})
}
func (s *StratModel) Save() error {