feat: 自动候选筛选与股票研究工作台
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user