1.4 KiB
1.4 KiB
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
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
/api/v1/rotation/macro-fullreturns complete rotation data- All fields properly typed and validated
- Tests pass for new endpoint
- File stays under 200 lines
Files to Modify
src/backend/services/rotation_service.pysrc/backend/routers/rotation.pysrc/backend/schemas/rotation.py
Files to Read First
src/backend/services/rotation_service.py— current statesrc/backend/routers/rotation.py— existing endpointssrc/backend/schemas/rotation.py— existing schemas