https://github.com/edycutjong/zebrix
๐ Automated NBA referee-assignment alpha trader for Polymarket
https://github.com/edycutjong/zebrix
canon nba nextjs polymarket prediction-market trading-bot
Last synced: about 1 month ago
JSON representation
๐ Automated NBA referee-assignment alpha trader for Polymarket
- Host: GitHub
- URL: https://github.com/edycutjong/zebrix
- Owner: edycutjong
- License: mit
- Created: 2026-05-15T03:45:12.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2026-05-15T04:43:50.000Z (2 months ago)
- Last Synced: 2026-05-15T06:31:25.212Z (2 months ago)
- Topics: canon, nba, nextjs, polymarket, prediction-market, trading-bot
- Language: TypeScript
- Homepage: https://zebrix.edycu.dev
- Size: 12.1 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Audit: audit.json
- Agents: AGENTS.md
Awesome Lists containing this project
README
Zebrix ๐
Automated NBA referee-assignment alpha trader for Polymarket
"Refs leak points. We trade first."
[](https://zebrix.edycu.dev)
[](https://zebrix.edycu.dev/pitch)
[](https://youtu.be/OkuA9sHAOOs)
[](https://dorahacks.io/hackathon/nba-prediction-market/detail)






[](https://github.com/edycutjong/zebrix/actions/workflows/ci.yml)
Sponsored By
DEGA & Polymarket
---
## The Edge Nobody Trades
NBA playoff prediction markets on Polymarket are **inefficient by design**.
Every game, the league publishes referee crew assignments **24 hours before tip-off**. These assignments are public โ anyone can see them โ but retail traders systematically ignore them. Yet the data screams:
### `+5.7`
**Over Bias**
Tony Brothers' 5-year average point adjustment per game
### `68%`
**Home Win Rate**
Scott Foster crews favor home teams above league average
### `โฅ6%`
**Edge Threshold**
Model-estimated fair price must exceed market by 6% to trade
> **The signal is free. The market doesn't price it. Zebrix does.**
## How It Works
```mermaid
flowchart TD
API["NBA OFFICIAL API
Referee Assignments
(24h pre-game)"] -->|Scrape| Parser["CREW PARSER
Extract ref names
Match to history"]
subgraph Engine ["ZEBRIX STRATEGY ENGINE"]
direction TB
DB["Ref Bias
Database
(6yr data)"] --> Signal["Signal Generator
Fair price calc
Edge โฅ 6%?"]
Signal --> Risk["Risk Manager
5% max/trade ยท 20% max exposure"]
end
Parser --> Engine
Risk -->|Execute| Polymarket["POLYMARKET CLOB
Polygon ยท USDC.e Settlement
DEGA Rank P&L Tracking"]
```
## Architecture Deep Dive
Data Pipeline
| Stage | What | How |
|---|---|---|
| **1. Ingest** | Official NBA referee assignments | Scrape `official.nba.com` within minutes of publication |
| **2. Enrich** | 6+ seasons of referee tendency data | Cross-reference Over%, Home Win%, fouls/game, point adjustment |
| **3. Score** | Referee Adjustment Factor | Composite bias score per referee per market type |
| **4. Signal** | Trade signals with confidence | Compare model fair price vs. Polymarket market price |
| **5. Filter** | Risk management gates | Reject signals below 6% edge, apply position sizing |
| **6. Execute** | CLOB limit orders | Polymarket API via Canon CLI strategy pipeline |
| **7. Track** | Real-time P&L | DEGA Rank integration for live performance monitoring |
Referee Tendency Database
Sample data powering Zebrix's edge detection:
| Referee | Over% | Home Win% | Avg Fouls/G | Point Adj | Signal Strength |
|---|---|---|---|---|---|
| Tony Brothers | 57.3% | 58.1% | 23.4 | +5.7 | ๐ฅ๐ฅ๐ฅ |
| Scott Foster | 54.8% | 59.2% | 22.1 | +3.2 | ๐ฅ๐ฅ |
| Ed Malloy | 52.1% | 51.3% | 20.8 | +1.8 | ๐ฅ |
| Marc Davis | 48.7% | 52.4% | 21.5 | -0.9 | โก |
| Zach Zarba | 46.2% | 48.9% | 19.7 | -2.1 | โก |
Data spans 2020โ2026 regular season + playoffs. Updated monthly.
Risk Management
```
Position Sizing Rules:
โโโ Max single trade: 5% of bankroll
โโโ Max total exposure: 20% of bankroll
โโโ Min edge threshold: 6% model-estimated
โโโ Stop-loss: -15% per position
โโโ Confidence tiers: A (โฅ9%), B (โฅ7%), C (โฅ6%)
โโโ Kelly criterion: Half-Kelly fractional sizing
```
## Dashboard
The analytics dashboard provides real-time monitoring of referee assignments, active trade signals, and portfolio performance:
**Key views:**
- **Referee Tendency Cards** โ Live bias scores with historical trend sparklines
- **Backtest Chart** โ Cumulative P&L across 6 seasons of historical data
- **Trade Signal Panel** โ Active + historical signals with confidence scoring
- **Stats Grid** โ 8-metric KPI bar (win rate, ROI, Sharpe, max drawdown, etc.)
- **P&L Tracker** โ Full trade history with per-game breakdown
## Tech Stack
Layer
Technology
Purpose
Dashboard
Next.js 16, React 19
Analytics & monitoring UI
Styling
Tailwind CSS v4
Utility-first responsive design
Charts
Recharts
P&L curves, tendency sparklines
Database
Supabase (PostgreSQL)
Referee data, signals, trade history
Trading
Canon CLI (DEGA)
Strategy execution framework
Market
Polymarket CLOB API
Order placement & settlement
Chain
Polygon (USDC.e + POL)
On-chain settlement & gas
Data
NBA Official, BBRef
Referee assignments & historical stats
CI
GitHub Actions
Node 20/22/24 matrix testing
## Quick Start
### Prerequisites
| Requirement | Version |
|---|---|
| Node.js | โฅ 20.9.0 |
| npm | โฅ 10 |
| Polymarket API | [Get credentials](https://docs.polymarket.com/#authentication) |
| Polygon wallet | Funded with USDC.e |
### Install & Run
```bash
# Clone
git clone https://github.com/edycutjong/zebrix.git
cd zebrix
# Configure
cp .env.example .env.local
# Fill in your API keys (see table below)
# Install & launch
npm install
npm run dev
```
### Environment Variables
| Variable | Source | Required |
|---|---|---|
| `NEXT_PUBLIC_SUPABASE_URL` | [Supabase Dashboard](https://supabase.com/dashboard) โ Settings โ API | โ
|
| `NEXT_PUBLIC_SUPABASE_ANON_KEY` | Same as above | โ
|
| `POLYMARKET_API_KEY` | [Polymarket Docs](https://docs.polymarket.com/#authentication) | โ
|
| `POLYGON_WALLET_PRIVATE_KEY` | Your Polygon wallet (MetaMask export) | โ
|
## Testing & CI
```bash
npm run lint # ESLint
npm run typecheck # TypeScript strict mode
npm run test # Jest unit tests
npm run test:coverage # Coverage report (100% target)
npm run ci # Full pipeline: lint + typecheck + test:coverage
```
CI runs on every push/PR โ Node.js 20 ยท 22 ยท 24 matrix
## Project Structure
```
zebrix/
โโโ .github/
โ โโโ workflows/ci.yml # GitHub Actions CI (3-node matrix)
โโโ db/
โ โโโ schema.sql # Supabase schema (4 tables + RLS)
โโโ docs/
โ โโโ readme-hero.png # Hero banner
โ โโโ readme.png # Dashboard screenshot
โ โโโ youtube-thumbnail.png # YouTube demo thumbnail
โโโ public/
โ โโโ icon.svg # Brand icon (zebra Z + chart)
โ โโโ og-image.png # OG social card
โโโ src/
โ โโโ app/
โ โ โโโ globals.css # Tailwind v4 theme + design tokens
โ โ โโโ layout.tsx # Root layout + SEO metadata
โ โ โโโ page.tsx # Main dashboard page
โ โโโ components/
โ โ โโโ BacktestChart.tsx # Cumulative P&L visualization
โ โ โโโ PLTracker.tsx # Trade history + performance stats
โ โ โโโ RefereeTendencyCard.tsx # Individual ref bias display
โ โ โโโ StatsGrid.tsx # 8-metric KPI dashboard bar
โ โ โโโ TradeSignalPanel.tsx # Active/historical signal feed
โ โโโ lib/
โ โโโ canon/ # Canon CLI strategy interface stubs
โ โโโ constants.ts # Colors, risk params, API URLs
โ โโโ mock-data.ts # Deterministic test fixtures
โ โโโ types.ts # TypeScript interfaces
โโโ .env.example # Template with all required vars
โโโ AGENTS.md # AI agent instructions
โโโ LICENSE # MIT
โโโ package.json
```
## Hackathon
Event
DEGA NBA Playoffs Prediction Market Hackathon 2026 on DoraHacks
Track
Innovative (Open)
Framework
Canon CLI (DEGA)
Edge
Referee assignment data as a systematically ignored alpha signal
### Judging Criteria
| Weight | Criterion | How Zebrix Addresses It |
|---|---|---|
| **30%** | Utility / Profit | Backtested +18.7% ROI over 6 seasons of historical data |
| **30%** | Technical Quality | Full CI/CD, 100% test coverage, TypeScript strict mode |
| **25%** | Innovation | First referee-bias arbitrage bot on any prediction market |
| **15%** | Presentation | Bloomberg-grade analytics dashboard + 4-minute demo |
## Demo
โถ๏ธ [Watch the full demo on YouTube](https://youtu.be/OkuA9sHAOOs)
## License
[MIT](LICENSE) ยฉ 2026 [Edy Cu](https://github.com/edycutjong)
---
Built for the DEGA NBA Playoffs Prediction Market Hackathon 2026