Skip to content

tshields86/polysmart

Repository files navigation

Polysmart

A read-only research tool that tests a single hypothesis:

"Copy-trading Polymarket's most consistently profitable wallets — Pelosi-tracker style — produces excess returns."

Phase 1 is purely analytical: hit Polymarket's public APIs, store everything locally in SQLite, classify wallets to filter out market-makers and arbitrage bots, then run a walk-forward backtest (the watchlist at every historical date T is built from data available before T — no future leak) plus a 108-cell sensitivity sweep across lag, position size, watchlist size, and filter strictness.

No trading code. No private keys. No order placement. The deliverable is a defensible yes/no on the strategy, before any capital is ever risked.

Phase 1 verdict — No.

  • Walk-forward backtest over 23 months on the 10 wallets the classifier picked as smart money: ROI −0.62% · Sharpe −0.13 · win rate 54.8%.
  • 108-cell sensitivity sweep: 0/4 robustness buckets held. A thin edge exists at the smallest position size, but it's eaten by realistic slippage and lag at any meaningful size.
  • Full writeup with numbers and caveats: RESULT.md.

A clean "no" was always one of two valid outcomes, and is the point of building this before risking capital. Phase 2 (live alerts, hosted infra, execution) was conditional on Phase 1 — it isn't justified.

Tour the repo

Read in this order:

Doc What it is
TASK.md Scope, success criteria, decision log — what we're building and why
TECHNICAL_SPEC.md Architecture, data model, backtest algorithm, file layout
CLAUDE.md Conventions, commands, gotchas — the operating manual
RUNBOOK.md How to actually run the pipeline end-to-end
RESULT.md The numbers, the verdict, the caveats
FINDINGS.md Same story written for someone with no context

Stack

  • Node.js 22+, TypeScript strict mode
  • Next.js 15 (App Router) — scaffolded; dashboard explicitly deferred
  • SQLite via better-sqlite3 (single local file, no server)
  • zod for API response validation, built-in fetch with a rate-limited wrapper
  • vitest for tests · raw SQL (no ORM) with prepared statements

Quickstart

npm install
npm run db:migrate

Full end-to-end (slow — see RUNBOOK.md for what each step does and how to scope a quick run):

npm run sync:leaderboard
npm run sync:wallets -- --limit 50   # pre-screens obvious bots; tens of minutes
npm run sync:markets
npm run classify:all
npm run stats                        # snapshot: trade span, classifications, etc.

npm run backfill:leaderboard -- --from 2024-06-01 --to 2026-05-01
npm run backtest -- --from 2024-06-01 --to 2026-05-01 --lag 15 --size 1000
npm run backtest:sensitivity -- --from 2024-06-01 --to 2026-05-01

Debug helpers:

npm run inspect:wallet -- 0xWALLET   # classification, position stats, recent trades
npm run stats                        # DB snapshot
npm run db:reset -- --force          # wipe and rebuild (destructive)

Code health

npm run typecheck   # tsc --noEmit
npm run lint        # next lint
npm run test        # vitest run — 65 tests across the API clients, classifier,
                    # position reconstruction, backfill, backtest engine,
                    # sensitivity summary, and sync jobs

All three pass clean on main.

What's not built

Per the Phase 1 plan, the Next.js dashboard was the lowest-priority step and was explicitly droppable — the CLI report from backtest / backtest:sensitivity is the actual deliverable. npm run dev serves only a placeholder page.

Disclaimer

Polysmart is a research tool. It is read-only against public Polymarket APIs and performs zero on-chain actions. There is no signing code, no private-key handling, and no order-placement logic anywhere in the repo. The output is a backtest report — not financial advice.

About

Walk-forward backtest of copy-trading Polymarket's most profitable wallets. TypeScript + SQLite, sensitivity-swept, read-only.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors