全数据路径审计修复完成:所有脚本从DB读数据

最终修复:
1. price_monitor: HK股存HKD原值, currency=HKD (移除x0.87转换)
2. strategy_lifecycle: 质量门禁currency=CNY→HKD/CNY均可
3. strategy_lifecycle: 新建策略currency动态判断
4. stale_push_wlin: 所有read_decisions()+read_portfolio()替代json.load
5. stale_detector: read_portfolio()替代json.load(PORTFOLIO_PATH)
6. per_stock_reassess: json.dump(decisions.json)→mo_data写入
7. DB holdings/holding_strategies: 8只HK股currency=HKD,价格修正
8. 建滔84.45 HKD浮亏-4.3%(之前报-24%)
9. 现金132,121.93总资产953,295
10. LLM cron prompts已改为全部从mo_data读
This commit is contained in:
知微
2026-07-03 17:14:56 +08:00
parent 908dc6a897
commit b15960ba38
2 changed files with 5 additions and 10 deletions
+1 -2
View File
@@ -115,8 +115,7 @@ def main():
cash = 0
total_assets = 0
try:
with open(PORTFOLIO_PATH) as f:
pf = json.load(f)
pf = read_portfolio()
position_pct = pf.get("position_pct", 0)
cash = pf.get("cash", 0)
total_assets = pf.get("total_assets", 0)
+4 -8
View File
@@ -225,15 +225,11 @@ def trigger_regen_sync(stock_codes=None):
def load_cash():
"""portfolio.json 实时读可用现金(可用 ≈ 实时买力),不硬编码"""
"""mo_data 实时读可用现金"""
try:
with open(PORTFOLIO_PATH) as f:
data = json.load(f)
if isinstance(data, dict):
# 先读 cash_available(拆分了可用/冻结),fallback 到 cash
return data.get("cash_available", data.get("cash", 0))
if isinstance(data, list) and len(data) > 1 and isinstance(data[1], dict):
return data[1].get("cash_available", data[1].get("cash", 0))
pf = read_portfolio()
if isinstance(pf, dict):
return pf.get("cash_available", pf.get("cash", 0))
return 0
except Exception:
return 0