Files
gitea a16050c80a
CI / lint-and-build (push) Has been cancelled
CI / python-checks (3.12) (push) Has been cancelled
feat: multiple updates - alerts, auth, sectors, rotation service, financials ingestion, task specs, and agent framework
2026-06-06 22:01:40 -04:00

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

  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