revert(币种统一): 回退CNY转换

港股价格存原币(HKD),不存CNY。
Dad需要在股软里看港币价下单操作。
This commit is contained in:
知微
2026-06-29 17:46:14 +08:00
parent 6aa338ee4d
commit d82de939ff
8 changed files with 784 additions and 1559 deletions
-49
View File
@@ -1,49 +0,0 @@
#!/usr/bin/env python3
"""price_audit.py — 币种审计:检查所有涉及价格的代码是否有币种问题
运行方式:python3 price_audit.py > /tmp/price_audit.txt
"""
import os, sys, json, re
from pathlib import Path
# 关键文件列表
MOFIN = Path("/home/hmo/MoFin")
SCRIPT = Path("/home/hmo/.hermes/profiles/position-analyst/scripts")
SKILLS = Path("/home/hmo/.hermes/profiles/position-analyst/skills")
# 检查每个脚本
issues = []
for root in [MOFIN, SCRIPT]:
for f in sorted(root.glob("*.py")):
text = f.read_text()
name = f.relative_to(root)
# 1. 是否自己拉腾讯API
has_tencent = 'qt.gtimg.cn' in text
# 2. 是否读decisions.json
has_dec_read = 'decisions.json' in text
# 3. 是否读portfolio.json
has_pf_read = 'portfolio.json' in text
# 4. 是否有止损/买入区比较
has_stop_compare = bool(re.search(r'(stop_loss|entry_low|entry_high|take_profit)', text))
# 5. 是否有币种转换
has_currency = 'HK_RATE' in text or 'hkd_to_cny' in text or 'hk_rate' in text
# 判断风险
if has_tencent and has_stop_compare and not has_currency:
if 'stop_loss' in text:
issues.append(f"⚠️ HIGH {name}: 自己拉API({has_tencent}) + 比较stop_loss({has_stop_compare}) + 无币种转换({not has_currency})")
if has_tencent and has_dec_read and not has_currency:
issues.append(f"⚠️ MED {name}: 自己拉API({has_tencent}) + 读取decisions({has_dec_read}) + 无币种转换")
with open("/tmp/price_audit.txt", "w") as f:
f.write(f"币种审计报告 - {len(issues)} 个问题\n\n")
for i in sorted(issues, key=lambda x: (0 if 'HIGH' in x else 1)):
f.write(i + "\n")
print(f"审计完成:{len(issues)} 个币种风险点")
print("详见 /tmp/price_audit.txt")