[■] Help — Marketski Polymarket Insider Detection System 1

About Marketski

Marketski is an automated monitoring bot that identifies "Smart Money" and probable insider wallets on the Polymarket prediction market platform.

It works by detecting anomalous high-conviction trading activity in the final hours before a market resolves, then profiling the wallets behind those trades to identify patterns consistent with insider knowledge: unusually high win rates and large cumulative profits.

This web console provides a real-time view of all detected activity, wallet profiles, and analytical charts. It includes an integrated Smart Analyzer (powered by LLM) to help evaluate flagged wallets. The interface is styled after the Borland Turbo Pascal IDE (circa 1990), because nothing says "alpha" like a DOS-era interface.

Quick Start

1. Start the system

cp .env.example .env          # Configure credentials
docker-compose up             # Start PostgreSQL + bot
python main.py --web          # Launch web console

2. Run your first scan

Navigate to Run → Run Single Cycle (or press F9) and click [Run Single Cycle]. The bot will:

  • Discover markets closing within the next 12 hours
  • Scan for large trades in the late-stage window
  • Profile any wallets placing anomalous bids
  • Flag wallets meeting the insider criteria

3. Review results

After a cycle completes, explore the data:

  • Dashboard — overview of all activity
  • View → Anomalies — detailed trade-level data
  • View → Wallets — all profiled wallets with insider flags
  • View → Charts — scatter plot and insider rankings

How It Works

Each monitoring cycle follows a 5-step pipeline:

Step 1: Market Discovery

Polls the Polymarket Gamma API for all active markets whose resolution time falls within the next CANDIDATE_MARKET_HOURS (default: 12 hours). Markets are upserted into the database.

Step 2: Trade Statistics

For each candidate market, fetches the most recent 500 trades and computes the mean and standard deviation of trade sizes (in USD). These stats are used to calculate the statistical anomaly threshold.

Step 3: Anomaly Detection

Fetches trades on each candidate market that exceed either:

  • The absolute threshold: $10,000 USD
  • The statistical threshold: mean + 3σ of recent trade sizes

Only trades within the Late-Stage window (4 hours before close) are flagged. Each trade is deduplicated by transaction hash to prevent double-counting across poll cycles.

Step 4: Wallet Profiling

For each wallet behind an anomalous trade, fetches their entire history of resolved (closed) positions from the Polymarket Data API. Computes:

  • Total trades — count of resolved positions
  • Win rate — positions with positive realized PnL / total
  • Net profit — sum of all realized PnL

A wallet is flagged as a Probable Insider if it meets the criteria (see Definitions below). Profiles are cached for 24 hours to avoid redundant API calls.

Step 5: Position Tracking

For each confirmed insider, fetches their current open positions across all Polymarket markets. This provides the "alpha" — seeing what insiders are currently betting on.

Definitions

Candidate Market

A market whose scheduled resolution/closing time is within the next 12 hours (configurable via CANDIDATE_MARKET_HOURS).

High-Conviction Bid (Anomalous Bid)

A trade where the USD value exceeds $10,000 OR the size is more than 3 standard deviations above the market's recent average trade size.

Late-Stage

A trade occurring within 4 hours of the market's scheduled closing time (configurable via LATE_STAGE_HOURS).

Probable Insider

A wallet address that meets both of the following:

  • Minimum of 10 resolved bets in their history
  • Overall win rate > 75% OR total lifetime net profit > $50,000

Page Guide

Dashboard

The main overview screen. Shows four summary counters (markets, anomalies, wallets, insiders), a feed of the 15 most recent anomalous trades, and a leaderboard of the top 5 insiders by profit. This is your at-a-glance view of system status.

Markets

Lists all candidate markets currently being monitored. Each row shows the market question, closing time, time remaining, 24-hour volume, and the computed trade statistics (average and standard deviation) used for anomaly detection. Sortable by closing time, volume, or name — click the active sort button again to toggle between ascending (▲) and descending (▼) order.

