For Agents

The approved (Rev 2) strategy for crypto-shortterm: an oracle-lag fair-value arbitrage on Polymarket BTC 5-min Up/Down. Settlement is the Chainlink BTC/USD print (DON median) at close vs open; Binance is only the faster predictor of the next Chainlink print. Trade the gap between P_fair and the Polymarket book, net of fees, concentrated near expiry. Canonical model lives in the spec — see Canonical artifacts.

Working note for the trading-strategy design of crypto-shortterm. Summarizes the why and the load-bearing design corrections; the authoritative formulae and module breakdown are in the codebase spec.

Hypothesis (the edge)

Polymarket’s quote lags the Chainlink oracle. Chainlink BTC/USD updates on a DON cadence; Polymarket’s book reprices behind it. Because Binance moves before Chainlink prints, we can predict the next Chainlink close print from the faster Binance feed and take the side of the Polymarket book that is mispriced relative to that prediction, net of fees.

  • Settlement rule: close ≥ open → Up; ties → Up (the matters at the tie). Settlement source = Chainlink, not Binance.
  • Falsifiable: if the Binance→Chainlink basis is too large/unstable near expiry, or the lag is fully harvested by competitors, the residual net-of-fee edge collapses. Phase 0 measures exactly this before any capital.

Reframe from the original draft

The first version of this note treated microstructure (OFI, OBI, VPIN, CVD, lead-lag) as the primary signal and Binance as a “fair-value anchor.” Rev 2 demotes microstructure to an adverse-flow veto and makes the edge an explicit oracle-lag arbitrage: Ŝ and K are Chainlink quantities; Binance is the predictor of the next Chainlink print. The cited research in crypto-shortterm-prediction-research is still valid — it now justifies the veto, not the entry.

Fair-value model

SymbolMeaningSource
Kwindow open price (strike)Chainlink open print
Ŝpredicted window close priceBinance now + EWMA(Chainlink − Binance) basis
σshort-horizon annualized volnoise-robust EWMA on coarse-sampled Binance returns
τtime left to close (years)venue-epoch clock — Binance server-time offset (lenient 5s observe-only; strict 0.25s for Phase-1 trading)

Ŝ = binance_now + EWMA(chainlink − binance) — we track the lagged basis and project the next Chainlink print. The basis stddev feeds the confidence band directly (see Confidence band).

First measured basis corroborates the reframe (thin — 2 windows)

The first analysis run (crypto-shortterm-phase0-codebase-complete) measured the Binance↔Chainlink basis near expiry at **≈ -63k BTC — small but non-trivial and sign-consistent. This confirms the settlement-vs-predictor basis is real and must be modeled (it already feeds the band) and validates the Rev-2 reframe (settlement = Chainlink, Binance = predictor). Caveat: 2 windows, 0 outcomes — directional only; the per-τ basis distribution still needs many windows before it gates anything.

P_fair confirmed wired live (2026-06-08)

The first live observe run (crypto-shortterm-phase0-live-milestone) recorded 1,340 observations with K = 63,596 set at a witnessed window open and p_fair evolving correctly toward expiry — i.e. Chainlink K, Binance-derived Ŝ, σ and τ flow end-to-end into P_fair on real feeds. Caveats from the run: K is only set for windows whose open the process witnessed (mid-window starts skip the window), and outcomes need a full window to close during a sustained run — so usable calibration data requires running continuously across clean window boundaries.

σ warm-up — prior fallback must be validated in Phase 0

The EWMA σ estimator needs a warm-up of 30 samples before it is trusted. Until then the observe engine falls back to a prior σ = 0.6 (annualized). This fallback is an assumption, not a measurement: Phase 0 must validate the 0.6 prior against real measured short-horizon vol and confirm the warm-up count is enough that the estimator has converged before any sizing decision would read it. A mis-set prior σ directly biases P_fair and the band width during warm-up windows (and on every cold start / feed gap that resets the estimator).

Model sequence: Gaussian closed-form prior → empirical calibration overlay (brought forward to gate sizing, not just reporting) → stronger σ. Student-t / ML deferred.

Near-expiry handling (the key correction)

As τ → 0 near the money, the sensitivity ∂P_fair/∂Ŝ → ∞ — a tiny prediction error in Ŝ swings P_fair from ~0.5 to 0/1. Naively this looks like maximum edge; in reality it is maximum fragility. But this blow-up is moneyness-conditional, and getting that conditioning right is what makes the near-expiry regime tradeable at all.

τ→0 is moneyness-conditional — the danger zone is near-the-money near expiry

The confidence band’s behaviour near expiry depends on where price sits relative to the strike K:

  • Near-the-money near expiry (Ŝ ≈ K): ∂P_fair/∂Ŝ → ∞ → the band EXPLODES. This is the danger zoneP_fair is whipsawed by tiny Ŝ/basis errors. Do not size here, no matter how large the apparent gap to the book.
  • Clearly ITM / OTM near expiry (Ŝ far from K): Φ saturates, so ∂P_fair/∂Ŝ → 0 → the band correctly NARROWS. This is the high-confidence, tradeable regimeP_fair is pinned near 0/1 and robust to prediction noise.

