全数据路径审计修复:price_monitor HK股价不再转CNY
审计发现(2026-07-03 15:00 systematic audit): 1. price_monitor 港股仍转 CNY (line 255, 306) → 改为存 HKD 原值, currency=HKD 2. strategy_lifecycle 质量门禁检查 currency=CNY (line 88-91) → 改为接受 HKD/CNY 3. strategy_lifecycle 新建策略写 currency='CNY' (line 2299) → 改为按代码判断 HKD/CNY 4. stale_push_wlin 两处直接 json.load(open(decisions.json)) → 改为 read_decisions() 5. stale_push_wlin 直接 json.load(open(portfolio.json)) → 改为 read_portfolio() 6. DB holdings/holding_strategies: 8只HK股currency从CNY改为HKD 7. calc_total_mv 增加港股HKD→CNY汇兑计算 验证: - 建滔 84.45 HKD 浮亏-4.3%(不是-24%) - 现金 132,121.93 总资产 953,295 - 所有8只HK股DB正确标记HKD - price_monitor已重启,下个tick用新逻辑写HKD原值 - stale_push_wlin已换用mo_data读DB
This commit is contained in:
+3
-7
@@ -250,14 +250,12 @@ def refresh_data_prices():
|
||||
if s['code'] in prices:
|
||||
price, _, change_pct = prices[s['code']]
|
||||
if price > 0:
|
||||
# 港股:API返回HKD,需转CNY。系统统一存CNY标价
|
||||
if is_hk_stock(s['code']):
|
||||
price = round(price * HK_RATE, 2)
|
||||
# 港股API返回HKD,直接存HKD原值。港股标价存HKD,A股标价存CNY
|
||||
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'] = 'CNY'
|
||||
s['currency'] = 'HKD' if is_hk_stock(s['code']) else 'CNY'
|
||||
updated += 1
|
||||
changed = True
|
||||
if changed:
|
||||
@@ -301,13 +299,11 @@ def refresh_data_prices():
|
||||
if s['code'] in prices:
|
||||
price, _, change_pct = prices[s['code']]
|
||||
if price > 0:
|
||||
# 港股:API返回HKD,需转CNY
|
||||
if is_hk_stock(s['code']):
|
||||
price = round(price * HK_RATE, 2)
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user