Build with Ai Hackaton Repository where we built an African macroeconomic signal engine for Bayse prediction markets. Monitors African economic indicators, detects anomalies, and auto-generates prediction market events with AI-priced opening probabilities.
# IfaQuant π
> African macroeconomic signal engine for Bayse prediction markets.
> Monitors African economic indicators, detects anomalies, and auto-generates
> prediction market events with AI-priced opening probabilities.
---
## What it does
1. **Ingests** African macro data from World Bank, IMF, and news APIs on a cron schedule
2. **Detects** statistical anomalies using a rolling z-score model (|z| β₯ 2.0 = flagged)
3. **Generates** a well-formed Bayse prediction market question using Claude AI
4. **Prices** the opening probability using a Beta-distribution Bayesian model
5. **Publishes** signal alerts and draft events in real-time over WebSocket
6. **Exposes** a REST API for Bayse to query approved events and display them to traders
---
## Architecture
```
World Bank / IMF / News APIs
β
βΌ
Celery beat (every 6h)
β
βΌ
Celery worker
βββ WorldBankClient (httpx, async fetching)
βββ SignalDetector (z-score anomaly detection)
βββ EventGenerator (Claude AI + ProbabilityPricer)
β
ββββΊ PostgreSQL (signals, events, history)
ββββΊ Redis (job queue + pub/sub)
β
βΌ
FastAPI server
βββ REST API /api/v1/signals /api/v1/events
βββ WebSocket /ws βββ Redis pub/sub fan-out
β
βΌ
Bayse Platform / Admin Dashboard
```
---
## Tech Stack
| Layer | Technology | Why |
|---|---|---|
| Web framework | FastAPI | Async-native, automatic OpenAPI docs, WebSocket support |
| Task queue | Celery + Redis | Scheduled ingestion, background AI generation |
| Database | PostgreSQL + SQLAlchemy (async) | JSONB for raw payloads, composite indexes, migrations |
| Cache / Broker | Redis | Celery broker, WebSocket pub/sub fan-out |
| AI | Anthropic Claude | Event drafting + reasoning |
| Quant model | Beta distribution (scipy) | Principled probability priors |
| HTTP client | httpx | Async, retry-capable |
| Migrations | Alembic | Schema versioning |
---
## Quick Start
### 1. Prerequisites
- Docker + Docker Compose
- An Anthropic API key (`claude-sonnet-4-20250514`)
- (Optional) A New β¦