Commit Graph

2 Commits

Author SHA1 Message Date
知微 24a73103ed price_monitor港股币种修复+calc_total_mv汇兑处理
问题链:
  price_monitor 从东方财富/腾讯拿HK股价(HKD) → x0.87转CNY写portfolio
  → DB存CNY→下游混读→建滔显示-24%浮亏(实为-0.6%)
修复:
  price_monitor不转CNY,港股存HKD原值
  calc_total_mv()增加币种判断:HK股用get_hk_rate()转CNY再汇总
  portfolio.json/watchlist的HK股价全部HKD原值
  DB同步修正所有HK股价格为HKD
  price_monitor DB写入加3次重试+database locked timeout
验证:
  建滔 87.7 HKD 浮亏-0.6%(不是-24%)
  现金 132,121.93 总资产 956,714.68
2026-07-03 10:19:09 +08:00
hmo 6abc2e45b0 refactor: phase 0-2 MoFin architecture reform — single source of truth
Phase 0 (止血):
- mo_models.py: unified calc_total_assets(), is_hk_stock(), get_hk_rate() — single source of truth
- Fixed 3 files missing frozen_cash: holdings_reconciliation, server, import_holding_xls
- Fixed stale_push_wlin: unified is_hk_stock detection, removed hardcoded 0.866
- Fixed price_monitor: consolidated 2 duplicate total_assets blocks into mo_models calls
- Fixed stock_scorer: replaced broken len()<=5 is_hk_stock heuristic
- Fixed strategy_lifecycle: replaced non-existent currency_utils import with mo_models

Phase 1 (DSA adapter):
- mo_provider.py: wraps DSA DataFetcherManager (16 fetchers, auto-fallback)
  - TDX relay as primary, DSA as backup for realtime/kline/news/fundamentals

Phase 2 (Integration):
- mo_bridge.py: injects DSA market review + news context into MoFin analysis prompts
- Graceful degradation if DSA not installed

Infrastructure:
- mo_config.py: centralized Config singleton replacing scattered hardcoded paths
- All 11 changed files pass python compile check

Impact: total_assets now computed in ONE place (mo_models).
        is_hk_stock now ONE implementation (no more false negatives).
        HK rate now ONE source (hk_rate API → cache → 0.87 fallback).
        No more hardcoded 0.866/0.8664/0.8700 divergence.
2026-06-29 23:25:54 +08:00