feat: multiple updates - alerts, auth, sectors, rotation service, financials ingestion, task specs, and agent framework
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
# Task: Wire Backtest Integration
|
||||
|
||||
## Current State
|
||||
|
||||
`src/backend/services/backtest_service.py` (16,798 bytes) exists with backtesting logic. `POST /api/v1/strategies/{id}/backtest` endpoint exists per README. However, the backtest engine is not connected to the data pipeline — it runs against whatever data happens to be in the DB, with no guarantee of freshness or completeness.
|
||||
|
||||
## Goal
|
||||
|
||||
Connect the backtest engine to the data pipeline so:
|
||||
1. Backtests always run against a known-good, pipeline-fresh dataset
|
||||
2. Backtest results are stored and queryable
|
||||
3. Users can trigger backtests via the API and see results
|
||||
|
||||
## Requirements
|
||||
|
||||
1. Verify `backtest_service.py` reads from database correctly
|
||||
2. Add backtest result storage model (SQLAlchemy)
|
||||
3. Store backtest results: trades, metrics, equity curve
|
||||
4. Add `GET /api/v1/backtests/{id}` endpoint to retrieve results
|
||||
5. Add `GET /api/v1/backtests` endpoint to list past backtests
|
||||
6. Ensure backtest runs after pipeline completes (dependency on pipeline task)
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- Backtest endpoint returns results with trades, metrics, equity curve
|
||||
- Results persist in database and survive server restart
|
||||
- Past backtests queryable via list endpoint
|
||||
- Backtest uses data from the most recent pipeline run
|
||||
- Frontend can display backtest results on strategy page
|
||||
|
||||
## Constraints
|
||||
|
||||
- Use TimescaleDB hypertables for equity curve time-series data
|
||||
- Follow existing patterns — check `models/` for existing backtest model
|
||||
- Keep under 200 lines per framework rule
|
||||
- Read existing migrations before writing schema
|
||||
|
||||
## Files to Create/Modify
|
||||
|
||||
- `src/backend/models/` (check for existing backtest model, add if missing)
|
||||
- `src/backend/services/backtest_service.py` (add result storage)
|
||||
- `src/backend/routers/strategies.py` (add result endpoints)
|
||||
- `src/backend/tasks/pipeline.py` (add backtest trigger option)
|
||||
|
||||
## Next Steps After This Task
|
||||
|
||||
Phase 2 complete. Move to Phase 5 (Sector Rotation) or Phase 7 (PWA).
|
||||
Reference in New Issue
Block a user