{% extends "base.html" %}{% from "_macros.html" import pnl_cls, csrf, table, flash, page_head %} {% block title %}Diagnostic · {{ d.event.venue }}{% endblock %} {% block head %}{% endblock %} {% block content %}
Lab › Diagnostics
{% set head_title %}{{ d.event.venue }} · as of {{ d.params.cutoff }} UTC{% endset %} {{ page_head(head_title) }} {{ flash(msg) }}Diagnostic run #{{ d.run.id }} · {{ d.event.name }} · event {{ d.event.source_key }}
As-of runs for this event: {% for r in runs %}{% if r.id == d.run.id %}#{{ r.id }} ({{ r.cutoff }}){% else %}#{{ r.id }} ({{ r.cutoff }}){% endif %}{{ " · " if not loop.last }}{% endfor %}
| Cutoff | {{ d.params.cutoff }} UTC |
| This event's sessions | {% for k, v in d.metrics.audit.event_sessions.items() %}{% if v %}{{ k }} {{ v }} {% if k in d.metrics.audit.sessions_used %}used{% else %}excluded{% endif %} · {% endif %}{% endfor %} |
| Latest data in each table | {% for k, v in d.metrics.audit.latest_data.items() %}{{ k }}: {{ v }} · {% endfor %} |
| Grid | {{ d.metrics.audit.grid }} |
| Races the finishing model trained on | {{ d.metrics.audit.training_races }} (all before the cutoff) |
| Polymarket prices | never used to fit or price; read from stored hourly history at/before the cutoff for comparison only |
PM@cutoff = last Polymarket price at/before the cutoff; 24h move = change over the 24 hours before it; latest = now (after the result). Edge = our fair − PM@cutoff.
{% for kind, ms in groups %}| Outcome | Our fair | PM@cutoff | PM 24h move | Edge | Paper trade | Result | Paper P&L | PM latest |
|---|---|---|---|---|---|---|---|---|
| {{ r.subject }}{% if kind == 'race_h2h' %} ({{ r.question.split(': ')[-1] }}){% endif %} | {{ r.fair|fmt("model_prob") if r.fair is not none else "–" }} | {{ "%.3f"|format(r.pm_cut) if r.pm_cut is not none else "–" }} | {{ ("%+.3f"|format(r.pm_move_24h)) if r.pm_move_24h is not none else "" }} | {{ ("%+.1f"|format(r.edge * 100)) ~ " pts" if r.edge is not none else "" }} | {{ r.paper_side or "" }}{% if r.paper_side %} @ {{ "%.3f"|format(r.paper_price) }}{% endif %} | {{ "YES" if r.result == True else ("NO" if r.result == False else "") }} | {{ (r.paper_pnl|money(true)) if r.paper_pnl is not none else "" }} | {{ "%.3f"|format(r.pm_latest) if r.pm_latest is not none else "" }} |
Lower is better. Polymarket at the cutoff is the benchmark to beat; one race is a very small sample.
Rule (decided at the cutoff): buy YES at PM@cutoff when our fair is ≥ {{ "%.0f"|format(consts.paper_edge * 100) }} pts above it, buy NO when ≥ {{ "%.0f"|format(consts.paper_edge * 100) }} pts below; {{ consts.paper_stake|money(false, false) }} per trade. {{ summary.paper_n }} trades · staked {{ summary.paper_staked|money(false, false) }} · P&L {{ summary.paper_pnl|money(true) }}
A taker's test of the model: it pays Polymarket's price with no spread or slippage (optimistic). {% for k, c in coherence.items() %}{% if not c.ok %}{{ k }}: Polymarket prices summed to {{ "%.2f"|format(c.sum) }} (expected {{ c.target }}), an empty book, so it's excluded. {% endif %}{% endfor %}
Our maker rests post-only quotes on {{ "Kalshi" if venue == 'kalshi' else "Polymarket" }} at fair ± {{ "%.0f"|format(rp.params.half_spread * 100) }}¢ (skewed against inventory, never crossing the market, so YES bid + NO bid < $1), requoting every {{ rp.params.step_min }} min and pulling {{ rp.params.pull_min }} min before qualifying and the race. It skips markets priced outside {{ "%.0f"|format(rp.params.price_band[0] * 100) }}–{{ "%.0f"|format(rp.params.price_band[1] * 100) }}¢, with under {{ rp.params.min_volume_24h|money(false, false) }} traded in the last 24 h, {% if rp.params.max_disagree %}or where our fair is more than {{ "%.0f"|format(rp.params.max_disagree * 100) }} pts from the market{% else %}(disagreement filter off){% endif %}. Limits: {{ "%.0f"|format(rp.params.size) }} shares per quote, {{ "%.0f"|format(rp.params.max_pos) }} shares per market, {{ rp.params.max_capital|money(false, false) }} worst-case loss for the event. It only gets filled by real taker trades that came after its quote — takers see prices, not our fair value.{% if venue == 'kalshi' %} Kalshi charges makers a fee: ceil({{ rp.params.maker_fee }} × contracts × P × (1 − P)) cents per fill, taken from the P&L.{% endif %}
Downloads this event's tape once (about 2 MB) and re-runs the whole replay on your computer as you move the knobs, with the same rules and data as the server replay below.
Ranges are the server form's, narrowed to what a slider can reach (the form below takes any value). Half-spread is in dollars per share (0.02 = 2¢); disagreement 0 turns the filter off.
Half-spread is in dollars per share (0.02 = 2¢). Results update in about a second; the sensitivity table varies half-spread and fill rule around these settings.
Each stage uses one as-of run, from its cutoff until the next run or the next session.
{{ table(rp_stages, ["run_id", "start", "end", "fills", "notional", "spread_pnl", "markout_60m", "model_edge", "pnl"], {"run_id": ["/lab/diagnostics/", "run_id"]}) }}spread_pnl: captured vs the market price at the fill. markout_60m: the market's move over the next hour against us (negative = adverse selection: the takers knew something). model_edge: what our fair value said the fills were worth. pnl: held to the official result. worst_case: worst loss of the positions at the race start.
Limits: minute prices and trades only, no order-book depth (queue position and competing makers are unknown), and our quotes don't change what takers would have done. Book snapshots recorded from now on {% if user.role == 'admin' %}(racinglines markets record) {% endif %}replace the touch/through bounds with a queue model.
The polymarket-takers system account (no login) stands in for the Polymarket traders whose real trades filled the replayed maker: each fill becomes its bet on the demo maker's market for that outcome, at the maker's price, so its P&L is the maker's P&L reversed. It is not the demo taker, which paper trades its own strategy on the Strategy page.
{{ summary.taker_n }} Polymarket-taker bets · staked {{ summary.taker_staked|money(false, false) }} · their P&L {{ summary.taker_pnl|money(true) }} · maker P&L {{ -summary.taker_pnl|money(true) }}
{{ table(bets, ["id", "title", "side", "price", "stake", "payout", "status", "taker_pnl", "note"], cap=15, filter="Filter by market") }}{% endif %}