deving
This commit is contained in:
@@ -2,9 +2,9 @@ package rule
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"git.apinb.com/quant/gostock/internal/impl"
|
||||
"git.apinb.com/quant/gostock/internal/logic/types"
|
||||
"git.apinb.com/quant/gostock/internal/models"
|
||||
)
|
||||
|
||||
@@ -13,19 +13,8 @@ var (
|
||||
MinAmount float64 = 100000 // 万元为单位
|
||||
)
|
||||
|
||||
type Amount struct {
|
||||
Key string
|
||||
Name string
|
||||
}
|
||||
|
||||
func NewAmount() *Amount {
|
||||
return &Amount{
|
||||
Key: "Amount",
|
||||
Name: "成交额",
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Amount) Run(code string) *types.RuleResult {
|
||||
func (r *RuleFactory) RunAmount(code string) {
|
||||
log.Println("RunAmount:", r.Model.Code, "Args:", LastAmountDay, MinAmount)
|
||||
|
||||
var data []models.StockDaily
|
||||
impl.DBService.Where("ts_code = ?", code).Order("trade_date desc").Limit(LastAmountDay).Find(&data)
|
||||
@@ -39,8 +28,10 @@ func (r *Amount) Run(code string) *types.RuleResult {
|
||||
}
|
||||
|
||||
if !check {
|
||||
return &types.RuleResult{Key: r.Key, Name: r.Name, Score: -1, Desc: fmt.Sprintf("最近%d天, 有成交额低于%.2f万元", LastAmountDay, MinAmount)}
|
||||
r.Model.GtAmount = -1
|
||||
r.Model.AddDesc(fmt.Sprintf("最近%d天, 有成交额低于%.2f万元", LastAmountDay, MinAmount))
|
||||
return
|
||||
}
|
||||
|
||||
return &types.RuleResult{Key: r.Key, Name: r.Name, Score: 1, Desc: fmt.Sprintf("最近%d天, 成交额均高于%.2f万元", LastAmountDay, MinAmount)}
|
||||
r.Model.GtAmount = 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user