advancepsilon's picture
Initial upload: 25 days of trades, windows, dense samples, orderbook snapshots
9c2b0ee verified
# Oracle Disagreement Labels — Polymarket vs Kalshi 15-min crypto windows
Training and evaluation data for predicting when the two independent oracles
settling a cross-platform hedged crypto binary trade will **disagree** on
direction, causing a double-loss event.
- **Platforms**: Polymarket (settles via Chainlink Data Feeds) and Kalshi
(settles via CF Benchmarks real-time index, e.g. BRTI for BTC).
- **Asset universe**: BTC, ETH, SOL, XRP.
- **Window length**: 15 minutes, aligned to UTC `:00`, `:15`, `:30`, `:45`.
- **Data range**: 2026-04-14 → 2026-04-22 (8 days of labels; dense samples
2026-04-19 → 2026-04-22 only, Phase 1 instrumentation shipped on Apr 19).
- **Base disagreement rate**: 5.7% across assets; 6.1% BTC / 3.9% ETH / 7.2%
SOL / 5.6% XRP.
## Problem statement
For each 15-minute window, predict the binary target:
```
disagreement = (poly_settled == 'UP') != (kalshi_settled == 'UP')
```
from features observable at `T = window_close − k` seconds, where `k ∈ [60, 300]`.
**Economics drive the task, not accuracy**:
- Catching a real disagreement saves ~$12.23 on BTC, ~$4.13 on SOL, ~$4.86 on
XRP, ~$3.44 on ETH (per-asset average at current position sizing).
- A false positive costs ~$1.00 (round-trip exit friction: fees + bid-ask).
- Breakeven precision: `FP / (FP + TP)` — so ~8% on BTC, ~20% on ETH.
- **Recall matters ~15× more than precision at BTC sizing.**
The production baseline rule
`coinbase_dist_bp < 4 OR sign_flip(binance − poly_strike, coinbase − kalshi_floor)`
at T−60s on BTC gives **PPV 24%, Recall 82%, EV +$592 over 20 days** (in-house
backfill validation; see ship target in source repo docs).
## Files
| File | Rows | Purpose |
|---|---|---|
| `windows.parquet` | 2,781 | One row per labeled window. Target: `disagreement`. |
| `dense_samples.parquet` | 28,408 | 10-s-cadence Binance + Coinbase spot prices for each window's final 5 min. |
| `orderbook_snapshots.parquet` | 15 | Per-minute book state (bid/ask/depth each side each platform) for in-flight hedged trades. Sparse — instrumentation shipped 2026-04-21. |
| `trades.parquet` | 407 | Live-traded rows with realized P&L. Useful for EV-per-window validation. |
| `stats.json` | — | Row counts, per-asset base rates, date range. |
### `windows.parquet`
| Column | Type | Notes |
|---|---|---|
| `asset` | str | `btc` / `eth` / `sol` / `xrp` |
| `window_start` | timestamp[UTC] | Window open time |
| `window_end` | timestamp[UTC] | Window close time (target timestamp) |
| `window_ts` | int64 | Unix-seconds of `window_start`; primary join key |
| `oracle_agreed` | bool | Raw label (True = same direction on both oracles) |
| `disagreement` | bool | **Target**`NOT oracle_agreed` |
| `poly_settled` | str | `UP` or `DOWN` per Chainlink |
| `kalshi_settled` | str | `UP` or `DOWN` per CF Benchmarks |
| `kalshi_expiration_value` | float | CF Benchmarks index value at close |
| `poly_ptb` | float | Poly strike (price-to-beat, scraped) |
| `poly_rtds` | float | Poly RTDS-reported strike (may differ from `poly_ptb` by ~$0.16 for ETH; see notes) |
| `kalshi_floor` | float | Kalshi strike |
| `strike_gap` | float | `poly_ptb − kalshi_floor` in absolute units |
| `ptb_source` | str | Where the strike came from (PTB scraper vs RTDS vs fallback) |
| `delta_ptb_vs_rtds` | float | Cross-check delta |
| `settled_at` | timestamp[UTC] | When the row was finalized |
### `dense_samples.parquet`
Per-observation spot prices. Join to `windows` on `window_ts + asset`.
| Column | Type | Notes |
|---|---|---|
| `asset` | str | |
| `ts` | timestamp[UTC] | Sample timestamp |
| `window_id` | str | Format: `{asset}-{window_ts}` |
| `window_ts` | int64 | Join key |
| `trade_id` | str \| null | Set when an active hedged trade was in this window |
| `binance` | float | Binance spot, Chainlink proxy |
| `coinbase` | float | Coinbase spot, CF Benchmarks proxy |
| `poly_strike` | float | Chainlink-aligned strike |
| `kalshi_floor` | float | CF-Benchmarks-aligned strike |
| `secs_to_close` | int | Seconds from sample to window close |
| `sample_age_ms` | int | Staleness of the spot fetch |
| `coinbase_dist_bp` | float | `(coinbase − kalshi_floor) / kalshi_floor × 10000` — signed |
| `binance_dist_bp` | float | Same, Binance side |
| `sign_flip` | int8 | `1` if Binance and Coinbase are on opposite sides of their respective strikes |
| `cross_spot_bp` | float | `|binance − coinbase| / mid × 10000` — pre-computed cross-exchange spread |
Cadence: ~10 seconds per sample, only during the final 300 seconds of each
window (Phase 1 sampler design). Four assets sampled in parallel.
### `orderbook_snapshots.parquet`
Best bid/ask and depth from both platforms for in-flight hedged trades,
emitted once per 60 seconds in the final 5 minutes. Sparse because the logger
shipped 2026-04-21 and has only been on for ~12 hours at dataset build time.
Columns: `asset`, `trade_id`, `window_id`, `ts`, `secs_to_close`, plus
`{poly,kalshi}_{yes,no}_{bid,ask,depth}`.
### `trades.parquet` (sanitized)
**This file has been sanitized for external research use.** All fill
prices, position sizes, Kelly fractions, fees, sides, and dollar P&L have
been removed. What remains is derivable from public market data plus
two anonymous outcome booleans.
| Column | Type | Notes |
|---|---|---|
| `id` | uuid | Opaque row identifier |
| `matched_event_id` | str | `crypto-<asset>-15m-<asset>-updown-15m-<window_ts>` |
| `asset` | str | Derived from `matched_event_id` |
| `window_ts` | int64 | Join key matching `windows.window_ts` |
| `oracle_agreed` | bool | Label for this trade's window |
| `created_at` | timestamp[UTC] | Entry time (reveals `minute_in_window` but that's also explicit below) |
| `resolved_at` | timestamp[UTC] | Settlement time |
| `poly_strike` | float | Strike at entry (public) |
| `kalshi_strike` | float | Strike at entry (public) |
| `spot_at_trade` | float | Binance spot at entry (public) |
| `binance_spot` | float | Binance spot at entry (public) |
| `coinbase_spot` | float | Coinbase spot at entry (public) |
| `strike_gap_pct` | float | Derived: `(poly_strike − kalshi_strike) / kalshi_strike` |
| `flat_candle_move_pct` | float | Derived: spot movement since window open |
| `minute_in_window` | int | 0–14, minute at which entry occurred |
| `binance_coinbase_divergence_pct` | float | Cross-exchange spread at entry |
| `was_win` | bool | Anonymous: did this trade resolve profitably? |
| `was_double_loss` | bool | Anonymous: was this a double-loss event? |
**What's useful in this file**:
- Identify which windows were traded (`window_ts`) for selection-bias analysis.
- Compare model fire-points against real traded windows.
- Cross-check that `was_double_loss ⊆ NOT oracle_agreed` (sanity).
- Aggregate win rate for validating the EV formula.
Per-asset trade counts: BTC 176, ETH 95, XRP 68, SOL 68. Overall win
rate **89.19%**, double-loss rate **10.81%**.
**What's NOT in this file (and why)**:
- Fill prices, sizes, fees, P&L, Kelly fraction — all stripped to avoid
exposing the bot's live execution characteristics. If you need
ground-truth EV numbers, use the per-asset aggregates in the project
docs (avg DL cost: BTC −$12.23, ETH −$3.44, SOL −$4.13, XRP −$4.86;
avg FP cost ~$1.00).
- Sides (YES/NO per platform) — not needed for disagreement prediction
(the target is window-level, not side-level) and would reveal our
direction-selection logic.
## Recommended splits
- **Walk-forward**: train on rolling N=5 days, test on next M=1 day. No single
fixed split — our live signal drifts with volatility regimes and platform
fee structure. The 2026-04-21 windows are the most recent and should
dominate the test set in every fold.
- **Never mix traded and non-traded windows within a fold**. Traded windows
(matched by `trade_id` in `dense_samples`) are a biased subset — the entry
guards specifically select near-strike windows. Use non-traded windows for
training signal, traded windows for out-of-sample realism checks.
## Known gotchas
1. **`poly_rtds` is unreliable on ETH**: RTDS has been measured ~$0.16 off
vs the PTB scraper's ground truth. Prefer `poly_ptb` when both are
present; fall back to `poly_rtds` + sanity-check gap only if PTB missing.
2. **Phase 1 dense sampling started 2026-04-19**. Windows before that date
have labels but no `dense_samples` rows. Your dense-feature model is
trained + evaluated only on 2026-04-19 onward.
3. **Pre-rotation log data is not in the bundle**. The rotated `.zst` logs
from earlier dates contain only pre-Phase-1 output without `ORACLE_SAMPLE`
lines, so re-running the ingestion script won't recover earlier dense
data. Historical reconstruction requires pulling raw exchange tick data
and simulating the Phase 1 sampling cadence.
4. **Sampling coverage varies**. If either Binance or Coinbase fetch failed
at a tick, the sample is emitted with a `null` field. Impute or drop as
your model requires; current production rule drops.
5. **Strike uniqueness**: `strike_snapshots` can have duplicate rows per
`(asset, window_ts)`. The build script picks the first occurrence; a more
principled approach (earliest-vs-latest) is an ablation point.
6. **Labels are settlement-truth, not prediction-time truth**. The
`kalshi_expiration_value` in the label is the CF Benchmarks value at
close, which can differ from the same index's value at T-60s by several
basis points. Do NOT use `kalshi_expiration_value` as a feature — it
leaks the target.
## Reproduction
This dataset was generated by:
```bash
python3 scripts/build_oracle_disagreement_dataset.py
```
against the production Supabase database and rotated log files. Source is in
the repo under `scripts/build_oracle_disagreement_dataset.py`.
## License
Internal research data. Do not redistribute outside the Anthropic /
polymarket-arb project without permission.
## Baseline EV numbers to beat
| Horizon | Rule | PPV | Recall | EV per 20d (BTC only) |
|---|---|---|---|---|
| T−60s | `coinbase_dist<4 OR sign_flip` | 24% | 82% | +$592 |
| T−120s | same rule | 18% | 64% | +$219 |
| T−300s | same rule | 11% | 52% | +$89 |
Ship target: PPV ≥ 35% at recall ≥ 70% at T−60s, AND PPV ≥ 13% at recall
≥ 60% at T−5 min on held-out walk-forward validation.
## Contact / questions
See `docs/architecture/oracle_disagreement_exit_guard.md` in the source repo
(especially §13–14) for the full backtest methodology and ruled-out
features.