fix: HK stocks store HKD, calc_total_assets converts to CNY at aggregation

This commit is contained in:
知微
2026-07-03 23:29:37 +08:00
parent 8e487f400f
commit 9337130ca2
4 changed files with 95 additions and 19 deletions
+2 -2
View File
@@ -250,7 +250,7 @@ def refresh_data_prices():
if s['code'] in prices:
price, _, change_pct = prices[s['code']]
if price > 0:
# 港股API返回HKD,直接存HKD原值。港股标价存HKDA股标价存CNY
# 港股存 HKD 原值(跟股软一致),总资产汇总时由 calc_total_assets 统一转 CNY
old = s.get('price') or 0
if abs(old - price) > 0.001:
s['price'] = round(price, 2)
@@ -299,11 +299,11 @@ def refresh_data_prices():
if s['code'] in prices:
price, _, change_pct = prices[s['code']]
if price > 0:
# 港股存 HKD 原值(跟股软一致)
old = s.get('price') or 0
if abs(old - price) > 0.001:
s['price'] = round(price, 2)
s['change_pct'] = float(change_pct) if change_pct else 0
s['currency'] = 'HKD' if is_hk_stock(s['code']) else 'CNY'
updated += 1
changed = True
if changed: