add 加入资金流向特大的标地
This commit is contained in:
@@ -6,8 +6,8 @@ import (
|
|||||||
|
|
||||||
"git.apinb.com/quant/gostock/internal/config"
|
"git.apinb.com/quant/gostock/internal/config"
|
||||||
"git.apinb.com/quant/gostock/internal/impl"
|
"git.apinb.com/quant/gostock/internal/impl"
|
||||||
|
"git.apinb.com/quant/gostock/internal/logic/mock"
|
||||||
"git.apinb.com/quant/gostock/internal/logic/strategy"
|
"git.apinb.com/quant/gostock/internal/logic/strategy"
|
||||||
"git.apinb.com/quant/gostock/internal/logic/strategy/rule"
|
|
||||||
"git.apinb.com/quant/gostock/internal/logic/types"
|
"git.apinb.com/quant/gostock/internal/logic/types"
|
||||||
"git.apinb.com/quant/gostock/internal/models"
|
"git.apinb.com/quant/gostock/internal/models"
|
||||||
"github.com/gocarina/gocsv"
|
"github.com/gocarina/gocsv"
|
||||||
@@ -21,41 +21,42 @@ func main() {
|
|||||||
log.Println("Hello Cli!")
|
log.Println("Hello Cli!")
|
||||||
config.New(ServiceKey)
|
config.New(ServiceKey)
|
||||||
impl.NewImpl()
|
impl.NewImpl()
|
||||||
|
|
||||||
ymd := models.GetYmd()
|
|
||||||
for _, code := range strategy.GetStocks() {
|
|
||||||
strategy.InitCacheByCode(code)
|
|
||||||
model := models.NewStratModel("selector", code, ymd)
|
|
||||||
stratRule := rule.NewRule(model)
|
|
||||||
{
|
|
||||||
stratRule.RunUpDate(strategy.Cache[code].Basic.ListDate)
|
|
||||||
stratRule.RunST(strategy.Cache[code].Basic.Name)
|
|
||||||
stratRule.RunIndustry(strategy.Cache[code].Basic.Industry)
|
|
||||||
stratRule.RunPrice(code)
|
|
||||||
stratRule.RunAmount(code)
|
|
||||||
stratRule.RunRoe(code)
|
|
||||||
stratRule.RunRsi(code)
|
|
||||||
|
|
||||||
// 过滤无需AI分析
|
|
||||||
if model.StScore > 0 && model.IndustryScore > 0 && model.GtPrice > 0 && model.GtAmount > 0 && model.GtRoe > 0 && model.ScoreRsi > 0 {
|
|
||||||
model.AiScore = 0 // 待分析
|
|
||||||
} else {
|
|
||||||
model.AiScore = -2
|
|
||||||
model.AddDesc("无需AI分析")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
model.Save()
|
|
||||||
}
|
|
||||||
|
|
||||||
strategy.BootAiStart("selector", models.GetYmd())
|
strategy.BootAiStart("selector", models.GetYmd())
|
||||||
|
mock.Run("selector", models.GetYmd())
|
||||||
}
|
}
|
||||||
|
|
||||||
func ai() {
|
// func main() {
|
||||||
log.Println("Hello Cli!")
|
// log.Println("Hello Cli!")
|
||||||
config.New(ServiceKey)
|
// config.New(ServiceKey)
|
||||||
impl.NewImpl()
|
// impl.NewImpl()
|
||||||
|
|
||||||
}
|
// ymd := models.GetYmd()
|
||||||
|
// for _, code := range strategy.GetStocks() {
|
||||||
|
// strategy.InitCacheByCode(code)
|
||||||
|
// model := models.NewStratModel("selector", code, ymd)
|
||||||
|
// stratRule := rule.NewRule(model)
|
||||||
|
// {
|
||||||
|
// stratRule.RunUpDate(strategy.Cache[code].Basic.ListDate)
|
||||||
|
// stratRule.RunST(strategy.Cache[code].Basic.Name)
|
||||||
|
// stratRule.RunIndustry(strategy.Cache[code].Basic.Industry)
|
||||||
|
// stratRule.RunPrice(code)
|
||||||
|
// stratRule.RunAmount(code)
|
||||||
|
// stratRule.RunRoe(code)
|
||||||
|
// stratRule.RunRsi(code)
|
||||||
|
|
||||||
|
// // 过滤无需AI分析
|
||||||
|
// if model.StScore > 0 && model.IndustryScore > 0 && model.GtPrice > 0 && model.GtAmount > 0 && model.GtRoe > 0 && model.ScoreRsi > 0 {
|
||||||
|
// model.AiScore = 0 // 待分析
|
||||||
|
// } else {
|
||||||
|
// model.AiScore = -2
|
||||||
|
// model.AddDesc("无需AI分析")
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// model.Save()
|
||||||
|
// }
|
||||||
|
|
||||||
|
// strategy.BootAiStart("selector", models.GetYmd())
|
||||||
|
// }
|
||||||
|
|
||||||
func main3() {
|
func main3() {
|
||||||
log.Println("Hello Cli!")
|
log.Println("Hello Cli!")
|
||||||
|
|||||||
@@ -86,8 +86,8 @@ func Report() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3.判断盈亏超过20%,才确定平仓
|
// 3.判断盈亏超过10%,才确定平仓
|
||||||
if pnlRate >= 20 {
|
if pnlRate >= 10 {
|
||||||
impl.DBService.Model(&models.MockPosition{}).Where("id=?", p.ID).Updates(map[string]any{
|
impl.DBService.Model(&models.MockPosition{}).Where("id=?", p.ID).Updates(map[string]any{
|
||||||
"close_price": newClosePrice,
|
"close_price": newClosePrice,
|
||||||
"pnl": pnl,
|
"pnl": pnl,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package restful
|
|||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
|
"git.apinb.com/quant/gostock/internal/impl"
|
||||||
"git.apinb.com/quant/gostock/internal/logic/mock"
|
"git.apinb.com/quant/gostock/internal/logic/mock"
|
||||||
"git.apinb.com/quant/gostock/internal/logic/strategy"
|
"git.apinb.com/quant/gostock/internal/logic/strategy"
|
||||||
"git.apinb.com/quant/gostock/internal/logic/strategy/rule"
|
"git.apinb.com/quant/gostock/internal/logic/strategy/rule"
|
||||||
@@ -33,10 +34,16 @@ func Starter(ctx *gin.Context) {
|
|||||||
model.AiScore = -2
|
model.AiScore = -2
|
||||||
model.AddDesc("无需AI分析")
|
model.AddDesc("无需AI分析")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
model.Save()
|
model.Save()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 加入资金流向特大的标地
|
||||||
|
var codes []string
|
||||||
|
impl.DBService.Model(&models.MoneyTotal{}).Where("is_greater_pervious = ? and last3_day_mf_amount>", true, 100000).Pluck("code", &codes)
|
||||||
|
impl.DBService.Model(&models.StratModel{}).Where("ai_score=-2 and code in ?", codes).Update("ai_score", 0)
|
||||||
|
|
||||||
strategy.BootAiStart("selector", ymd)
|
strategy.BootAiStart("selector", ymd)
|
||||||
log.Println("Strategy END.")
|
log.Println("Strategy END.")
|
||||||
mock.Run("selector", ymd)
|
mock.Run("selector", ymd)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ func AiAnalysis(code string) (map[string]any, error) {
|
|||||||
prompt += string(content)
|
prompt += string(content)
|
||||||
|
|
||||||
chatReq := &request.ChatCompletionsRequest{
|
chatReq := &request.ChatCompletionsRequest{
|
||||||
Model: deepseek.DEEPSEEK_REASONER_MODEL,
|
Model: deepseek.DEEPSEEK_CHAT_MODEL,
|
||||||
Stream: false,
|
Stream: false,
|
||||||
Messages: []*request.Message{
|
Messages: []*request.Message{
|
||||||
{
|
{
|
||||||
|
|||||||
17
internal/models/money_total.go
Normal file
17
internal/models/money_total.go
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
// 资金流数据模型
|
||||||
|
type MoneyTotal struct {
|
||||||
|
ID uint `gorm:"primarykey"`
|
||||||
|
Code string // 股票代码
|
||||||
|
Last1DayMfAmount float64 // 最近1天净流入额(万元)
|
||||||
|
Last3DayMfAmount float64 // 最近3天净流入额(万元)
|
||||||
|
Last1DayTotalAmount float64 // 最近1天中大单总流入额(万元)
|
||||||
|
Last3DayTotalAmount float64 // 最近3天中大单总流入额(万元)
|
||||||
|
IsGreaterPervious bool // 是否比上一日大单流入额多
|
||||||
|
}
|
||||||
|
|
||||||
|
// TableName 设置表名
|
||||||
|
func (MoneyTotal) TableName() string {
|
||||||
|
return "money_total"
|
||||||
|
}
|
||||||
@@ -3,4 +3,7 @@
|
|||||||
GOARCH=amd64 GOOS=linux go build -o ../builds/gostock ./cmd/main/main.go
|
GOARCH=amd64 GOOS=linux go build -o ../builds/gostock ./cmd/main/main.go
|
||||||
|
|
||||||
nohup ./gostock > /data/app/logs/gostock.log 2>&1 &
|
nohup ./gostock > /data/app/logs/gostock.log 2>&1 &
|
||||||
cat /data/app/logs/gostock.log
|
cat /data/app/logs/gostock.log
|
||||||
|
|
||||||
|
|
||||||
|
GOARCH=amd64 GOOS=linux go build -o ../builds/ai ./cmd/selector/main.go
|
||||||
Reference in New Issue
Block a user