deving
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user