Conversation
Six signals were showing N/A in the backtest accuracy report because the backtest context builder wasn't providing the data they needed: - Injury Alpha: now loads injury_history to find OUT teammates per game - Back-to-Back: added recent_games JSONB fallback for B2B detection - Blowout Risk: estimates spread from team defensive rating differentials - Matchup History: extracts vs-opponent games from recent_games JSONB - CLV Tracker: computes model_direction from season baseline vs line - Defender Matchup: heuristic matching known elite/weak defenders by position Also adds all v2 signals (clv_tracker, defender_matchup, matchup_history, line_movement, fatigue, referee) to the frontend SIGNAL_DISPLAY config so they render with proper labels, descriptions, and chart colors. https://claude.ai/code/session_01RXgC7zzvzoDMkf7nJjecaR
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
This PR enhances the backtest engine with new signal types and improved context building by adding injury tracking, matchup history extraction, defender matchup detection, and CLV tracking capabilities.
Key Changes
Frontend (client/src/pages/backtest.tsx)
clv_tracker: Closing line value tracking (purple)defender_matchup: Primary defender impact (teal)matchup_history: Head-to-head performance (orange)line_movement: Sharp money detection (cyan)fatigue: Schedule & travel load (red)referee: Referee tendency adjustment (pink)Backend (server/nba-prop-model/src/evaluation/backtest_engine.py)
Data Loading: Added two new data loaders:
_load_injuries(): Loads injury history from database to track OUT/doubtful players by team and date_load_team_rosters(): Loads player rosters with positions for defender matchingContext Building: Enhanced
_build_context()with new features:Helper Methods:
_find_injured_teammates(): Locates injured players on a team for a given date_find_primary_defender(): Matches player position with known elite/weak defenders_estimate_spread(): Calculates estimated spread using defensive rating differential_extract_vs_team_history(): Parses recent_games JSONB to find head-to-head matchupsImproved B2B Detection: Enhanced
_detect_b2b()with fallback logic:Implementation Details
https://claude.ai/code/session_01RXgC7zzvzoDMkf7nJjecaR