Anomalies

The full log of detected anomalous trades. Each row includes the timestamp, wallet address (clickable to view profile), USD size, market question, time remaining until close, transaction hash, and whether the wallet is flagged as an insider. Sortable by time, size, or time-to-close, each with ASC/DESC toggle.

Wallets

All profiled wallets with their trading statistics. Toggle the "Show insiders only" checkbox to filter to flagged wallets. Click any wallet address to see their full profile and open positions. On the wallet detail page, use the [Smart Analyzer] button to get an AI-powered assessment of the wallet's tracking value. Sortable by profit, win rate, or trade count, each with ASC/DESC toggle.

Charts

Displays pre-generated analysis charts and a live rankings table:

  • Chart 1: Scatter plot of Time to Expiration (X) vs Bid Size in USD (Y), with insider wallets highlighted in red diamonds.
  • Chart 2: Alpha Distribution bubble chart showing Win Rate vs Net Profit, with bubble size representing trade volume.
  • Table 1: Top Active Insiders ranked by profit, showing their wallet, win rate, and top 3 current open positions.

Click [Regenerate Charts] to rebuild the static PNG images from the latest data.

Monitor

The control panel for running scan cycles. Click [Run Single Cycle] to execute one complete pipeline pass. The output log shows real-time progress and results. After each cycle, summary statistics are displayed in the results panel.

For continuous monitoring, use the CLI: python main.py --monitor

Configuration

Live-editable settings grouped by category. Change any threshold or interval, then click [ F2 Save Changes ]. Changes apply to the running process immediately — the monitoring loop picked them up on the next cycle. Settings are persisted to output/.config_overrides.json and survive restarts.

Use [ Reset to Defaults ] to restore all values to their environment-variable or built-in defaults.

API Endpoints Used

PurposeEndpoint
Market discoveryGET gamma-api.polymarket.com/markets
Trade detectionGET data-api.polymarket.com/trades
Wallet profilingGET data-api.polymarket.com/closed-positions
Open positionsGET data-api.polymarket.com/positions

All endpoints are public and require no authentication. Rate limiting is handled via exponential backoff with jitter.

Database Schema

TablePrimary KeyPurpose
marketsmarket_idCandidate markets with trade stats
anomalous_bidsbid_id (auto)Detected high-conviction trades
walletswallet_addressProfiled wallets with insider flag
insider_positionsid (auto)Open position snapshots for insiders

CLI Usage

python main.py --monitor     # Run continuous monitoring loop (10 min interval)
python main.py --analyze     # Generate charts from stored data
python main.py --web         # Launch web console (default port 8017)
python main.py --web --port 8080   # Custom port

Docker Deployment

# Start everything (bot and web console)
docker-compose up -d

# View bot logs
docker-compose logs -f bot

# Run chart generation manually
docker-compose exec bot python main.py --analyze

# Access database
docker-compose exec db psql -U marketski

Keyboard Shortcuts

KeyAction
F1Open this Help page
F5Refresh current page
F9Go to Monitor (Run)

Troubleshooting

No markets found

The Gamma API may not return markets matching the time window. Open Options → Configuration and increase Candidate Market Hours to 24 or 48.

No anomalies detected

If markets have low volume, trades may not exceed the default $10k threshold. Open Options → Configuration and lower High Conviction Threshold ($) for testing (e.g., 1000).

Database connection failed

Ensure PostgreSQL is running and DATABASE_URL is correct. When using Docker, the hostname should be db (the service name), not localhost. DATABASE_URL is set via environment variable only (not editable in the web console).

Rate limiting (429 errors)

The bot uses exponential backoff automatically. If you see persistent 429s, open Options → Configuration and increase Poll Interval (seconds).


Marketski v1.0 — Polymarket Insider Detection System
Borland-Style Console Edition

F1Help F5Refresh F9Run F10Menu
F1=Index ESC=Close ↑↓=Navigate