PW Trading is a quantitative trading system targeting Polymarket prediction markets. The system detects behavioral overshoots — price moves disproportionate to their fundamental drivers — and executes bounded-risk fade trades (betting on mean reversion) when structural conditions confirm the overshoot.
The core thesis: prediction market prices sometimes overreact to attention spikes, order flow imbalances, and volume surges. By measuring the elasticity of price response relative to driver magnitude, we can identify when a move has gone too far and capture the reversion.
Prediction markets on Polymarket are driven by retail sentiment. When news breaks or attention spikes, prices often overshoot fair value due to herding, momentum chasing, and thin liquidity at the tails. These overshoots reliably mean-revert within minutes because the underlying event probabilities don't actually change that fast.
Instead of predicting direction, we measure how much the price moved relative to how much it should have moved given the driver activity. A high elasticity (ε > 1.3) means the price moved more than the drivers justify — classic overshoot territory. This is a structural signal, not a directional bet.
A single signal is never enough. The 16-gate pipeline ensures we only trade when every structural condition aligns: sufficient liquidity, driver validity confirmed, reflexivity checked (not chasing a real information cascade), classifier confident, fee-aware edge positive, and risk limits clear. Any single gate failure blocks the trade entirely.
Every WebSocket event (book snapshot or price change) flows through the registry, updates the live order book state, then immediately feeds into the behavioral pipeline. The pipeline runs synchronously on every event — no polling, no batching. At ~270 pipeline runs per minute across 10 markets, the overhead is negligible.
behavior/, 2 files modified134.122.39.253).
134.122.39.253 relays orders to Polymarket CLOB API, low-latency execution/onboard.html UI for user wallet setup, API key provisioning, and account activation/live.html with per-track and global kill switches, live P&L, position monitoringCritical fix: market selection was using lifetime volume instead of 24h volume. This pulled stale, established markets ($9–$99 24h volume at bottom) instead of actively traded ones.
order=volume (lifetime) → fixed to order=volume24hrsetOnWouldTrade() fires on every WOULD_TRADE signalsetOnPriceUpdate() updates open positions on every tickpaper_trades table with auto-create, fire-and-forget writes/api/paper/positions, /api/paper/history, /api/paper/stats/paper.html with live positions, trade history, stats@polymarket/clob-client)/debug/clob/book/:tokenId, /debug/clob/compare/:conditionIdcross_matches + cross_edge_history tables, 7-day retention/debug/cross-arb/matches, /edges, /windows, /history, /stats/crossarb.html with matched pairs, edges, windows/adminer/files/backup134.122.39.253) for low-latency Polymarket order execution/onboard.html/live.html with per-track and global kill switchesMust complete before proceeding to Stage 1.
Every potential trade must pass all 16 gates in order. Gates are ordered cheapest-rejection-first for CPU efficiency — the most common rejections (price floor, liquidity) happen before expensive computations (classifier, reflexivity).
| # | Gate | What It Checks | Status |
|---|---|---|---|
| 1 | Regime Check | Flow regime must be ATTENTION_SPIKE or BUILDING_ATTENTION | Stubbed — defaults to PASS |
| 2 | Price Move Floor | 60s price move ≥ 1.0¢ (MIN_ABS_MOVE) | Live |
| 3 | Liquidity | Volume ≥ $10K, depth ≥ $300 within 2¢, spread ≤ 1.5¢ | Live |
| 4 | Resolution Risk | No imminent market resolution (UMA oracle check) | Stubbed — needs UMA integration |
| 5 | Propagation Imminent | No correlated market about to cascade | Stubbed — needs correlation tracking |
| 6 | Propagation Window | Not inside a cross-market propagation wave | Stubbed — needs propagation matrix |
| 7 | Driver Validity | CombinedDriverZ ≥ 1.0 + at least one driver passes absolute floor | Live |
| 8 | Elasticity | Multi-timescale gate: (ε₁₅ > 1.30 AND ε₆₀ > 1.30) OR (ε₁₅ > 2.50 AND ε₆₀ > 0.80) | Live |
| 9 | Reflexivity | Lead-lag R ≤ 4.0 (not chasing a real information cascade) | Live |
| 10 | Classifier | 5-feature overshoot classifier confidence ≥ 0.65 | Live (f3, f5 stubbed) |
| 11 | Fee-Aware Edge | Net edge per share > 0 after 2× fee deduction (most markets: 0% fee) | Live (update fee rate) |
| 12 | Stop Geometry | Stop distance > spread (trade is executable) | Live |
| 13 | Impact Share | Order size < 30% of available depth (no self-impact) | Stubbed — no sizing yet |
| 14 | Risk Limits | Max concurrent fades not exceeded | Stubbed — no fades active |
| 15 | Portfolio Exposure | Total exposure within group and portfolio caps | Stubbed — no positions |
| 16 | Size Viability | Computed position size ≥ minimum order ($5) | Stubbed — no sizing in Stage 0 |
Live = fully computed from WebSocket data | Stubbed = defaults to PASS, will be implemented in later stages
Baseline set 2026-03-03 from 26 captured WOULD_TRADE signals (11 unique positions) observed March 1–2. All signals passed all 16 gates. Paper trader was wired after these signals fired, so actual paper trades start accumulating from March 3 onward.
| Signal rate | ~1/hour during active events (sports, crypto hourly) |
| Unique positions | 11 from 26 raw signals (deduped by market+side) |
| Market types | Sports (LoL, NBA, NHL), crypto hourly, politics (rare) |
| Median entry price | ~$0.55 | Median 60s move: ~23¢ |
| Reflexivity | 82% CAUSAL (strongest signal for mean-reversion) |
| Classifier | 100% OVERSHOOT, median confidence 0.83 |
| Exit Type | Avg P&L | Trigger |
|---|---|---|
| Target hit | +$11.10 | Price reverts 50% of spike within 3 min |
| TTL expire | +$2.03 | Partial revert, closed at 3 min timeout |
| Stop loss | −$34.79 | Price continues 1.5x against, hits stop |
| Scenario | Target / Stop / TTL | Net P&L | ROI |
|---|---|---|---|
| Optimistic | 25 / 5 / 20 | +$144 | +5.8% |
| Moderate (expected) | 20 / 5 / 25 | +$99 | +4.0% |
| Conservative | 17 / 7 / 26 | −$2 | ~0% |
| Pessimistic | 12 / 12 / 26 | −$232 | −9.3% |
| Metric | Projected | Actual | Verdict |
|---|---|---|---|
| Total paper trades | ~50 | — | — |
| Target hit rate | 35–50% | — | — |
| Stop rate | 10–15% | — | — |
| Net P&L | +$50 to +$150 | — | — |
| Avg trade P&L | +$1 to +$3 | — | — |
| Expectancy | +$0.50 to +$2.50 | — | — |
Key assumption: 3-min TTL captures most of the revert.
Prediction market overreactions on binary outcomes (sports, crypto hourly)
typically revert within 30–120s. The asymmetric risk (win +$11 / lose −$35)
requires ≥40% target-hit rate to be profitable. 82% CAUSAL reflexivity
and 100% OVERSHOOT classification are favorable indicators.
Risk factor: Breakeven is ~76% target-hit rate in pure target-vs-stop.
The TTL cushion (+$2 avg) lowers this to ~40% effective breakeven when 50% of
exits are TTL. If stop rate exceeds 20%, the strategy is unprofitable.
@polymarket/clob-client SDK on VPSSee Funding & Account Setup for full details.
Complete checklist for going from zero to trade-ready on Polymarket. All items must be completed before Stage 3 (first live capital).
| # | Task | Details | Status | When Needed |
|---|---|---|---|---|
| 1 | Create Polymarket Account | Sign up at polymarket.com with email/Google (creates proxy wallet) or connect an external wallet (MetaMask). KYC triggered at high-volume thresholds only (international). | TODO | Stage 2 |
| 2 | Set Up Wallet |
Option A (Recommended): Use Polymarket's proxy wallet (email signup).
Gasless transactions, simpler setup. Option B: Use your own EOA (MetaMask). More control, requires manual token approvals and gas management. |
TODO | Stage 2 |
| 3 | Export Private Key |
Required for programmatic trading. If using proxy wallet:
go to polymarket.com/settings or reveal.magic.link/polymarket
to export. If EOA: you already have it.Store securely. Never commit to git. Use env variable or secrets manager. |
TODO | Stage 2 |
| 4 | Note Funder Address |
Your deposit address visible at polymarket.com/settings.
For proxy wallets this is the proxy contract address (NOT your underlying EOA).
For EOA wallets this is your wallet address.
|
TODO | Stage 2 |
| 5 | Acquire USDC | Buy USDC on any major exchange (Coinbase, Binance, Kraken). Starting capital for Stage 3: $200–$500 recommended ($75 max per fade × buffer for multiple concurrent positions + drawdown room). | TODO | Stage 3 |
| 6 | Fund Polymarket Wallet |
Send USDC to your Polymarket deposit address over the Polygon network
(chain ID 137). Select “Polygon” as withdrawal network on your exchange. Wrong network = permanent loss. Send a small test amount ($5) first. USDC contract: 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
|
TODO | Stage 3 |
| 7 | Install SDK |
Install the official TypeScript CLOB client:npm install @polymarket/clob-client ethers@5Alternative: Python client pip install py-clob-client
|
TODO | Stage 2 |
| 8 | Generate API Credentials |
Derive L2 API creds from your private key programmatically.
Returns: apiKey, secret (base64), passphrase.
Used for all authenticated API requests (orders, cancels, balance checks).
No separate registration portal needed.
|
TODO | Stage 2 |
| 9 | Set Token Approvals |
EOA wallets only (proxy wallets skip this). Approve 3 exchange contracts to spend
your USDC and Conditional Tokens: • CTF Exchange: 0x4bFb...982E• Neg Risk CTF Exchange: 0xC5d5...80a• Neg Risk Adapter: 0xd91E...296
|
TODO | Stage 2 |
| 10 | Store Secrets on VPS |
Set up secure credential storage on trading.professionalwinner.us:• Private key in environment variable (never in code/git) • API creds (apiKey, secret, passphrase) in env or .env file• .env in .gitignore (already should be)
|
TODO | Stage 2 |
| 11 | Test API Read Access | Verify the SDK can read market data from the VPS. Public endpoints require no authentication: order books, prices, market metadata. This validates network connectivity and SDK installation. | TODO | Stage 2 |
| 12 | Test API Write Access | Place and immediately cancel a small limit order ($1, far from market) to verify the full auth flow: L1 signing, L2 headers, order construction, cancel endpoint. Confirms the system can trade when enabled. | TODO | Stage 2 |
| 13 | Verify Fee Schedule |
Confirm actual fees for target markets via API (feeRateBps field).
Most markets have zero fees. Fees only on: 5/15-min crypto,
NCAAB, Serie A. Update Gate 11 fee rate per market.
|
TODO | Stage 2 |
| 14 | Set Up Withdrawal Path | Test withdrawal flow before committing significant capital. Withdraw a small amount of USDC on Polygon back to your exchange. Confirm the full round-trip: exchange → Polymarket → exchange. | TODO | Stage 3 |
| Type | Behavior | Our Use Case |
|---|---|---|
| GTC | Good-Til-Cancelled — rests on book until filled or cancelled | Primary — fade entry orders (limit) |
| GTD | Good-Til-Date — auto-expires at specified UTC timestamp | TTL exits — self-canceling orders |
| FOK | Fill-Or-Kill — fill entirely and immediately, or cancel entirely | Exit orders — guaranteed full fill |
| FAK | Fill-And-Kill — fill what you can, cancel remainder | Aggressive entry — when speed matters |
fee = shares × feeRate × (p × (1-p))^exp —
decreases toward price extremesfeeRateBps field). This change makes our edge calculation
more favorable — more trades pass Gate 11.| Stage | Capital Required | Max Exposure | Purpose |
|---|---|---|---|
| Stage 0-1 | $0 | $0 | Logging + paper trading only |
| Stage 2 | $5–10 | $1 (test order) | API validation, test order + cancel |
| Stage 3 | $200–500 | $75 per fade | First live trades, $150 drawdown cap |
| Stage 4 | $500–2,000 | $500 per fade | Escalation: $75 → $150 → $300 → $500 |
| Stage 5 | TBD | TBD | Based on demonstrated edge and capacity |
| Endpoint | Limit | Our Usage |
|---|---|---|
| CLOB general | 9,000 / 10s | Well within limits |
| Market data | 1,500 / 10s | Using WS instead (no polling) |
| POST /order | 3,500 burst / 10s | Max ~5 fades/min expected |
| DELETE /order | 3,000 burst / 10s | Cancel on stop/TTL only |
| Gamma API | 4,000 / 10s | Startup load only (10 markets) |
Chronological record of design changes and implementation decisions.
kalshi/kalshiState.ts (price history buffer),
kalshi/kalshiPaperTrader.ts (paper trader + cross-signal detection).
kalshi_paper_trades table with cross-match fields.
spread <= 0.015 → spread <= 0.050 in behavior/pipeline.ts G3.GET /api/live/simulate — backtests 8 pipeline configs against paper trade databehavior/pipeline.ts, server/routes/live.ts, public/live.html
checkEntry()) separate from
the authoritative 16-gate pipeline. This meant live and paper could diverge on which signals to trade.
liveTrader.onPriceUpdate() (now exits only).
Added liveTrader.onSignal(candidate) that receives CandidateLog from the pipeline’s
setOnWouldTrade() callback — same signal source as the paper trader. Changed
pipeline.ts from single callback to array so both paper and live receive every WOULD_TRADE signal.
Wired in marketRegistry/index.ts during init.
closeSinglePosition() in liveTrader.ts — finds position in-memory or DB,
market-sells via CLOB relay FOK order, updates status to closed_manualPOST /api/live/close/:tradeId routeforceClose() button now calls real API (was a dead alert())closed_manual to LiveTradeStatus type union/live.html — pass/reject bars per gate, bottleneck IDbest_trade, worst_trade, avg_hold_min to LiveStats interface and DB readerGET /api/live/reconcile — compares on-chain vs DB, identifies mismatchesPOST /api/live/sync — imports missing on-chain positions into DB, fixes stale entriesbehavior/pipeline.ts, live/liveTrader.ts,
live/types.ts, marketRegistry/index.ts,
server/routes/live.ts, public/live.html
/tick-size, /neg-risk, /order, etc.)
on whatever host it’s initialized with. The relay only had POST /relay, causing all orders to fail
with “Cannot GET /tick-size” then “403 Forbidden”. Fixed by adding a catch-all transparent proxy
(app.all('*')) that forwards ALL requests to clob.polymarket.com. Auth via UFW firewall
(only NJ IP allowed), not header-based.
orderExecutor.ts: fetches the CLOB orderbook before placing
FOK orders, skips if no asks exist. Saves wasted round-trips and provides clear logging.
live.html):/positions route — renamed on-chain to GET /api/live/on-chainpw-clob-relay/index.js, live/orderExecutor.ts,
server/routes/live.ts, public/live.html
POST /api/live/generate-wallet — creates random wallet via
ethers.Wallet.createRandom(), encrypts private key with AES-256-GCMPOST /api/live/balance — checks native USDC + bridged USDC.e balances
via Polygon RPCPOST /api/live/fund-confirm — transitions state to 'funded'funded between wallet_set and
capital_setgenerated in addition to magic and
externalPOST /api/live/withdraw — server-side USDC transfer to any destination
address (decrypts key, builds tx, sends on Polygon). Blocks if positions open.POST /api/live/export-key — returns decrypted private key for MetaMask
import. Requires confirmation phrase./live.html — collapsible section with balance
display, withdraw form (destination + amount + token selector), and key export with safety warnings.
134.122.39.253), AES-256-GCM encryption, multi-user onboarding, live trading
engine (mirrors fastTrader 5-track logic), dashboard with kill switches, relay health monitoring.
134.122.39.253 handles order placement, cancellation,
and position queries against the Polymarket CLOB API. Low-latency execution path separate
from the main trading server.
/onboard.html provides a guided UI for new user setup: wallet configuration,
API key provisioning, risk parameter selection, and account activation.
/live.html provides real-time monitoring of live positions, P&L, and trade history.
Per-track and global kill switches allow immediate halt of trading at any level.
/onboard.html, monitor live vs paper comparison.
paper.html. All data already existed in DB + WebSocket payload but wasn’t rendered.
public/paper.html
harvestEligible array added to WS broadcast payload.
server/wsBroadcast.ts, public/paper.html,
public/harvest.html (new), public/zones.html (new),
public/index.html, public/kalshi.html, public/crossarb.html,
public/diagnostics.html, public/plan.html,
kalshi/registry.ts
settlementFallback (hold to settlement on TTL/stop),
maxHoursToSettlement (proximity gate).
paper/types.ts, paper/fastTrader.ts,
marketRegistry/types.ts, marketRegistry/registry.ts,
server/reviewTrigger.ts, public/paper.html
paper/types.ts, paper/fastTrader.ts, db/readers.ts,
server/routes/paper.ts, server/wsBroadcast.ts, server/reviewTrigger.ts, public/paper.html
zone === 'extreme' && track === 'moderate'.
paper_trades_v1, main table truncated.
All alert state files cleared. Clean measurement under new rules starting from zero.
paper/fastTrader.ts (stop removal, leaning widen 1.5→3.0, moderate extreme block)
paper/fastTrader.ts (zone classification, share cap, stop widen, cooldown),
marketRegistry/registry.ts (MARKET_LIMIT 50→100)
.review_milestones,
.review_deadline_fired, .review_daily_last) — never one-shot again.
Failed sends retry on next 5-min check.
jayson@professionalwinner.com (env: ALERT_EMAIL)
server/reviewTrigger.ts (complete rewrite)
paper/phantomTracker.ts): Tracks counterfactual P&L for every
rejected pipeline signal. Per-gate verdict shows which gates are COSTING money vs SAVING money.spread_at_entry, price_move_60s,
fee_rate_bps on every trade. Real fee rates from CLOB API (currently 0 bps for all geopolitical/political markets).track filter in
readPaperTrades calls). Dashboard showed 100 ghost trades from moderate/aggressive. Fixed.paper/phantomTracker.ts, paper/feeHelper.tspaper/types.ts, paper/paperTrader.ts, paper/fastTrader.ts,
db/writers.ts, db/readers.ts, behavior/pipeline.ts, behavior/index.ts,
marketRegistry/index.ts, server/wsBroadcast.ts, public/paper.html
paper/fastTrader.ts — config-driven multi-track trader with in-memory state, cooldowns, DB persistence.paper/types.ts (+track field, +TrackConfig),
behavior/index.ts (multi-callback array),
db/writers.ts (+track column + ALTER TABLE),
db/readers.ts (+track filter, +readPaperStatsByTrack),
marketRegistry/index.ts (+fastTrader init & callback),
server/routes/paper.ts (+/api/paper/tracks),
server/wsBroadcast.ts (+tracks payload),
server/reviewTrigger.ts (multi-tier email comparison),
public/paper.html (tier comparison table, track badges)
jayson@professionalwinner.com. Includes “Next Steps & Triggers” section
with exact milestone distances.
.review_triggered file permanently disarmed both triggers.
New system uses separate state files for milestones, deadline, and daily.
crossArb/types.ts, crossArb/matcher.ts,
crossArb/edgeEngine.ts, crossArb/index.ts,
server/routes/crossArb.ts, public/crossarb.html
kalshi/registry.ts (+runMatcher after pollEvents),
marketRegistry/registry.ts (+runMatcher after refreshMarkets),
marketRegistry/edgeEngine.ts (+updateCrossEdge in checkMarket),
marketRegistry/index.ts (+initCrossArb),
db/writers.ts (+cross-arb tables/writes),
db/readers.ts (+cross-arb reads),
db/index.ts (+exports),
server/app.ts (+crossArb routes),
server/wsBroadcast.ts (+crossArb payload),
all HTML pages (+CrossArb nav link)
behavior/.
Pipeline hooks added to registry.ts (2 call sites). Behavior initialization
added to index.ts. Build verified, service restarted, health check passed.
reflexivity.ts imported PriceEntry from marketState.ts
but it was defined in types.ts. Fixed import path. TypeScript compilation
passed with zero errors.
diagnostics.ts with ε distribution tracking, gate counters,
baseline stability reporting, and memory monitoring. Lowered ε log threshold from
1.2 to 0.8 for validation. Added getBaselineStats() to drivers.ts.
Modified pipeline.ts to call recordGateResult() and
recordEpsilon(). 60s periodic reports confirmed working.
/plan.html with nav links from dashboard.
registry.ts: refreshMarkets() + startRefreshCycle();
wsManager.ts: reconnect())pipeline.ts)types.ts)behavior.js, diagnostics.ts: getSnapshot(),
wsBroadcast.ts: behavior data in WS updates)CLAUDE.md project instructions and comprehensive memory files
for session continuity/diagnostics.html page with 30-minute automated snapshots.
Backend takes snapshots at :00 and :30 each hour (plus one on startup),
stores up to 48 (24 hours rolling). API at /api/diagnostics/history.
Page shows trend strip (latest metrics), expandable snapshot cards with full gate tables,
epsilon/driver/price-move distributions. Auto-refreshes every 60s.
Nav link added to main dashboard.
diagnostics.ts: startSnapshotCycle(), getSnapshotHistory()app.ts: /api/diagnostics/history endpointpublic/diagnostics.html: Full frontend with trend strip + snapshot cardshttps module (Node native fetch triggers Kalshi rate limits).
kalshi/types.ts — API + internal type definitionskalshi/registry.ts — REST polling with pagination + orderbook staggerkalshi/edgeEngine.ts — Intra-Kalshi edge computationkalshi/index.ts — Init entry point + re-exportsserver/routes/kalshi.ts — Debug API (/debug/kalshi/markets, /edges, /status)public/kalshi.html — Dashboard with markets table, edge scanner, poll statusapp.ts (route mount), wsBroadcast.ts (kalshi WS payload),
marketRegistry/index.ts (non-blocking init call), nav links on all pages.
/adminer (protected by same cookie auth).
diag_snapshots, kalshi_market_snapshots,
kalshi_edge_snapshots, poly_edge_history/adminer via PHP-FPM 8.1, Caddy route with cookie auth/api/diagnostics/history?hours=N
reads from DB with in-memory fallback (survives restarts)db/pool.ts — mysql2 connection pool + testConnection()db/writers.ts — Fire-and-forget writers for all 4 tablesdb/readers.ts — readDiagSnapshots(hours) for history APIdb/index.ts — Barrel re-exportsmarketRegistry/index.ts (DB test on boot),
behavior/diagnostics.ts (persist snapshots),
kalshi/registry.ts (persist markets + edges after event polls),
marketRegistry/edgeEngine.ts (persist closed Polymarket edges),
server/app.ts (DB-backed diagnostics history with ?hours=N param).
/files for web-based file browsing,
editing, uploading, and downloading. Single PHP file served by PHP-FPM 8.1 via Caddy.
Protected by same cookie auth as all other tools. Root path set to /home/jayson.
Dark theme, hidden files visible. www-data added to jayson group for read access.
/backup
and CLI at duplicati-cli. Runs as systemd service on port 8200 (localhost only),
proxied through Caddy with cookie auth. Supports S3, SFTP, Backblaze, local, and 30+ other
backup targets. Encrypted, deduplicated, scheduled backups with web-based restore.
setInterval in Kalshi registry init + one run at startupkalshi_market_snapshots and kalshi_edge_snapshots where poll_ts < 7 days agodb/writers.ts (pruneKalshiSnapshots()),
db/index.ts (re-export), kalshi/registry.ts (hourly timer).
order=volume
(lifetime) to order=volume24hr. Was pulling stale high-total-volume markets; now gets
the 50 most actively traded markets. Bottom market now has $500K+ 24h volume vs $9 before.market.volume now stores m.volume24hr
instead of m.volume (lifetime). Gate 3 liquidity check uses this value.registry.ts (API query + volume field),
diagnostics.ts (delta snapshots), diag_snapshots table truncated.
pw_trade_token with real PW auth system. Trading app now shares
the same login session as PW CRM via PWSESSID cookie.
auth.professionalwinner.us/auth/validate-session.php
→ identity_id, email, roleauth.professionalwinner.us/trading-login/ (dedicated login page)auth.ts file and /api/login endpointserver/authMiddleware.ts (rewritten),
server/app.ts, server/wsBroadcast.ts,
server/routes/health.ts, public/login.html,
public/js/app.js, public/diagnostics.html,
public/plan.html, /etc/caddy/Caddyfile.
auth.professionalwinner.us/trading-login/ — a dedicated login page
for the trading app (matching the pattern of CRM’s crm-login/). Dark themed
to match the trading UI. After login, redirects directly to
trading.professionalwinner.us instead of the app chooser.
trading-login/index.php created on Hestiaserver/app.ts AUTH_LOGIN_URL → trading-login/public/login.html button updated to trading-login/paper_trades DB table. CLOB SDK
installed for read-only market data (orderbooks, tick sizes, fee rates). Book validator
runs every 5min comparing WS-derived vs REST prices.
paper/types.ts, paper/paperTrader.ts,
server/routes/paper.ts, api/clobClient.ts,
api/bookValidator.ts, public/paper.htmlbehavior/pipeline.ts (setOnWouldTrade callback),
behavior/index.ts (setOnPriceUpdate callback),
marketRegistry/index.ts (wire paper + book validator),
db/writers.ts (paper write/update), db/readers.ts (paper read/stats),
server/app.ts (mount /api/paper), server/routes/debug.ts (CLOB routes),
server/wsBroadcast.ts (include paper in broadcast),
public/index.html (Paper Trader nav link)@polymarket/clob-client (72 new packages)The V6.3 design incorporates 14 hardening patches identified through adversarial stress testing. These patches address fragile assumptions, uncovered failure modes, and internal inconsistencies from earlier design iterations (V6.0 → V6.2).
| Patch | Name | What It Does | Status |
|---|---|---|---|
| P1 | Depth Share | Use depth share instead of volume share for impact estimation | In Gate 13 |
| P2 | Resolution Risk | Block fades on markets approaching resolution | Stubbed (Gate 4) |
| P3 | Fee Filter | Net edge must be positive after 2× fee deduction | In Gate 11 |
| P4 | Stop Geometry | Stop distance must exceed spread | In Gate 12 |
| P5 | Partial Fill | Handle partial fills in position tracking | Stage 2 |
| P6 | Refill Persistence | Spoof defense: verify book refill persists for 15s | Stage 2 |
| P7 | Propagation Guard | Block fades during cross-market propagation waves | Stubbed (Gate 5-6) |
| P8 | Multi-Timescale Gate | Require ε confirmation across 15s AND 60s windows | In Gate 8 |
| P9 | Target Randomization | Randomize reversion targets to avoid predictable exits | Stage 3 |
| P10 | Group Exposure Cap | Cap exposure per correlated market group | Stubbed (Gate 15) |
| P11 | Baseline Guard | Detect and handle baseline poisoning via CV stability | In diagnostics |
| P12 | Stop Noise | Add volatility buffer to stop distance | Stage 3 |
| P13 | Regime Reversion | Condition reversion targets on flow regime | Stage 3 |
| P14 | TTL Randomization | Randomize hold TTL × Uniform(0.85, 1.15) | Stage 3 |