feat: 策略复盘闭环 Phase1

- 新增 scripts/strategy_review.py: 遍历所有active策略
  - 腾讯API实时价对比止损/止盈/入场点
  - 分类: correct/wrong/partial/pending
  - 失败模式归因: 止损过紧/入场过早/止盈过远等
  - 写入 accuracy_stats 表(首条真实数据)
- 新增 docs/strategy-review-loop.md: 完整闭环设计文档
- 含失败模式→修复方向映射表

Phase1 结果: 38条策略, 94.7%准确率(19条待定), 1条止损过紧
This commit is contained in:
知微
2026-06-25 19:58:00 +08:00
parent 147d6d0fa2
commit b053103377
35 changed files with 56075 additions and 51863 deletions
+4 -4
View File
@@ -183,14 +183,14 @@ def trigger_regen_sync(stock_codes=None):
def load_cash():
"""从 portfolio.json 实时读现金,不硬编码"""
"""从 portfolio.json 实时读可用现金(不含冻结部分),不硬编码"""
try:
with open(PORTFOLIO_PATH) as f:
data = json.load(f)
if isinstance(data, dict):
return data.get("cash", 0)
return data.get("cash_available", data.get("cash", 0))
if isinstance(data, list) and len(data) > 1 and isinstance(data[1], dict):
return data[1].get("cash", 0)
return data[1].get("cash_available", data[1].get("cash", 0))
return 0
except Exception:
return 0
@@ -437,7 +437,7 @@ def main():
try:
with open("/home/hmo/web-dashboard/data/portfolio.json") as f:
pf = json.load(f)
available_cash = pf.get("cash", 0) or 0
available_cash = pf.get("cash_available", pf.get("cash", 0)) or 0
# 直接取 portfolio.json 的总资产(导入时已做港币→人民币换算)
total_assets = pf.get("total_assets", 0) or 0
if total_assets <= 0: