24 lines
594 B
Go
24 lines
594 B
Go
package restful
|
|
|
|
import (
|
|
"git.apinb.com/quant/gostock/internal/impl"
|
|
"git.apinb.com/quant/gostock/internal/logic/strategy"
|
|
"git.apinb.com/quant/gostock/internal/models"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func Recommend(ctx *gin.Context) {
|
|
ymd := lastYmd()
|
|
strategy.TotalScore(ymd)
|
|
var stocks []string
|
|
impl.DBService.Model(&models.StratModel{}).Where("total_score>?", 0).Pluck("code", &stocks)
|
|
ctx.JSON(200, stocks)
|
|
return
|
|
}
|
|
func lastYmd() int {
|
|
var ymd int
|
|
sql := "select ymd from strat_model sm group by ymd order by ymd desc limit 1"
|
|
impl.DBService.Raw(sql).Scan(&ymd)
|
|
return ymd
|
|
}
|