总资产权威数据源统一修复

问题:总资产每次报告重新计算,数字不一致。
根因:cash字段错误(92664→73759),stale_push_wlin二次×0.866,
      报告各算各的。

修复:
1. portfolio.json cash 修正为Dad截图确认值73,758.85
2. price_monitor 每轮写入 total_mv + total_assets 到portfolio.json
   (从此所有报告只读这个字段,不自算)
3. stale_push_wlin 删除重复的 hmv *= 0.866(数据已CNY)
4. portfolio.json 加 currency: CNY 标记防混淆
5. 日志记录本次修复
This commit is contained in:
知微
2026-06-29 21:39:06 +08:00
parent a8d5418726
commit 9709c43ccb
8 changed files with 1453 additions and 782 deletions
+5
View File
@@ -163,6 +163,11 @@ def refresh_data_prices():
changed = True
if changed:
pf['updated_at'] = datetime.now().strftime('%Y-%m-%d %H:%M')
# 统一计算总资产:持仓市值 + 现金(所有港股价已×HK_RATE转CNY)
pf['total_mv'] = round(sum(
h.get('shares',0) * h.get('price',0) for h in pf.get('holdings',[])
), 2)
pf['total_assets'] = round(pf['total_mv'] + pf.get('cash',0), 2)
json.dump(pf, open(PORTFOLIO_PATH, 'w'), ensure_ascii=False, indent=2)
elif pf.get('updated_at'):
# 即使价格无变化,每10分钟刷新一次updated_at,防健康检查误报