Fix 10 bugs from QA audit: drawdown, PDT, Sharpe, reviewer alignment#115
Merged
mikejamescalvert merged 1 commit intomainfrom Mar 27, 2026
Merged
Conversation
… alignment Quick wins: - Fix EquityTracker.current_drawdown() returning negative values (clamp to 0) - Recover peak equity from history when peak file is corrupted - Fix DrawdownCircuitBreaker REDUCE_SIZE multiplier (0.75→0.50, matches docstring) - Fix Sharpe/Sortino using population std instead of sample std - Change performance report lookback from 30→90 days for statistical significance - Fix PDT protection: use enum .value instead of str() for order side comparison - Add timezone safety to cooldown check (naive→aware datetime fix) - Prune expired cooldowns on load (prevents unbounded growth) Strategy alignment: - Rewrite portfolio reviewer prompt for aggressive momentum (was giving defensive advice like "diversify" to a concentrated momentum strategy) - Remove category-based issue dedup (was blocking all new suggestions when any issue in same category existed) — keep title-based only - Enforce held positions stay on watchlist (code-level guarantee, not just AI prompt instruction) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Deep dive QA audit across all 38 source files found ~80 issues. This PR fixes the 10 highest-impact ones (quick wins + strategy alignment).
Bug Fixes (8)
EquityTracker.current_drawdown()went negative when equity exceeded peak, confusing the circuit breaker. Now clamped to 0.peak_equity.jsonwas missing/corrupt, peak reset to 0 forever. Now recovers from equity history.str(o.side)might produce"OrderSide.BUY"not"buy". Now uses.valuefor reliable enum extraction.Strategy Alignment (3)
Test plan
order_blocked_pdt)🤖 Generated with Claude Code