This commit is contained in:
yanweidong
2026-01-31 18:22:58 +08:00
parent b4310c22cd
commit 32cbe88964
12 changed files with 104 additions and 155 deletions

View File

@@ -1,9 +1,8 @@
package rule
import (
"log"
"strings"
"git.apinb.com/quant/gostock/internal/logic/types"
)
var (
@@ -17,28 +16,19 @@ var (
neutralIndustries = "银行,证券,保险,建筑工程,装修装饰,水泥,其他建材,化工原料,农药化肥,汽车服务,运输设备,旅游服务,酒店餐饮,旅游景点,食品,乳制品,白酒,啤酒,家用电器,家居用品,港口,水运,空运,农业综合,种植业,渔业,多元金融,工程机械,轻工机械,机械基件,机床制造,专用机械,化工机械,电器仪表,塑料,橡胶,化纤,服饰,日用化工,文教休闲,影视音像,广告包装,批发业,商贸代理,其他商业,商品城,电信运营,供气供热,软饮料,红黄酒,公共交通,机场,路桥,水力发电,石油加工,石油开采,石油贸易,园区开发,综合类,林业,特种钢"
)
type Industry struct {
Key string
Name string
}
func (r *RuleFactory) RunIndustry(in string) {
log.Println("RunIndustry:", r.Model.Code, "Args:", in)
func NewIdustry() *Industry {
return &Industry{
Key: "industry",
Name: "行业",
}
}
func (r *Industry) Run(in string) *types.RuleResult {
score := 1
desc := "中性/周期型行业"
if strings.Contains(hotIndustries, in) {
score = 2
desc = "热门行业"
r.Model.IndustryScore = 2
r.Model.AddDesc("中性/热门行业")
return
} else if strings.Contains(sunsetIndustries, in) {
score = -1
desc = "夕阳行业"
r.Model.IndustryScore = -1
r.Model.AddDesc("中性/夕阳行业")
return
}
return &types.RuleResult{Key: r.Key, Name: r.Name, Score: score, Desc: desc}
r.Model.IndustryScore = 1
r.Model.AddDesc("中性/周期型行业")
}