Precedence is an AI-powered prediction market trading terminal. Our AI estimates true probabilities, detects market mispricing, and shows you exactly where the edge is — across politics, legal, crypto, and economics. Built on Polymarket's Builder Program for gasless trading and CourtListener's API for legal case data, Precedence gives traders an unfair advantage with AI-driven edge detection on every market.
- Probability Estimates - AI estimates true probabilities independent of market price
- Mispricing Detection - Compares AI estimates to market prices to find edges
- Multi-Outcome Analysis - AI ranks all outcomes with probability vs market price comparison
- Bull/Bear Cases - Balanced arguments for and against each position
- Key Factors & Risk Assessment - Identifies what drives the outcome with confidence scoring
- CourtListener Integration - Search millions of court cases across all federal courts
- LLM Case Analysis - GPT-4o generated outcome predictions with confidence scores
- Judge Behavior Analysis - Historical patterns and ideological leaning assessment
- Key Factors Extraction - Identifies critical legal factors affecting outcomes
- Zero Gas Fees - Safe wallet deployment and trading via Polymarket Relayer
- Builder Program - Full HMAC-signed attribution for trading volume
- CLOB Integration - Direct access to Polymarket's Central Limit Order Book
- Live Prices - Real-time Yes/No outcome prices with order book depth
- Multi-Outcome Support - Trade on markets with 2 to 100+ outcomes
- 5 Category Filters - Legal, Politics, Economy, Crypto, and All Markets
- Legal Markets - SCOTUS rulings, criminal trials, regulatory battles, extraditions
- Multi-Outcome Charts - Price history with up to 4 colored outcome lines
- Volume & Liquidity Data - 24hr, weekly, monthly trading stats
- Real-Time Order Books - Live bids/asks from Polymarket CLOB
From discovery to profit in 5 steps.
-
STEP 01 // DISCOVER Browse Live Markets Explore thousands of active prediction markets across politics, legal, crypto, and economics. Filter by category or search for specific markets on Polymarket.
-
STEP 02 // ANALYZE AI Edge Detection Our AI estimates true probabilities, compares them to market prices, and shows you exactly where the edge is. Get bull/bear cases, key factors, risk assessment, and confidence scores — all in one click.
-
STEP 03 // CONNECT Gasless Onboarding Connect with email, social login, or existing wallet via Privy. A Smart Wallet (Gnosis Safe) is deployed for you at zero cost. Send USDC to your wallet address to start trading.
-
STEP 04 // TRADE Execute Positions Instantly Trade on Polymarket's Central Limit Order Book. Zero gas fees. Millisecond execution. Your funds stay in your self-custodial wallet. Supports both binary and multi-outcome markets.
-
STEP 05 // SETTLE Automated Smart Contract Payouts When markets resolve, UMA Oracle verifies outcomes and smart contracts automatically distribute USDC to winning positions. No disputes. No delays.
- Landing Page: www.precedence.fun
- App Dashboard: www.precedence.fun/app
- Live Markets www.precedence.fun/app/markets
- Court Cases www.precedence.fun/app/cases
| Feature | Status |
|---|---|
| Dashboard with trending markets | ✅ Live |
| AI Market Analysis (edge detection) | ✅ Live |
| Multi-outcome market support (2-100+ outcomes) | ✅ Live |
| Legal markets filter tab | ✅ Live |
| AI case search & LLM predictions | ✅ Live |
| CourtListener integration | ✅ Live |
| Gasless trading via Polymarket Builder | ✅ Live |
| Safe wallet deployment | ✅ Live |
| USDC balance tracking (native + bridged) | ✅ Live |
| Order placement via CLOB | ✅ Live |
| Portfolio position tracking | ✅ Live |
| User profile system | ✅ Live |
| Price history charts (binary + multi-outcome) | ✅ Live |
| Real-time order books | ✅ Live |
| Privy wallet authentication | ✅ Live |
| Feature | Status |
|---|---|
| Trade history tab | 🚧 In Progress |
| Reduce signatures to 1 per trade | 🚧 In Progress |
| WebSocket real-time comments | 🚧 Blocked (Railway deploy) |
┌─────────────────────────────────────────────────────────────┐
│ PRECEDENCE PLATFORM │
├─────────────────────────────────────────────────────────────┤
│ Frontend (Next.js 16) │ Hosted on Vercel │
│ • Dashboard + trending markets │ • www.precedence.fun/app │
│ • Markets (5 category filters) │ │
│ • AI Market Analysis │ │
│ • Case search + LLM analysis │ │
│ • Portfolio + positions │ │
│ • Profile + wallet management │ │
├─────────────────────────────────────────────────────────────┤
│ Backend (FastAPI) │ Hosted on Railway │
│ • /api/markets/* endpoints │ • PostgreSQL database │
│ • /api/predictions/* (GPT-4o) │ │
│ • /api/cases/* (CourtListener) │ │
│ • /api/users/* (profiles) │ │
├─────────────────────────────────────────────────────────────┤
│ Trading (Frontend-side) │ Polymarket Builder │
│ • Safe wallet deployment │ • Gasless via Relayer │
│ • Credential derivation │ • HMAC-signed orders │
│ • CLOB order placement │ • Session caching │
├─────────────────────────────────────────────────────────────┤
│ External APIs │
│ • Polymarket Gamma API (market data) │
│ • Polymarket CLOB API (trading + order books) │
│ • Polymarket Relayer (gasless transactions) │
│ • CourtListener API (legal case data) │
│ • OpenAI GPT-4o (AI market + case analysis) │
│ • Privy (wallet authentication) │
└─────────────────────────────────────────────────────────────┘
Frontend:
- Next.js 16+ with App Router
- Privy wallet authentication (email, Google, wallet)
- Recharts price history charts (binary + multi-outcome)
- Tailwind CSS with custom design system
- Instrument Serif + DM Sans + JetBrains Mono fonts
Backend:
- FastAPI (Python 3.11+)
- PostgreSQL on Railway (users, positions, trades)
- Polymarket Gamma/CLOB API integration
- CourtListener API integration
- CORS proxy for Gamma API
AI/ML:
- GPT-4o market analysis (edge detection, probability estimates)
- GPT-4o case analysis (judge behavior, outcome prediction)
- Multi-outcome probability comparison
- Semantic case search
# Required
- Node.js 18+
- Python 3.11+
- PostgreSQL 14+ (for user profiles - coming soon)
# API Keys Needed
- Polymarket Builder credentials (from polymarket.com/settings?tab=builder)
- CourtListener API key
- OpenAI API key# Clone the repository
git clone https://github.com/tony-42069/precedence.git
cd precedence
# 1. Backend Setup
cd backend
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
# Edit .env with your API keys
# 2. Signing Server Setup
cd builder-signing-server
npm install
cp .env.example .env
# Edit .env with Builder credentials
# 3. Frontend Setup
cd ../frontend
npm install# Terminal 1: Signing Server (Port 5001)
cd backend/builder-signing-server
npm run start-dev
# Terminal 2: Trading Service (Port 5002)
cd backend
node trading_service_v2.js
# Terminal 3: Python Backend (Port 8000)
cd backend
uvicorn api.main:app --reload --port 8000
# Terminal 4: Frontend (Port 3000)
cd frontend
npm run devprecedence/
├── frontend/ # Next.js 14 frontend
│ ├── src/
│ │ ├── app/
│ │ │ ├── page.tsx # Landing page
│ │ │ ├── dashboard/ # Main dashboard
│ │ │ ├── markets/ # Markets listing
│ │ │ ├── cases/ # Case search + AI
│ │ │ └── portfolio/ # User portfolio
│ │ └── components/
│ └── public/
│ └── precedence-logo-transparent.png
│
├── backend/ # Python + Node.js backend
│ ├── api/
│ │ ├── routes/
│ │ │ ├── markets.py # Market endpoints
│ │ │ ├── predictions.py # AI prediction endpoints
│ │ │ └── cases.py # Case search endpoints
│ │ └── services/
│ │ └── llm_analyzer.py # LLM case analysis
│ ├── integrations/
│ │ ├── polymarket.py # Polymarket client
│ │ └── court_listener.py # CourtListener API
│ ├── trading_service_v2.js # Node.js trading service
│ ├── builder-signing-server/ # HMAC signing server
│ └── .env
│
├── database/
│ └── schema.sql # PostgreSQL schema
│
└── docs/ # Documentation
GET /api/markets/ # Get all markets
GET /api/markets/legal # Get legal-focused markets
GET /api/markets/search?q= # Search markets
GET /api/markets/{id} # Get market details
POST /api/predictions/analyze-case-llm # AI case analysis
GET /api/predictions/insights # Get prediction insights
GET /api/cases/search?q= # Search CourtListener cases
GET /api/cases/{id} # Get case details
POST /init-session # Initialize trading session
POST /deploy-safe # Deploy Safe wallet
POST /derive-credentials # Derive User API credentials
POST /set-approvals # Set token approvals
POST /resolve-market # Get tokenIds for market
POST /place-order # Place order
GET /session/:address # Get session status
GET /health # Health check
- Polymarket Builder integration (gasless trading)
- Safe wallet deployment via Relayer
- User credential derivation (EIP-712)
- Token approvals (7 contracts)
- Order placement with Builder attribution
- AI Market Analysis with edge detection
- Multi-outcome market support (price charts, order books, trading)
- Legal markets filter tab (SCOTUS, trials, regulatory)
- AI case search & LLM predictions (GPT-4o)
- CourtListener integration
- User profile system with PostgreSQL
- Portfolio position tracking
- USDC balance tracking (native + bridged)
- Privy wallet authentication (email, Google, wallet)
- Vercel + Railway deployment
- Custom font system (Instrument Serif + DM Sans)
- Trade history tracking
- Signature reduction (target: 1 per trade)
- USDC auto-swap (native to USDC.e)
- Leaderboards & reputation system
- Real-time WebSocket comments
- Fee collection (1% on sells)
- Email/push notifications
- Mobile app
We welcome contributions! Please see our Contributing Guidelines for details.
# Fork and clone
git clone https://github.com/YOUR_USERNAME/precedence.git
# Create feature branch
git checkout -b feature/amazing-feature
# Commit and push
git commit -m "Add amazing feature"
git push origin feature/amazing-feature
# Create Pull RequestThis project is licensed under the MIT License - see the LICENSE file for details.
Precedence is a prediction market platform for informational and entertainment purposes. Trading involves risk and you may lose some or all of your investment. The predictions and odds displayed are not legal advice. Always consult with qualified legal professionals for legal matters.
Prediction markets may not be legal in all jurisdictions. Users are responsible for ensuring compliance with local laws and regulations.
- Live Platform: www.precedence.fun
- App Dashboard: www.precedence.fun/app
- X/Twitter: @precedenceai
- GitHub: @tony-42069
- Polymarket Builder: polymarket.com
- CourtListener API: courtlistener.com/help/api