So the rule is not a flat “size up near expiry.” It is: size up near expiry only when clearly ITM/OTM; treat near-the-money-near-expiry as the danger zone where the band blows up. Guardrails:

  • apply a τ-floor τ_min (from measured RTT + cancel latency + clock δ); below it, no new entries regardless of moneyness;
  • size on the pessimistic band edge — this automatically throttles the near-the-money corner (band wide → lower edge → size → 0) and permits the clearly-ITM/OTM corner (band narrow → edge survives);
  • validate the sweet spot against the propagated band + real depth, not fill-rate.

This is counterintuitive and load-bearing: the near-expiry window is the primary fee-favorable regime, but the edge lives specifically in its clearly-ITM/OTM corner — the near-the-money corner is a trap. The pessimistic-band sizing is what cleanly separates the two without a hand-tuned moneyness cutoff.

Edge logic

Premise at risk — there must be a crossable book (first data: spread ≈ 0.98)

The entire edge assumes a two-sided Polymarket book to cross near expiry. The first analysis run (untradeable) saw book spread ≈ 0.98 (bid ~0.01 / ask ~0.99) on the sampled windows — effectively empty/untradeable. The half-spread term in the threshold below would by itself kill every trade at that spread. With only 2 windows this may be a sampling artifact, but it is the top open risk for the Phase-0 go/no-go and the thing the continuous run must resolve before any Phase-1 work.

  • Entry: net-of-fee edge > threshold, where threshold = fee(p) + half-spread + slippage_est + margin(band) + k·tick. Require edge ≥ k ticks — never trade sub-tick noise (tick = 0.01 = 2% of a 50¢ price). (If books really are ~0.98 wide, the half-spread term alone makes the threshold unreachable — see the warning above.)
  • Fee-aware regime selection: Polymarket taker fee = C × 0.07 × p(1−p) peaks at p=0.5 (~2.5% notional) and is tiny near 0/1. So:
    • Near expiry (price → 0/1) → fee small, edge larger → primary regime.
    • Mid-window p ≈ 0.5fee-killed → skip, or maker-only. (Full fee math in Fees.)
  • Exit: prefer selling the token on the book before resolution — otherwise capital locks ≥2h behind the UMA optimistic oracle. Hold-to-resolution only when selling cost > expected gain. Cut on basis / P_fair flip where liquidity allows. Near expiry the real control is not entering.
  • Adverse-flow veto (Phase 1, applies to TAKERS too): clipped multi-level Binance OFI + contrarian OBI (fills cluster when you’re wrong — the Market-Maker’s Dilemma). Microstructure is computed on Binance only (Polymarket aggressor side ≈ random — see crypto-shortterm-data-sources). A Binance jump against a stale Polymarket quote → pull / skip.
  • Maker mode (Phase 2, or earlier): 0 fee + 20% rebate makes maker attractive sooner if taker economics prove marginal; gated by its own validation; fast cancel-on-spot-move + contrarian-OBI veto.

Architecture (shared causally-typed core)

Live and backtest run identical fairvalue/signal/risk code. Every function consumes a point-in-time Snapshot carrying a hard as-of timestamp, so future reads are impossible by construction (not by discipline). Only the data source differs. Module breakdown (ingest / fairvalue / market_state / signal / risk / execution / state-WAL / recorder / backtest) is in the spec; the Phase 0 subset is in crypto-shortterm-data-sources and crypto-shortterm-backtesting.

Financial source of truth

A synchronous WAL + venue reconciliation is the financial source of truth (orders/positions, on the hot path, fsync’d, reconciled against CLOB open orders + on-chain balances at startup and periodically). The async Supabase recorder is telemetry only — it may drop/spill and must never block the hot path. Do not conflate the two.

Phasing

  • Phase 0 — observe-only + confirmations (HARD GATE, no capital): resolve all CONFIRM gates (crypto-shortterm-open-questions); build ingest (incl. Chainlink), fairvalue, recorder, WAL; run P_fair vs realized Chainlink outcomes; measure the Binance↔Chainlink basis by τ and vol regime; calibrate (the overlay that gates sizing). No order placement. Plan: /Users/levander/coding/pmv2/crypto_algo/docs/superpowers/plans/2026-06-08-phase0-observe-and-confirm.md.
  • Phase 1 — fair-value arb (taker), fee-aware near-expiry only: planned after Phase 0 gates resolve (results may pivot taker→maker). Full loop + adverse-flow veto + risk + recovery → backtest → exec-sim → dry-run → canary → small live → ramp.
  • Phase 2 — maker mode: 0-fee/rebate; may be promoted earlier if taker economics prove marginal; own validation gate.

Parameters (validated, not tuned-to-fit)

Knobs kept small and treated as hyperparameters counted in the trial ledger (crypto-shortterm-backtesting): EWMA half-lives (σ and basis), σ sampling interval, τ_min floor, edge k-tick threshold, band confidence multiplier, Kelly fraction (≤0.5×), per-window / daily / drawdown caps.