From 362c1f1e16a4c3973ad077eff84aa613a03286b3 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 27 Feb 2026 08:54:13 +0000 Subject: [PATCH] fix: add /api/signals/history endpoint --- backend/main.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/backend/main.py b/backend/main.py index fefde28..6ff0da9 100644 --- a/backend/main.py +++ b/backend/main.py @@ -211,6 +211,22 @@ async def get_kline(symbol: str = "BTC", interval: str = "5m", limit: int = 500) return {"symbol": symbol, "interval": interval, "count": len(data), "data": data} +@app.get("/api/signals/history") +async def get_signals_history(limit: int = 100): + """查询信号推送历史""" + try: + conn = sqlite3.connect(DB_PATH) + conn.row_factory = sqlite3.Row + rows = conn.execute( + "SELECT id, symbol, rate, annualized, sent_at, message FROM signal_logs ORDER BY sent_at DESC LIMIT ?", + (limit,) + ).fetchall() + conn.close() + return {"items": [dict(r) for r in rows]} + except Exception as e: + return {"items": [], "error": str(e)} + + @app.get("/api/history") async def get_history(): cached = get_cache("history", 60)