Polytraders Dev Guide
internal
v3 spine Phase 1 · Shared contracts 9 demo-wired · 0 shadow-ready · 0 production-live · 100 pending · 109 total 15/33 infra tasks the plan status board

Polytraders · Milestone scope · v1 · 2026-05-16

M2 scope mapping — Real Data, Real Trades (low value)

The mock-app and the Dev Guide describe the destination. This page maps that destination to a deliverable M2, with clear in-scope / partial / deferred lines per Dev Guide section. Written so the build team can plan against it without having to read the whole guide.

The frame. The mock-app is the internal operator view. The customer-facing app is a simplified subset. When this page says "in mock" it means an operator surface; when it says "in product" it means the customer-facing UI as well. M2 ships both, but the customer-facing UI is intentionally narrower.

M2 objective

Real Data, Real Trades (low value). One strategy family, end-to-end, on real Polymarket V2 markets, with real wallets, real orders, real backtest output, real audit receipts. Politics + Crypto markets only.

Headline scope decisions

DecisionM2 answer
Strategy family in M2Momentum only, parameterised. Other families in M3.
Strategy authoringJSON/YAML parameterised templates with an in-app config editor. No scripting DSL in M2 — that is an M3 commitment.
Strategy score fieldGeneric strategy_score with a score_type tag (fair_value / confidence / expected_edge / custom). Each strategy declares its own.
Portfolio modelPortfolio is the unit of account. Strategies, positions, signals and risk all hang off a Portfolio.
Risk layersThree: Strategy → Portfolio → Tenant. Higher layer wins.
Exit modesStatic TP/SL · strategy-emitted dynamic exit · portfolio-forced exit · time-based exit. Risk Manager arbitrates.
BacktestVisual: price + signal markers per market, equity curve, drawdown, P&L. Operator-facing only. Never surfaced as a track record.
MarketsPolitics + Crypto. Full-universe ingestion (watchlists are view-only).
ClustersRead-only, automatic. Used by Portfolio risk and audit receipts. Not user-edited in M2.
Audit receiptsReason code · builderCode · envelope ID rendered in full on every order/wallet/config/registry page. Never masked.

Dev Guide → M2 mapping (section by section)

Discovery

CapabilityM2Notes
Market scanner (Gamma/Data)InPolitics + Crypto. Full universe to registry.
Market-quality rankerInConsumed by Strategy entry filters.
Clusters (auto)InUsed by Portfolio risk and receipts.
Watchlists (manual)PartialRead/select in mock + product; manual edit M3.
Cluster editing UIDeferredM3.

Strategy

CapabilityM2Notes
Momentum family (parameterised)InSingle strategy family in M2.
Target-portfolio selector on launchInMandatory field on the launcher.
Market scope — cluster binding (primary)InStrategy binds to one or more clusters. Runs on every market currently in those clusters. See Market scope below.
Market scope — manual list (fallback)InHand-picked list of condition IDs, capped at 50 markets per strategy. For one-off arb / single-market test launches.
Market scope — filter expressions (DSL)DeferredM3, together with the scripting DSL.
In-app config editor for parametersInJSON/YAML surface, validated.
strategy_score + score_type contractInReplaces legacy "Fair Value" field.
Visual backtest surfaceInPer market, then expandable.
Scripting DSL (PineScript / Python-subset)DeferredM3 — syntax target chosen then.
AI strategy assistDeferredM3+, depends on scripting layer.
Additional strategy families (Mean-reversion, Convert-arb, etc.)DeferredM3.

Risk

CapabilityM2Notes
Strategy-layer entry filters (e.g. min liquidity)InLives on the strategy config.
Portfolio-layer guardrailsInSizing caps, max concurrent positions, cluster exposure, daily-loss limit.
Tenant-layer guardrailsInKill-switches, jurisdiction blocks, V2-only enforcement, builderCode pinning.
Layer precedence (Tenant > Portfolio > Strategy)InDocumented; risk manager enforces.
Exit modes — all fourInStatic TP/SL · dynamic · portfolio-forced · time-based.

Execution

CapabilityM2Notes
Real walletsInpUSD on Polygon, V2 only.
Real orders (CTFExchangeV2)InEIP-712 v2, builder attribution.
builderCode pinningIn0xb000000000000000000000000000000000000000000000000000000000003f7a, 66 chars bytes32.
Audit receiptsInReason code + builderCode + envelope ID, unmasked, on every order page.
Smart order routerPartialSingle-venue (Polymarket V2) for M2. Multi-venue M4+.

Data & Ingestion

CapabilityM2Notes
Near-real-time book ingestion (WS market)InAuto-reconnect with backoff, staleness alerts.
Historical fill/price storageInFull universe; powers backtest.
RTDS (crypto/equity prices)InStale-marked when feed lags.
WS user channel for fillsInREST polling fallback.

Governance & Audit

CapabilityM2Notes
Reason codes on every outputInUPPER_SNAKE_CASE, registry-validated in CI.
Builder-attribution reconciliationInSource-of-truth for fee accounting.
Governance log (config change / override / reconciliation)InImmutable, append-only.
Config drift detectorInFrozen-manifest CI check (109 bots).

User onboarding

CapabilityM2Notes
Default settings per proficiency levelInCustomer-product side.
Lessons / educational materialsPartialStarter set for M2, expanded M3.

Technical readiness

CapabilityM2Notes
Private pre-production readinessInCloudflare Access, security headers (already shipped on mock).
Basic SSDLCInLint, CI verify, frozen-manifest, reason-code registry.
Load testingInWS + REST paths.
SLO / SLI / error budget / lag metricsInPer-bot, per-endpoint.
Client-data security baselineInEncryption at rest + in transit; key rotation.

Explicitly not on the roadmap

Shared non-negotiables

  1. V2 only. pUSD · CTFExchangeV2 · EIP-712 v2 · builderCode 0xb000000000000000000000000000000000000000000000000000000000003f7a.
  2. Audit receipts unmasked. Reason codes, builderCode and envelope IDs render in full on every receipt/wallet/config/registry page.
  3. INTERNAL banner on every mock-app page.
  4. 109 bot specs frozen. SHA-256 manifest enforces in CI.
  5. No copy-trading. No marketed performance claims.

Glossary deltas

The following terms were added to the glossary alongside this scope doc, so the rest of the guide can reference them: Bot (definition clarified), Backtest, Cluster, Market scope, Portfolio, Risk layers, score_type, strategy_score, Tenant, Watchlist.

Market scope — how a strategy chooses which markets to run on

A strategy binds to a Portfolio at launch. It also needs to know which markets within that portfolio's universe it should evaluate. M2 ships two modes; a third is deferred to M3.

ModeM2BehaviourWhen to use it
Cluster binding (primary) In Strategy binds to one or more clusters. It evaluates every market currently in those clusters. As cluster membership evolves, the in-scope market set evolves with it. The Strategy Detail page shows a live count and a 10-row preview before launch. Default. Use this for any strategy expected to run across more than a handful of markets, including all momentum strategies in M2.
Manual list (fallback) In Operator hand-picks condition IDs via a searchable picker. Hard cap: 50 markets per strategy. The set is frozen at launch and only changes via an explicit edit (which writes a new audit envelope). One-off arbitrage, single-market test launches, narrow event coverage where the cluster is too broad.
Filter expressions (DSL) Deferred e.g. category = "election" AND liquidity > $50k AND days_to_resolution < 90. Strategy runs on whatever matches at evaluation time. M3, shipped with the scripting DSL so the syntax and lint rules are consistent.

Audit and reason codes

Backtest symmetry

Backtests apply the same scope rule retrospectively. A strategy bound to a cluster runs the backtest against the historical members of that cluster over the chosen window. A strategy on a manual list runs the backtest against exactly that list. Backtest and live evaluation must use the same scope semantics — this is a hard rule, not a convention, because it is what lets us trust a backtest as a sanity check rather than a marketing artefact.

What is explicitly out of scope for M2

Open questions for the May review

  1. Confirm Momentum as the only strategy family in M2.
  2. Confirm Politics + Crypto as the only M2 market verticals.
  3. Confirm scripting DSL target (PineScript-style vs Python-subset) is an M3 decision, not M2.
  4. Confirm watchlists as view-only in M2 (no manual cluster editing).
  5. Confirm portfolio model as the unit of account (strategies launch into a portfolio).
Versioning. This page is the source of truth for M2 scope. Changes require a PR against generator/dev_pages.py :: render_m2_scope() and the date in the eyebrow updated.