f
This commit is contained in:
23
internal/logic/restful/recommend.go
Normal file
23
internal/logic/restful/recommend.go
Normal file
@@ -0,0 +1,23 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user