Real-time terminal dashboard for Polymarket BTC 15-minute UP/DOWN prediction markets. Aggregates price feeds from Chainlink oracle, Binance, and Polymarket orderbook data. Includes backtesting tools for trading strategy research.
-
Real-time Dashboard (
dash.py) - Terminal UI showing:- Chainlink BTC/USD oracle price (via Polymarket RTDS)
- Binance BTCUSDT 1s kline price and volume
- Polymarket orderbook depth for UP/DOWN markets
- Technical indicators: returns, ATR, VWAP, volume spikes
- Automatic CSV logging per 15-minute market
-
Backtesting Tools:
replicate_balance.py- Balance replication strategy simulatorfade_impulse_backtest.py- Impulse fade strategy backtestervisualize_fade_impulse.py- Strategy visualization
- Python 3.10+
- Node.js (for Chainlink price feed via external script)
- Active internet connection (WebSocket streams)
git clone https://github.com/txbabaxyz/polyrec.git
cd polyrec# Create venv
python3 -m venv .venv
# Activate venv (Linux/macOS)
source .venv/bin/activate
# Activate venv (Windows)
.venv\Scripts\activatepip install -r requirements.txtThe dashboard uses an external Node.js script for Chainlink oracle data.
Make sure you have the Chainlink feed script available. By default, the dashboard looks for ./chainlink/btc-feed.js. Modify the path in dash.py if needed:
# Line 745 in dash.py
cmd = ["node", "./chainlink/btc-feed.js"] # Change this path# Activate venv first
source .venv/bin/activate
# Run dashboard
python dash.pyThe dashboard will:
- Connect to Binance WebSocket for price data
- Connect to Polymarket WebSocket for orderbook data
- Start Chainlink price feed subprocess
- Display real-time terminal dashboard
- Log all data to
./logs/directory (CSV per market)
Press Ctrl+C to stop.
# Balance replication strategy
python replicate_balance.py
# Fade impulse strategy (requires external polymarket_api module)
python fade_impulse_backtest.pypython visualize_fade_impulse.pypolyrec/
├── dash.py # Main real-time dashboard
├── replicate_balance.py # Balance strategy backtester
├── fade_impulse_backtest.py # Impulse fade backtester
├── visualize_fade_impulse.py # Strategy visualization
├── requirements.txt # Python dependencies
├── README.md # This file
└── logs/ # Auto-created, stores CSV market logs
| Source | Type | URL |
|---|---|---|
| Binance | WebSocket | wss://stream.binance.com:9443/ws/btcusdt@kline_1s |
| Polymarket Orderbook | WebSocket | wss://ws-subscriptions-clob.polymarket.com/ws/market |
| Polymarket Gamma API | REST | https://gamma-api.polymarket.com |
| Chainlink Oracle | External | Via Polymarket RTDS |
Each 15-minute market generates a CSV file with 70+ columns:
- Timestamps:
timestamp_ms,timestamp_et,seconds_till_end - Prices:
oracle_btc_price,binance_btc_price,lag - Returns:
binance_ret1s_x100,binance_ret5s_x100 - Volume:
binance_volume_1s,binance_volume_5s,binance_volma_30s - Volatility:
binance_atr_5s,binance_atr_30s,binance_rvol_30s - Orderbook: 5 levels of bids/asks for UP and DOWN markets
- Analytics: spread, imbalance, microprice, slope, eat-flow
Key parameters in dash.py:
# Chainlink
CL_URL = "wss://ws-live-data.polymarket.com"
CL_SYMBOL = "btc/usd"
# Binance
BN_URL = "wss://stream.binance.com:9443/ws/btcusdt@kline_1s"
# Polymarket
PM_GAMMA_API = "https://gamma-api.polymarket.com"
PM_WS_URL = "wss://ws-subscriptions-clob.polymarket.com/ws/market"
# Logging
LOG_DIR = "./logs" # Change in DataLogger.__init__()- Check internet connection
- Verify WebSocket URLs are accessible
- Check if Chainlink feed script exists and works
- Ensure Node.js is installed:
node --version - Check if feed script path is correct in
dash.py - Run feed script manually to test:
node ./chainlink/btc-feed.js
chmod +x dash.py
chmod +x replicate_balance.pyMIT License
This software is for research and educational purposes only. Trading cryptocurrency derivatives involves significant risk. Use at your own risk.