test: 33/33 pass + fix last 4 json.load in strategy_lifecycle + analytics dead code

This commit is contained in:
知微
2026-07-04 09:45:27 +08:00
parent 4e080d4fc5
commit 5b9f22a643
5 changed files with 212 additions and 6 deletions
+4 -4
View File
@@ -1545,7 +1545,7 @@ def _get_portfolio_risk_state():
try:
# 数据一致性检查:警告多副本(2026-06-23 bugfix
_check_portfolio_consistency()
p = json.load(open('/home/hmo/web-dashboard/data/portfolio.json'))
p = read_portfolio()
pos_pct = p.get('position_pct', 0)
cash = p.get('cash', 0)
holdings = p.get('holdings', [])
@@ -1611,7 +1611,7 @@ def _check_contradiction(code, today_only=True):
"""
try:
from datetime import datetime, date
dec = json.load(open('/home/hmo/web-dashboard/data/decisions.json'))
dec = read_decisions()
for e in dec.get('decisions', []):
if e.get('code') != code:
continue
@@ -1650,7 +1650,7 @@ def _get_sell_priority_list():
按卖出的优先顺序排列(最先应该卖的在最前)
"""
try:
p = json.load(open('/home/hmo/web-dashboard/data/portfolio.json'))
p = read_portfolio()
holdings = p.get('holdings', [])
ranked = []
for h in holdings:
@@ -1887,7 +1887,7 @@ def reassess_with_context(code, name, price, cost, shares, current_action,
# 6. 防洗盘:信号不要一天一翻(2026-06-23)
# 如果旧信号是买入/持有类,新信号是谨慎/等待类,但中期趋势未破→维持旧信号
try:
dec = json.load(open('/home/hmo/web-dashboard/data/decisions.json'))
dec = read_decisions()
for e in dec.get('decisions', []):
if e.get('code') == code:
old_signal = e.get('timing_signal', '')