From 7be72d8782ee8e06ce27c9c60f6ef3947128f6cf Mon Sep 17 00:00:00 2001 From: icy Date: Mon, 3 Nov 2025 19:29:09 +0800 Subject: [PATCH] =?UTF-8?q?Move=20equity-history=20API=20to=20public=20rou?= =?UTF-8?q?tes=20for=20competition=20display=20-=20Move=20/api/equity-hist?= =?UTF-8?q?ory=20from=20protected=20to=20public=20routes=20group=20-=20Rem?= =?UTF-8?q?ove=20token=20authentication=20requirement=20for=20equity=20his?= =?UTF-8?q?tory=20data=20-=20Update=20API=20documentation=20to=20reflect?= =?UTF-8?q?=20public=20access=20-=20Enable=20direct=20access=20to=20trader?= =?UTF-8?q?=20equity=20curves=20for=20competition=20comparison=20?= =?UTF-8?q?=F0=9F=A4=96=20Generated=20with=20[Claude=20Code](https://claud?= =?UTF-8?q?e.ai/code)=20Co-Authored-By:=20tinkle-community=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/server.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/server.go b/api/server.go index b4a58dd1..9a8adde4 100644 --- a/api/server.go +++ b/api/server.go @@ -92,6 +92,7 @@ func (s *Server) setupRoutes() { // 公开的竞赛数据(无需认证) api.GET("/traders", s.handlePublicTraderList) api.GET("/competition", s.handlePublicCompetition) + api.GET("/equity-history", s.handleEquityHistory) // 需要认证的路由 protected := api.Group("/", s.authMiddleware()) @@ -127,7 +128,6 @@ func (s *Server) setupRoutes() { protected.GET("/decisions", s.handleDecisions) protected.GET("/decisions/latest", s.handleLatestDecisions) protected.GET("/statistics", s.handleStatistics) - protected.GET("/equity-history", s.handleEquityHistory) protected.GET("/performance", s.handlePerformance) } } @@ -1441,7 +1441,9 @@ func (s *Server) Start() error { log.Printf("🌐 API服务器启动在 http://localhost%s", addr) log.Printf("📊 API文档:") log.Printf(" • GET /api/health - 健康检查") - log.Printf(" • GET /api/traders - AI交易员列表") + log.Printf(" • GET /api/traders - 公开的AI交易员列表(无需认证)") + log.Printf(" • GET /api/competition - 公开的竞赛数据(无需认证)") + log.Printf(" • GET /api/equity-history?trader_id=xxx - 公开的收益率历史数据(无需认证,竞赛用)") log.Printf(" • POST /api/traders - 创建新的AI交易员") log.Printf(" • DELETE /api/traders/:id - 删除AI交易员") log.Printf(" • POST /api/traders/:id/start - 启动AI交易员") @@ -1456,7 +1458,6 @@ func (s *Server) Start() error { log.Printf(" • GET /api/decisions?trader_id=xxx - 指定trader的决策日志") log.Printf(" • GET /api/decisions/latest?trader_id=xxx - 指定trader的最新决策") log.Printf(" • GET /api/statistics?trader_id=xxx - 指定trader的统计信息") - log.Printf(" • GET /api/equity-history?trader_id=xxx - 指定trader的收益率历史数据") log.Printf(" • GET /api/performance?trader_id=xxx - 指定trader的AI学习表现分析") log.Println() @@ -1555,3 +1556,4 @@ func (s *Server) handlePublicCompetition(c *gin.Context) { c.JSON(http.StatusOK, competition) } +