Spaces:
Sleeping
title: WagerKit
emoji: ๐
colorFrom: purple
colorTo: blue
sdk: docker
pinned: false
license: mit
WagerKit ๐ฏ
Real-time prediction market analysis with integrity scoring
WagerKit aggregates data from multiple prediction market sources (Polymarket, Kalshi, PredictIt) and provides comprehensive integrity analysis for each market.
โจ Features
- ๐ Multi-Source Aggregation: Compare odds across leading prediction markets
- ๐ฏ Integrity Scoring: 4-component analysis (Clarity, Liquidity, Agreement, Volatility)
- ๐ Visual Analytics: Real-time odds history charts with Chart.js
- ๐ฅ Export Tools: PDF dossiers, CSV data exports, JSON metadata
- โก Background Processing: BullMQ-powered workers for instant dashboard loads
- ๐จ Modern UI: Dark theme, responsive design with Tailwind CSS
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Docker Container (HF Space) โ
โ โ
โ Redis โโโบ NestJS Backend (BullMQ) โ
โ โ โ
โ Next.js Frontend โ
โ (Port 7860) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Quick Start
On Hugging Face Spaces
Simply clone this Space or visit the live demo!
Local Development
# Clone the repository
git clone <your-repo-url>
cd wagerkit
# Start with Docker Compose
docker-compose up
# Or run individually:
# Terminal 1: Redis
docker run -d -p 6379:6379 redis:7-alpine
# Terminal 2: Backend
cd backend && npm install && npm run start:dev
# Terminal 3: Frontend
cd frontend && npm install && npm run dev
Access at: http://localhost:3000
๐ Integrity Score Formula
Overall Score = 100 ร (0.40รC + 0.30รL + 0.20รA + 0.10รV)
- C (Market Clarity): Resolution criteria quality, source coverage
- L (Liquidity Depth): Trading volume, update frequency
- A (Cross-Source Agreement): RMSE between sources
- V (Volatility Sanity): Price stability, spike detection
๐ ๏ธ Tech Stack
Backend:
- NestJS 10 (TypeScript)
- BullMQ (background jobs)
- Redis (job queue & cache)
Frontend:
- Next.js 14 (App Router)
- React 18
- Chart.js (visualization)
- Tailwind CSS (styling)
- jsPDF (PDF export)
๐ฆ Deployment
See DEPLOYMENT.md for detailed instructions on:
- Hugging Face Spaces setup
- Docker configuration
- Environment variables
- Local development
๐ฎ Usage
- Dashboard: View all markets with processing status badges
- Click any card: Navigate to detailed market analysis
- View Charts: Compare historical odds across 4 sources
- Export Data: Download PDF dossiers, CSV odds history, or JSON metadata
๐ Project Structure
wagerkit/
โโโ backend/ # NestJS backend
โ โโโ src/
โ โ โโโ markets/ # Markets module (BullMQ workers)
โ โ โโโ auth/ # Auth module (unused in demo)
โ โ โโโ main.ts
โ โโโ Dockerfile # Backend Docker image
โ โโโ package.json
โโโ frontend/ # Next.js frontend
โ โโโ src/
โ โ โโโ app/ # App router pages
โ โ โโโ components/ # Reusable components
โ โ โโโ lib/ # API client
โ โโโ Dockerfile # Frontend Docker image
โ โโโ package.json
โโโ Dockerfile # Multi-stage build (HF Spaces)
โโโ docker-compose.yml # Local development
โโโ DEPLOYMENT.md # Detailed deployment guide
โโโ README.md
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
๐ License
MIT License
๐ Acknowledgments
Built with data from leading prediction markets. This is a demonstration project showcasing real-time data aggregation and integrity analysis techniques.
Documentation: DEPLOYMENT.md Each market includes:
- Integrity Score (0-100) with 4 sub-components:
- Market Clarity (40% weight)
- Liquidity Depth (30% weight)
- Cross-Source Agreement (20% weight)
- Volatility Sanity (10% weight)
- Odds History Chart - 24-hour price trends from 3 sources
- Data Sources - Polymarket, Kalshi, PredictIt
- Export Options:
- โ Download Dossier (PDF)
- โ Download Dossier (JSON)
- โ Export Odds CSV
- โ Export Integrity CSV
๐ Integrity Score Formula
Score = 100 ร (0.40รC + 0.30รL + 0.20รA + 0.10รV)
Where:
- C = Market Clarity
- L = Liquidity Depth
- A = Cross-Source Agreement (RMSE-based)
- V = Volatility Sanity (includes spike detection)
๐ง Tech Stack
Backend
- NestJS 10
- TypeScript
- JWT Authentication (ready but disabled)
- Express.js
Frontend
- Next.js 14
- React 18
- TypeScript
- TailwindCSS
- Chart.js (for odds visualization)
- jsPDF (for PDF exports)
๐ API Endpoints
Markets
GET /api/markets- List all marketsGET /api/markets/:slug- Get market detail with integrity scoresGET /api/markets/:slug/export/odds-csv- Export odds history CSVGET /api/markets/:slug/export/integrity-csv- Export integrity scores CSVGET /api/markets/:slug/export/dossier-json- Export full dossier JSON
Authentication (Optional)
POST /api/auth/login- Login endpoint (not required for demo)
๐ Environment Variables
Backend (backend/.env)
JWT_SECRET=wagerkit-jwt-secret-key-2024
DOME_API_KEY=your-dome-api-key-here
PORT=3001
Frontend (frontend/.env.local)
NEXT_PUBLIC_API_URL=http://localhost:3001/api
๐จ Design Theme
- Dark purple/blue gradient background
- Card-based UI with
#12121ebackground - Purple (
#6b21a8) and blue (#3b82f6) accent colors - Responsive design with Tailwind CSS
๐ฎ DOME API Integration (Future)
The app is designed to integrate with the DOME API. To enable real data:
Install SDK:
cd backend npm install @dome-api/sdkAdd API Key to
backend/.env:DOME_API_KEY=your-actual-api-keyUpdate Service in
backend/src/markets/markets.service.ts:- Uncomment the DOME SDK import
- Replace simulated data methods with real API calls
Currently uses simulated data with realistic patterns for demo purposes.
๐ข Deployment
Build Production
# Backend
cd backend
npm run build
npm run start:prod
# Frontend
cd frontend
npm run build
npm start
๐ Notes
- Authentication is disabled for easy demo access
- Data is simulated but follows real market patterns
- All export features are fully functional
- Runs entirely locally - no external dependencies required
Built for client demo - February 2026