feat: Feature 2.2 — Line Movement + Cascade Detection
Line movement system: - Baseline capture on first odds fetch of the day - Movement detection >= 0.5 points with direction (up/down) - Sharp money heuristic (sharp_action/public_action/unknown) - GET /api/movements with player, stat_type, min_movement filters - Movements included in GET /api/odds/nba live responses Cascade detection system: - Scratch detection: player props disappear from 2+ books - Affected user lookup via scan_sessions + picks - Parlay re-grade without scratched legs - cascade_alerts created for affected users - GET /api/alerts (Analyst/Desk only), PATCH /api/alerts/:id/read Zero extra Odds API credits — all detection piggybacks on existing fetches. Migration 002: line_baselines, line_movements, cascade_alerts tables. 30 new tests, 188 total (161 Node.js + 27 Python), all passing. Phase 2 Core Product COMPLETE. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+36
-39
@@ -4,7 +4,7 @@
|
||||
2026-03-21
|
||||
|
||||
## Current Phase
|
||||
Phase 2 — Core Product (IN PROGRESS)
|
||||
Phase 2 — Core Product (COMPLETE)
|
||||
|
||||
## What Has Shipped
|
||||
|
||||
@@ -12,56 +12,53 @@ Phase 2 — Core Product (IN PROGRESS)
|
||||
- Feature 1.1 — Odds API Integration
|
||||
- Feature 1.2 — NBA_API Stats Wrapper (FastAPI microservice)
|
||||
- Feature 1.3 — Prop Analysis Engine (6-step grading pipeline)
|
||||
- Feature 1.4 — Database Schema (6 tables, RLS, triggers in Supabase)
|
||||
- Feature 1.4 — Database Schema (6 tables + 3 new tables, RLS, triggers)
|
||||
|
||||
### Feature 2.1 — Parlay Scan (COMPLETE)
|
||||
- POST /api/scan/parlay — full parlay analysis with auth
|
||||
- Supabase JWT auth middleware (auth.getUser() verification)
|
||||
- 5 correlation types: same_game_opposing, same_game_same_team, same_player_conflicting, positive_correlation, blowout_cascade
|
||||
- Overall parlay grading (A/B/C/D) with correlation penalty adjustments
|
||||
- Free tier: 5 scans/month with atomic scan count (race-condition safe)
|
||||
- Scan 5: full analysis + personalized upgrade pitch
|
||||
- Scan 6+: 403 with upgrade pitch, no analysis
|
||||
- Paid tiers (analyst/desk): unlimited scans
|
||||
- Upgrade pitch personalization from scan history (stat types, grades, player patterns)
|
||||
- Tier recommendation: analyst for casual, desk for power users
|
||||
- Database writes: picks table (per leg) + scan_sessions table (per scan)
|
||||
- Founder pricing highlighted in all pitches
|
||||
- 5 correlation types, parlay grading, scan count tracking
|
||||
- Monetization: 5-scan free limit, personalized upgrade pitch at scan 5
|
||||
|
||||
### Feature 2.2 — Line Movement + Cascade Detection (COMPLETE)
|
||||
- Line movement: baseline capture on first fetch, movement detection >= 0.5 points
|
||||
- Sharp money heuristic (sharp_action/public_action/unknown)
|
||||
- Cascade detection: scratch detection via props disappearing from 2+ books
|
||||
- Re-grade affected parlays, create cascade_alerts for affected users
|
||||
- GET /api/movements — today's line movements with filters
|
||||
- GET /api/alerts — unread cascade alerts (Analyst/Desk only)
|
||||
- PATCH /api/alerts/:id/read — mark alert as read
|
||||
- Enhanced GET /api/odds/nba — movements included in live fetch response
|
||||
- Zero extra Odds API credits — piggybacks on existing fetches
|
||||
- Migration 002: line_baselines, line_movements, cascade_alerts tables
|
||||
|
||||
## Test Summary
|
||||
- Node.js: 131 tests passing (unit + integration)
|
||||
- Node.js: 161 tests passing (unit + integration)
|
||||
- Python: 27 tests passing
|
||||
- Total: 158 tests, all green
|
||||
- Total: 188 tests, all green
|
||||
|
||||
## What's Next
|
||||
- Feature 2.2 — Real-Time Line Movement + Cascade Detection (depends: 1.1)
|
||||
- Feature 1.5 — Bet Submission (depends: 1.4)
|
||||
- Feature 1.5 — Bet Submission (3 methods: screenshot, quickslip, sync)
|
||||
- Phase 3 — Web MVP (landing page, scan UI, bet tracker, Stripe)
|
||||
|
||||
## Active Blockers
|
||||
- BLOCKER-003: WSL2 DNS cannot resolve *.supabase.co (verify-schema.js cannot run from CLI)
|
||||
- BLOCKER-003: WSL2 DNS cannot resolve *.supabase.co
|
||||
- Migration 002 needs manual apply via Supabase SQL Editor
|
||||
|
||||
## Session Log
|
||||
|
||||
### Session 1 — 2026-03-21
|
||||
- Built Feature 1.1: Odds API Integration (28 tests)
|
||||
- Credits used: 2 of 500 (498 remaining)
|
||||
### Sessions 1-4 — 2026-03-21
|
||||
- Built Phase 1 (Features 1.1-1.4) + Feature 2.1 (Parlay Scan)
|
||||
- 158 tests passing
|
||||
|
||||
### Session 2 — 2026-03-21
|
||||
- Built Feature 1.2: FastAPI microservice (27 Python tests)
|
||||
- Built Feature 1.4: Database schema (37 tests), applied to Supabase
|
||||
|
||||
### Session 3 — 2026-03-21
|
||||
- Built Feature 1.3: Prop Analysis Engine (36 new tests)
|
||||
- Phase 1 Foundation COMPLETE
|
||||
|
||||
### Session 4 — 2026-03-21
|
||||
- Built Feature 2.1: Parlay Scan
|
||||
- auth.js (Supabase JWT middleware)
|
||||
- correlationEngine.js (5 correlation types)
|
||||
- parlayGrader.js (parlay-level grading with correlation penalties)
|
||||
- upgradePitch.js (personalized monetization pitch from scan history)
|
||||
- parlayScanService.js (orchestrator: auth → count → analyze → correlate → grade → persist → pitch)
|
||||
- routes/scan.js (POST /api/scan/parlay)
|
||||
### Session 5 — 2026-03-21
|
||||
- Built Feature 2.2: Line Movement + Cascade Detection
|
||||
- lineMovementService.js (baseline, movement detection, sharp heuristic)
|
||||
- cascadeService.js (scratch detection, affected user lookup, re-grade, alert creation)
|
||||
- alertService.js (alert CRUD)
|
||||
- routes: movements.js, alerts.js
|
||||
- Migration 002: 3 new tables (line_baselines, line_movements, cascade_alerts)
|
||||
- Integrated into oddsService.js (piggybacks on live fetch)
|
||||
- Enhanced odds route with movements in response
|
||||
- 30 new tests (unit + integration)
|
||||
- Logged DECISION-006 (auth via Supabase getUser) and DECISION-007 (atomic scan count)
|
||||
- Total: 158 tests (131 Node.js + 27 Python), all green
|
||||
- Phase 2 Core Product is now COMPLETE
|
||||
- Total: 188 tests (161 Node.js + 27 Python), all green
|
||||
|
||||
Reference in New Issue
Block a user