- 移除重复的系统健康检查-每日(no_agent版,与LLM版重叠) - 归档42个一次性脚本(移出MoFin/scripts→archive/scripts): - fix_*: 历史数据修复(11个) - migrate_*/rollback_*: 数据迁移(2个) - 一次性数据修复: bulk/close/data_freshness等(16个) - check_*/verify_*/diagnose_*: 历史诊断工具(12个) - test_*: 测试脚本(3个) - 84个活跃脚本, 0架构违规, 31张healthy数据表
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
"""Final verification: full data cycle after JSON→DB migration"""
|
|
import sys
|
|
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()
|
|
|
|
h = len(pf.get('holdings', []))
|
|
d = len(dec.get('decisions', []))
|
|
w = len(wl.get('stocks', []))
|
|
|
|
print(f"portfolio holdings: {h}")
|
|
print(f"decisions: {d}")
|
|
print(f"watchlist: {w}")
|
|
|
|
# Check one HK stock has correct CNY cost
|
|
for holding in pf.get('holdings', []):
|
|
if holding.get('code') == '01888':
|
|
print(f"\n01888 cost={holding.get('cost')} price={holding.get('price')} curr={holding.get('currency')}")
|
|
c = holding.get('cost', 0); p = holding.get('price', 0)
|
|
if c and p:
|
|
print(f"P&L: {(p-c)/c*100:.1f}%")
|
|
|
|
# Check decisions have currency=CNY
|
|
cnys = sum(1 for d in dec.get('decisions', []) if d.get('currency') == 'CNY')
|
|
print(f"\ndecisions with CNY: {cnys}/{d}")
|
|
|
|
# Check no JSON fallback in mo_data (pure DB)
|
|
with open('/home/hmo/MoFin/mo_data.py') as f:
|
|
content = f.read()
|
|
pure_db = 'json.load(open' not in content
|
|
print(f"mo_data pure DB: {'YES' if pure_db else 'NO — still has JSON'}")
|
|
|
|
print(f"\n{'ALL GOOD' if h and d and w else 'FAIL'}")
|