feat: 自动候选筛选与股票研究工作台

This commit is contained in:
2026-10-09 20:39:23 +08:00
parent 92329ddce2
commit 57882ff568
32 changed files with 1343 additions and 87 deletions
+1
View File
@@ -21,6 +21,7 @@ type LoginLimiter interface {
Login(context.Context, string, string) (bool, error)
}
type IdentityOptions struct {
Screenings *service.ScreeningService
Market *service.MarketService
Backtests *service.BacktestService
Auth *service.AuthService
+52
View File
@@ -16,6 +16,42 @@ func bindStrategies(r *gin.Engine, options IdentityOptions) {
}
c.Next()
})
group.GET("/strategy-screenings", func(c *gin.Context) {
if options.Screenings == nil {
fail(c, apperror.ErrUnavailable)
return
}
result, err := options.Screenings.List(c.Request.Context(), currentUser(c))
if err != nil {
fail(c, err)
return
}
success(c, http.StatusOK, result)
})
group.GET("/strategy-screenings/:id", func(c *gin.Context) {
if options.Screenings == nil {
fail(c, apperror.ErrUnavailable)
return
}
result, err := options.Screenings.Detail(c.Request.Context(), currentUser(c), c.Param("id"))
if err != nil {
fail(c, err)
return
}
success(c, http.StatusOK, result)
})
group.GET("/strategy-screening-status", func(c *gin.Context) {
if options.Screenings == nil {
fail(c, apperror.ErrUnavailable)
return
}
result, err := options.Screenings.State(currentUser(c))
if err != nil {
fail(c, err)
return
}
success(c, http.StatusOK, result)
})
group.GET("/strategies", func(c *gin.Context) {
result, err := options.Strategies.List(c.Request.Context(), currentUser(c))
if err != nil {
@@ -39,6 +75,22 @@ func bindStrategies(r *gin.Engine, options IdentityOptions) {
}
c.Next()
})
group.POST("/strategy-screenings/run", func(c *gin.Context) {
if options.Screenings == nil {
fail(c, apperror.ErrUnavailable)
return
}
var input struct{}
if !decode(c, &input) {
return
}
result, err := options.Screenings.RequestRun(currentUser(c))
if err != nil {
fail(c, err)
return
}
success(c, http.StatusAccepted, result)
})
for _, path := range []string{"/strategies", "/strategies/:id/versions"} {
group.POST(path, func(c *gin.Context) {
var input service.StrategyInput