docs: 更新CHANGELOG + 开发日志记录07/13全部变更
- XMPP Bot非阻塞/本地XMPP/MUC修复 - price_monitor推送冷却持久化 - 深套股规则重构+换股规划swap-plan - 周月线技术分析增强 - 健康Tab写无读清零 - stale_push_wlin/per_stock_reassess/promote_candidates更新 - static/index.html + mofin_health.json + server.py同步
This commit is contained in:
@@ -83,6 +83,38 @@ def index():
|
||||
return send_from_directory(app.static_folder, "index.html")
|
||||
|
||||
|
||||
@app.route("/api/watch")
|
||||
def get_watch():
|
||||
"""盯盘:当前有操作建议的持仓+自选"""
|
||||
import sqlite3
|
||||
conn = sqlite3.connect("/home/hmo/MoFin/data/mofin.db")
|
||||
conn.row_factory = sqlite3.Row
|
||||
# 持仓:所有买卖操作都进盯盘;自选:只有买入/加仓信号(没持仓不可能卖)
|
||||
rows = conn.execute("""
|
||||
SELECT hs.code, hs.name, hs.decision_type, lp.price, lp.change_pct,
|
||||
hs.entry_low, hs.entry_high, hs.stop_loss, hs.take_profit,
|
||||
hs.rr_ratio, hs.timing_signal, hs.position_advice, hs.action,
|
||||
hs.full_analysis
|
||||
FROM holding_strategies hs
|
||||
LEFT JOIN live_prices lp ON hs.code = lp.code
|
||||
WHERE hs.status='active'
|
||||
AND (
|
||||
(hs.decision_type='持仓策略' AND hs.timing_signal IN ('买入','可买入','可加仓','卖出','止盈'))
|
||||
OR
|
||||
(hs.decision_type='自选策略' AND hs.timing_signal IN ('买入','可买入','可加仓'))
|
||||
)
|
||||
ORDER BY
|
||||
CASE hs.timing_signal
|
||||
WHEN '买入' THEN 1 WHEN '可买入' THEN 2 WHEN '可加仓' THEN 3
|
||||
WHEN '止盈' THEN 4 WHEN '卖出' THEN 5
|
||||
ELSE 9
|
||||
END,
|
||||
lp.change_pct DESC
|
||||
""").fetchall()
|
||||
conn.close()
|
||||
return json.dumps({"stocks": [dict(r) for r in rows], "count": len(rows)},
|
||||
ensure_ascii=False)
|
||||
|
||||
@app.route("/api/portfolio")
|
||||
def api_portfolio():
|
||||
"""持仓列表"""
|
||||
|
||||
Reference in New Issue
Block a user