An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          



Zebrix ๐Ÿ€


Automated NBA referee-assignment alpha trader for Polymarket

"Refs leak points. We trade first."


Zebrix


[![Live Demo](https://img.shields.io/badge/๐Ÿš€_Live-Demo-06b6d4?style=for-the-badge)](https://zebrix.edycu.dev)
[![Pitch Deck](https://img.shields.io/badge/๐Ÿ“Š_Pitch-Deck-f59e0b?style=for-the-badge)](https://zebrix.edycu.dev/pitch)
[![Pitch Video](https://img.shields.io/badge/๐ŸŽฌ_Pitch-Video-ef4444?style=for-the-badge)](https://youtu.be/OkuA9sHAOOs)
[![Built for Hackathon](https://img.shields.io/badge/DoraHacks-DEGA_NBA-8b5cf6?style=for-the-badge)](https://dorahacks.io/hackathon/nba-prediction-market/detail)


![Next.js](https://img.shields.io/badge/Next.js_16-black?logo=next.js)
![React](https://img.shields.io/badge/React_19-61DAFB?logo=react&logoColor=black)
![Tailwind](https://img.shields.io/badge/Tailwind_v4-38B2AC?logo=tailwindcss&logoColor=white)
![Supabase](https://img.shields.io/badge/Supabase-3ECF8E?logo=supabase&logoColor=white)
![Polygon](https://img.shields.io/badge/Polygon-8247E5?logo=polygon&logoColor=white)
![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white)
[![Zebrix CI](https://github.com/edycutjong/zebrix/actions/workflows/ci.yml/badge.svg)](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:


Zebrix Dashboard

**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



Zebrix Demo Video


โ–ถ๏ธ [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