Files
invest-copilot/tasks/complete-rotation-signals/SPEC.md
T
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.6 KiB

Task: Complete rotation signals and macro view

Goal

Implement the rotation signal generation and macro view endpoints for the sector rotation service.

Requirements

1. Signal generation in services/rotation_service.py

Implement generate_signals(ranked_sectors) method:

  • For each sector, determine rotation signal based on:
    • rank_change > 0 → "bullish" (rising)
    • rank_change < 0 → "bearish" (falling)
    • rank_change == 0 → "neutral" (unchanged)
  • Return list of signal dicts with sector info and signal type
  • Filter out sectors with insufficient data

2. Macro view in routers/rotation.py

Add GET /api/v1/rotation/macro endpoint:

  • Returns top 3 rising sectors and bottom 3 falling sectors
  • Includes sector name, ticker, momentum, and signal
  • Response model: MacroRotationResponse with rising and falling lists

3. Add response model

Add MacroRotationResponse schema in schemas/rotation.py:

  • rising: list[RisingSector]
  • falling: list[FallingSector]
  • Each sector: sector_name, sector_ticker, momentum, signal

Acceptance Criteria

  1. generate_signals() correctly classifies sectors
  2. /api/v1/rotation/macro endpoint returns correct data
  3. Response model is properly typed
  4. Tests pass for new endpoints

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 rotation endpoints
  • src/backend/schemas/rotation.py — existing schemas