#!/usr/bin/env python3
"""统一数据快照 — 所有报告脚本的单一数据入口。
替代直接读 portfolio.json / decisions.json。
MoFin 所有 LLM cron prompt 应改为运行本脚本获取数据。"""
import sys, json
sys.path.insert(0, '/home/hmo/MoFin')
from mo_data import read_portfolio, read_decisions, read_watchlist

pf = read_portfolio()
dec = read_decisions()
wl = read_watchlist()

# 港股标记HKD
for h in pf.get('holdings', []):
    if h.get('currency') == 'HKD':
        h['_price_display'] = f"{h['price']} HKD"
    else:
        h['_price_display'] = f"{h['price']} CNY"

print(json.dumps({
    "portfolio": pf,
    "decisions": dec,
    "watchlist": wl,
}, ensure_ascii=False, indent=2))
