Build a service that collects all current and resolved events from the crypto/15M section, stores their lifecycle metadata, and computes analytics per event:
- start time
- end time
- final resolution (if resolved)
- min/max probability (price) during the event window
- Market discovery (Gamma API)
- Periodically fetch markets.
- Filter by category/section:
crypto/15M. - Persist events + market metadata.
- Price streaming (CLOB WebSocket/RTDS)
- Subscribe to tokens for discovered markets.
- Persist price time series.
- Analytics processor
- Compute min/max price per event over
[start_time, end_time || now]. - Store aggregated analytics.
- Compute min/max price per event over
- API service
- Expose endpoints to query events and analytics.
events: core lifecycle info (start/end/resolution/status) + token_idprice_history: time series price points by token/marketevent_analytics: precomputed min/max/last price
- Scaffold project
- FastAPI app with typed models.
- Config layer for API base URLs + DB URLs.
- Gamma client
- Fetch markets via Gamma API.
- Normalize fields into
Eventrecords.
- CLOB client
- Fetch current price for token.
- (Later) WebSocket/RTDS streaming.
- Persistence layer
- Abstract repository interfaces (event repo, price repo, analytics repo).
- Start with in-memory implementation; swap for Postgres.
- Collector
- Scheduled job: fetch markets, upsert events, track tokens.
- Price ingestion
- Poll (temporary) + store price points; later upgrade to streaming.
- Analytics
- Compute min/max over event window; update aggregates.
- API endpoints
/events?category=crypto/15M/events/{event_id}/events/{event_id}/analytics
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn app.api.main:app --reload