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 …