[Exchange] Price history tracking done

← Exchange
E2.1: Create price_history table (hypothesis_id, price, score, event_type, event_source, created_at). Insert a row whenever composite_score changes in post_process.py. Backfill initial prices for all hypotheses. Add GET /api/hypothesis/{id}/history. Acceptance: price_history populated. API returns time series data.

Completion Notes

Auto-release: non-recurring task produced no commits this iteration; requeuing for next cycle
Spec File

[Exchange] Price history tracking

Goal

Create price_history table (hypothesis_id, price, score, event_type, event_source, created_at). Insert a row whenever composite_score changes in post_process.py. Backfill initial prices for all hypotheses. Add GET /api/hypothesis/{id}/history.

Acceptance Criteria

☑ price_history table created with correct schema
☑ price_history populated with initial data (118 hypotheses backfilled)
☑ post_process.py tracks score changes and inserts history entries
☑ API endpoint GET /api/hypothesis/{id}/history returns time series data

Approach

  • Read AGENTS.md and relevant source files
  • Understand existing code patterns before modifying
  • Implement changes following existing conventions (f-string HTML, SQLite, Bedrock Claude)
  • Test: curl affected pages, verify rendering, run scidex status
  • Commit atomically with descriptive message
  • Work Log

    2026-04-01 — Multiple Agents (Slot 0)

    • Started task: Create price_history tracking for hypothesis score changes
    • Read existing code in api.py, post_process.py, database schema
    • Created migrations/add_price_history.py to create table with proper schema
    • Ran migration: created price_history table with indexes
    • Backfilled 118 hypotheses with initial price records
    • Modified post_process.py to insert price_history records on score changes (lines 91-148)
    • Added GET /api/hypothesis/{id}/history endpoint to api.py
    • Tested: All key pages load correctly (/, /exchange, /gaps, /analyses/), 0 broken links
    • Verified: 236 price history records across 118 hypotheses
    • Restarted scidex-api service
    • Result: Done — Price history tracking fully implemented and tested

    Sibling Tasks in Quest (Exchange) ↗