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
@@ -10,6 +10,7 @@ import os
import urllib.request
from datetime import datetime
from typing import Optional
from mo_data import read_portfolio, read_decisions, read_watchlist
DATA_DIR = "/home/hmo/web-dashboard/data"
MTF_CACHE_PATH = os.path.join(DATA_DIR, "multi_tf_cache.json")
@@ -286,7 +287,7 @@ def classify_stock(f: dict, mtf: dict, macro: dict) -> dict:
# 1. 深套检查
cost = 0
try:
pf = json.load(open(PORTFOLIO_PATH))
pf = mo_data.read_portfolio()
for h in pf.get("holdings", []):
if h.get("code") == f.get("code"):
cost = h.get("cost", 0) or 0