From 057e87f0ab098ca5fdb279b90d4bfa5a5c124c67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=A5=E5=BE=AE?= Date: Thu, 9 Jul 2026 19:07:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20Dashboard=E5=B8=82=E5=9C=BATab=E5=80=99?= =?UTF-8?q?=E9=80=89=E7=AE=A1=E9=81=93+S4=E8=B5=84=E9=87=91=E6=B5=81(?= =?UTF-8?q?=E5=A4=96=E7=9B=98/=E5=86=85=E7=9B=98)+=E5=85=A8=E9=93=BE?= =?UTF-8?q?=E8=B7=AF=E6=B5=8B=E8=AF=95=E9=80=9A=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/server.py b/server.py index 0b46cbbe..3656155c 100644 --- a/server.py +++ b/server.py @@ -9,6 +9,9 @@ import uuid import urllib.request from datetime import datetime from pathlib import Path +import sys +sys.path.insert(0, "/home/hmo/MoFin/scripts") +sys.path.insert(0, "/home/hmo/MoFin") from flask import Flask, jsonify, send_from_directory, request @@ -704,6 +707,25 @@ def trigger_evaluation(): # ── 策略反馈API ── +@app.route("/api/candidates") +def get_candidates(): + """候选股管道数据""" + import sqlite3 + conn = sqlite3.connect("/home/hmo/MoFin/data/mofin.db") + conn.row_factory = sqlite3.Row + rows = conn.execute(""" + SELECT code, name, reason, entry_range, stop_loss, target, + score_2nd, score_3rd, score_4th, score_5th, score_final, + pass_s2, pass_s3, pass_s4, pass_s5, pass_final, + promoted, promoted_at, log, created_at + FROM candidates WHERE dropped IS NULL OR dropped=0 + ORDER BY COALESCE(score_final,0) DESC, created_at DESC + LIMIT 50 + """).fetchall() + conn.close() + return jsonify([dict(r) for r in rows]) + + @app.route("/api/feedback") def get_feedback(): data = _load_json(DATA_DIR / "strategy_feedback.json", {})