deving
This commit is contained in:
@@ -12,7 +12,7 @@ type StockData struct {
|
||||
FinaIndicator []models.StockFinaIndicator
|
||||
}
|
||||
|
||||
func GetData(code string) *StockData {
|
||||
func GetFullData(code string) *StockData {
|
||||
var data StockData
|
||||
impl.DBService.Where("ts_code = ?", code).First(&data.Basic)
|
||||
impl.DBService.Where("ts_code = ?", code).Order("trade_date desc").Find(&data.Daily)
|
||||
@@ -25,3 +25,9 @@ func GetIndustry() (industry []string) {
|
||||
impl.DBService.Model(&models.StockBasic{}).Group("industry").Pluck("industry", &industry)
|
||||
return
|
||||
}
|
||||
|
||||
func GetBasic(code string) *models.StockBasic {
|
||||
var data StockData
|
||||
impl.DBService.Where("ts_code = ?", code).First(&data.Basic)
|
||||
return &data.Basic
|
||||
}
|
||||
|
||||
36
internal/logic/strategy/rule/price.go
Normal file
36
internal/logic/strategy/rule/price.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package rule
|
||||
|
||||
import (
|
||||
"git.apinb.com/bsm-sdk/core/printer"
|
||||
"git.apinb.com/quant/gostock/internal/impl"
|
||||
"git.apinb.com/quant/gostock/internal/logic/types"
|
||||
"git.apinb.com/quant/gostock/internal/models"
|
||||
)
|
||||
|
||||
var (
|
||||
MinPrice = 5.0
|
||||
)
|
||||
|
||||
type Price struct {
|
||||
Key string
|
||||
Name string
|
||||
}
|
||||
|
||||
func NewPrice() *Price {
|
||||
return &Price{
|
||||
Key: "Price",
|
||||
Name: "股价",
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Price) Run(code string) *types.RuleResult {
|
||||
var daily models.StockDaily
|
||||
impl.DBService.Where("ts_code = ?", code).Order("trade_date desc").Limit(1).First(&daily)
|
||||
printer.Json(daily)
|
||||
|
||||
if daily.Close < MinPrice {
|
||||
return &types.RuleResult{Key: r.Key, Name: r.Name, Score: -1, Desc: "股价低于5元"}
|
||||
}
|
||||
|
||||
return &types.RuleResult{Key: r.Key, Name: r.Name, Score: 1, Desc: "股价高于5元"}
|
||||
}
|
||||
Reference in New Issue
Block a user