Logo Lanfrica

HezekiahAO/Bayse_terminal_backend

Domain:

socioeconomic

Record type:

software
Creator:
Hez
Host:
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 …