49 lines
1.4 KiB
Markdown
49 lines
1.4 KiB
Markdown
# Task: Rotation macro data endpoint
|
|||
|
|
|
||
|
|
## Goal
|
||
|
|
Add the macro data endpoint that provides the full sector rotation overview with all required fields for the frontend.
|
||
|
|
|
||
|
|
## Requirements
|
||
|
|
|
||
|
|
### Endpoint: `GET /api/v1/rotation/macro-full`
|
||
|
|
|
||
|
|
Returns complete sector rotation data:
|
||
|
|
- All sectors with their current ranking
|
||
|
|
- Momentum scores (20d, 50d)
|
||
|
|
- Relative strength vs benchmark
|
||
|
|
- Rotation signals (bullish/bearish/neutral)
|
||
|
|
- Rank changes from previous period
|
||
|
|
|
||
|
|
### Response model `FullRotationResponse` in `schemas/rotation.py`
|
||
|
|
|
||
|
|
```python
|
||
|
|
class FullRotationResponse(BaseModel):
|
||
|
|
sectors: list[SectorRotationDetail]
|
||
|
|
benchmark: str
|
||
|
|
as_of: str # ISO timestamp
|
||
|
|
period: str # e.g., "20d"
|
||
|
|
```
|
||
|
|
|
||
|
|
### Service method
|
||
|
|
|
||
|
|
Add `get_full_rotation(period="20d")` to `rotation_service.py`:
|
||
|
|
- Queries all sector data
|
||
|
|
- Joins with benchmark data
|
||
|
|
- Returns formatted response
|
||
|
|
|
||
|
|
## Acceptance Criteria
|
||
|
|
1. `/api/v1/rotation/macro-full` returns complete rotation data
|
||
|
|
2. All fields properly typed and validated
|
||
|
|
3. Tests pass for new endpoint
|
||
|
|
4. File stays under 200 lines
|
||
|
|
|
||
|
|
## Files to Modify
|
||
|
|
- `src/backend/services/rotation_service.py`
|
||
|
|
- `src/backend/routers/rotation.py`
|
||
|
|
- `src/backend/schemas/rotation.py`
|
||
|
|
|
||
|
|
## Files to Read First
|
||
|
|
- `src/backend/services/rotation_service.py` — current state
|
||
|
|
- `src/backend/routers/rotation.py` — existing endpoints
|
||
|
|
- `src/backend/schemas/rotation.py` — existing schemas
|