4 Commits

Author SHA1 Message Date
2612b85431 feat: implement date range support with period metrics in results endpoint
- Replace deprecated `date` parameter with `start_date`/`end_date`
- Return single-date format (detailed) when dates are equal
- Return range format (lightweight with period metrics) when dates differ
- Add period metrics: period_return_pct, annualized_return_pct, calendar_days, trading_days
- Default to last 30 days when no dates provided
- Group results by model for date range queries
- Add comprehensive test coverage for both response formats
- Implement automatic edge trimming for date ranges
- Add 404 error handling for empty result sets
- Include 422 error for deprecated `date` parameter usage
2025-11-07 19:26:06 -05:00
5c95180941 feat: add date validation and resolution for results endpoint 2025-11-07 19:18:35 -05:00
29c326a31f feat: add period metrics calculation for date range queries 2025-11-07 19:14:10 -05:00
93ba9deebb feat: add new day-centric results API endpoint
Implements new /results endpoint with day-centric data structure:
- Returns starting_position, daily_metrics, trades, and final_position
- Supports reasoning levels: none (default), summary, full
- Uses database helper methods from trading_days schema
- Replaces old positions-based endpoint

Changes:
- Created api/routes/results_v2.py with new endpoint
- Registered router in api/main.py
- Removed old /results endpoint (positions table)
- Added comprehensive integration tests

All tests pass.
2025-11-03 23:43:52 -05:00