Some checks failed
CI / test (pull_request) Has been cancelled
When gemini-2.5-flash quota is exhausted (20 RPD free tier), generate_playbook() fell back to _defensive_playbook() which only had price_change_pct_below: -3.0 SELL conditions — no BUY conditions — causing zero trades on US market despite scanner finding strong momentum/oversold candidates. Changes: - Add _smart_fallback_playbook() that uses scanner signals to build BUY conditions: - momentum signal: BUY when volume_ratio_above=VOL_MULTIPLIER - oversold signal: BUY when rsi_below=RSI_OVERSOLD_THRESHOLD - always: SELL stop-loss at price_change_pct_below=-3.0 - Use _smart_fallback_playbook() instead of _defensive_playbook() on Gemini failure - Add 10 new tests for _smart_fallback_playbook() covering momentum/oversold/empty cases - Update existing test_gemini_failure_returns_defensive to match new behavior Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>