fix: KeyError 'stats' in cycle log line — use .get() defensively
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -141,7 +141,7 @@ def run_cycle_once(trigger: str = "auto") -> Dict[str, Any]:
|
||||
logger.info(
|
||||
f"[Cycle {run_id[:16]}] Portfolio lessons loaded "
|
||||
f"(report from {portfolio_lessons.get('created_at','?')[:10]}, "
|
||||
f"{age_hours:.0f}h ago, avg_pnl={portfolio_lessons['stats'].get('avg_pnl_pct')}%)"
|
||||
f"{age_hours:.0f}h ago, avg_pnl={portfolio_lessons.get('stats', {}).get('avg_pnl_pct')}%)"
|
||||
)
|
||||
else:
|
||||
logger.info(f"[Cycle {run_id[:16]}] No portfolio report yet — cycle runs without performance feedback")
|
||||
|
||||
Reference in New Issue
Block a user