fix: 价格更新后同步重算market_value(知微11:56修复,两次被deploy_guard回滚,代为入库)——持仓市值漂移根治
This commit is contained in:
@@ -463,6 +463,9 @@ def refresh_data_prices():
|
||||
if price_val > 0:
|
||||
h['price'] = round(price_val, 2)
|
||||
h['change_pct'] = float(change_pct) if change_pct else 0
|
||||
# 重新计算 market_value 保持与 price 同步
|
||||
shares = h.get('shares', 0)
|
||||
h['market_value'] = round(price_val * shares, 2)
|
||||
db_holdings.append(h)
|
||||
|
||||
# ── 写 holdings 表 ──
|
||||
|
||||
Reference in New Issue
Block a user