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:
+2
-1
@@ -19,6 +19,7 @@
|
||||
|
||||
import json, os
|
||||
from datetime import datetime, timedelta
|
||||
from mo_data import read_portfolio, read_decisions, read_watchlist
|
||||
|
||||
LIVE_PRICES_PATH = "/home/hmo/web-dashboard/data/live_prices.json"
|
||||
PORTFOLIO_PATH = "/home/hmo/web-dashboard/data/portfolio.json"
|
||||
@@ -61,7 +62,7 @@ def check_fresh():
|
||||
# fallback: portfolio.json
|
||||
if os.path.exists(PORTFOLIO_PATH):
|
||||
try:
|
||||
pf = json.load(open(PORTFOLIO_PATH))
|
||||
pf = mo_data.read_portfolio()
|
||||
pf_time = pf.get("updated_at", "")
|
||||
if not pf_time:
|
||||
return False, "portfolio.json updated_at 为空"
|
||||
|
||||
Reference in New Issue
Block a user