feat: mo_data.py unified read layer (DB-first, JSON fallback) + cash_log table + batch JSON→DB migration (16 files)

This commit is contained in:
知微
2026-07-01 23:45:30 +08:00
parent 864d924012
commit 6305204c7a
52 changed files with 16351 additions and 11643 deletions
+2 -1
View File
@@ -2,6 +2,7 @@
"""修复decisions.json中所有决策的trigger字段(由regenerate_all负责填充)"""
import json, sys, os
from mo_data import read_portfolio, read_decisions, read_watchlist
DECISIONS_PATH = "/home/hmo/web-dashboard/data/decisions.json"
DECISIONS_BAK = DECISIONS_PATH + ".bak"
@@ -42,7 +43,7 @@ for d in dec.get("decisions", []):
# 备份
os.makedirs(os.path.dirname(DECISIONS_BAK), exist_ok=True)
with open(DECISIONS_BAK, 'w') as f:
json.dump(json.load(open(DECISIONS_PATH)), f, indent=2, ensure_ascii=False)
json.dump(mo_data.read_decisions(), f, indent=2, ensure_ascii=False)
with open(DECISIONS_PATH, 'w') as f:
json.dump(dec, f, indent=2, ensure_ascii=False)