Skip to content

djd39448/MockingJay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PolyBot

Event-driven Polymarket copy-trading bot with Electron dashboard and MCP server.

Architecture

┌─────────────────────────────────────────────────────────────┐
│              ELECTRON DASHBOARD (Windows native)             │
│  Status │ Roster │ Trade Feed │ PnL Chart │ Research Queue  │
└──────────────────────┬──────────────────────────────────────┘
                       │ reads SQLite (C:\polybot\polybot.db)
┌──────────────────────▼──────────────────────────────────────┐
│                     SQLITE DATABASE                          │
│  traders │ trades │ bot_config │ pnl_snapshots │ candidates │
└─────┬────────────────────────────────────┬──────────────────┘
      │ writes                             │ reads/writes
┌─────▼──────────┐              ┌──────────▼─────────────────┐
│   BOT ENGINE   │              │        MCP SERVER           │
│ (WSL2 Python)  │              │  (WSL2 Python FastMCP)      │
│                │              │  40+ agent-callable tools    │
│ research loop  │              └────────────────────────────┘
│ tracker feed   │
│ trade copier   │
│ roster manager │
│ auto-redeemer  │
└─────┬──────────┘
      │ subprocess (--output json)
┌─────▼──────────┐
│  BULLPEN CLI   │
│ (WSL2 binary)  │
└────────────────┘

Quick Start

Prerequisites

  • Windows PC with WSL2 (Ubuntu)
  • Python 3.11+ (inside WSL2)
  • Node.js 20+ (Windows, for Electron dashboard)
  • Bullpen CLI authenticated (bullpen login)
  • GitHub CLI authenticated (gh auth login)

Setup (WSL2)

# Clone the repo
git clone https://github.com/djd39448/polybot.git
cd polybot

# Set up Python environment
cd bot
python3.11 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

# Configure environment
cp .env.example .env
# Edit .env with your Bullpen binary path and preferences

# Create the shared database directory
mkdir -p /mnt/c/polybot

# Run tests
pytest

# Start the bot (paper mode by default)
python -m engine.bot

Setup (Windows — Electron Dashboard)

cd electron
npm install
npx electron-rebuild  # Required for better-sqlite3
npm run dev

Tech Stack

Component Technology
Bot Engine Python 3.11, asyncio, aiosqlite
CLI Interface Bullpen CLI (subprocess, --output json)
Database SQLite (WAL mode, shared file)
MCP Server Python FastMCP (mcp>=1.0.0)
Dashboard Electron + React 18 + TypeScript + Tailwind + shadcn/ui
Charts Recharts
Linting ruff (Python), eslint + prettier (TS)
Testing pytest + pytest-asyncio, Vitest

How It Works

  1. Research — Daily leaderboard polling scores traders on 180-day return rate, recency, and market diversity
  2. Roster — Top 10 traders fill 5 live slots and 5 paper slots, with weekly promotion/demotion
  3. Tracking — Polls Bullpen tracker feed for new trades from rostered traders
  4. Execution — Copies trades at a fixed dollar amount ($5 default) with cash reserve and slippage guards
  5. Redemption — Auto-redeems resolved winning positions every 5 minutes

Project Structure

polybot/
├── bot/                    # All WSL2 Python code
│   ├── core/               # Config, Bullpen wrapper, logging
│   ├── database/           # Schema, migrations, async DB access
│   ├── research/           # Leaderboard polling, trader scoring
│   ├── engine/             # Bot loop, trade execution, roster, redeemer
│   ├── mcp_server/         # FastMCP server (40+ tools)
│   └── tests/              # Full pytest suite
├── electron/               # Windows Electron dashboard
│   └── src/
│       ├── main/           # Electron main process + better-sqlite3
│       └── renderer/       # React UI with 7 panels
├── docs/                   # Architecture, MCP tools, setup guides
└── .github/workflows/      # CI: lint + test on push

License

MIT

About

A copy trade bot for polymarket

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors