Two corrections from the 2026-07-03 live P&L attribution session (and babylon pmv2 channel msgs #1032–#1036): a data trap in how attribution joins the outcomes table, and a refutation of the earlier “#1031 PM realized_pnl bug / 7 false losses” claim. Net binding rule: pmv2_autotrade_orders.realized_pnl_usd is the trustworthy P&L label; outcomes.resolved_up is a trading gate, NOT settlement truth.
For Agents — binding rules
- ALWAYS join
outcomeson(asset, window_id), neverwindow_idalone.window_idis shared across all 5 assets for the same 5-min bucket; awindow_id-only join collapses all assets and produces coin-flip labels.outcomeshas duplicate rows per(asset, window_id)— dedupe withbool_or(resolved_up) GROUP BY asset, window_id.- Use
realized_pnl_usd(CLOB /tokens[].winner-derived) as the P&L label. Do NOT useresolved_upfor P&L, sizing, or certainty tiers — it over-books near-tie wins vs the market’s settlement source.- Derive our order’s asset from
pmv2_autotrade_orders.source_id:crypto_5m_algo_*→btc, elsesplit_part(source_id,'_',1).
Correction 1 — attribution join gotcha (outcomes.window_id is not unique)
crypto_shortterm.outcomes.window_id is NOT unique. The same 5-min bucket has one row per asset (btc/eth/sol/xrp/doge) because each asset resolves independently — the same window_id can be resolved_up=true for one coin and false for another in the same window.
- Table: ~9,643 rows over ~5,995 distinct
window_ids. (asset, window_id)IS the unique key (per-asset row count == distinct window count).- A join keyed on
window_idalone collapses all 5 assets together and yields ~coin-flip labels: >50% of the joined windows had self-contradictingresolved_upacross the merged assets.
Data trap
Any attribution/backtest join that keys on
window_idalone silently mislabels roughly half the population. This is not a subtle bias — it is a label scrambler. Join on(asset, window_id).
The correct query shape
-- dedupe outcomes first: duplicate rows exist per (asset, window_id)
WITH oc AS (
SELECT asset, window_id, bool_or(resolved_up) AS resolved_up
FROM crypto_shortterm.outcomes
GROUP BY asset, window_id
)
SELECT o.*, oc.resolved_up
FROM pmv2_autotrade_orders o
JOIN oc
ON oc.window_id = o.window_id
AND oc.asset = CASE
WHEN o.source_id LIKE 'crypto_5m_algo_%' THEN 'btc' -- crypto_5m_algo_up / _down = BTC
ELSE split_part(o.source_id, '_', 1) -- eth/sol/xrp/doge lanes
ENDAsset for our orders derives from pmv2_autotrade_orders.source_id: the BTC lanes are crypto_5m_algo_up / crypto_5m_algo_down → btc; the alt dry lanes carry the asset as the first _-segment → split_part(source_id,'_',1).
Correction 2 — #1031 is zero-delta; resolved_up is NOT settlement truth
Revises prior handover / LOG claim
The earlier claim (repo
HANDOVER.md+ 2026-07-03 “ORACLE-STATE PHASE-0 RUN” bullet, filed as babylon #1031) that PM’srealized_pnl_usdwas “biased NEGATIVE” with “7/246 false losses” from a premature winner-flag read is REFUTED. It was a crypto-side artifact, not a PM bug.
What happened: @deploy CLOB-re-checked all 7 disputed rows. The CLOB tokens[].winner flag is the actual payout oracle = ground truth — and on all 7 rows we LOST. PM’s −cost_basis booking was correct; the retro-correction is zero-delta. The apparent “7 false losses” were an artifact of a flipped token-side cross-reference in an earlier crypto-side session, not a defect in PM’s booking pipeline.
Root mechanism — resolved_up over-books near-tie wins
Our outcomes.resolved_up (on-chain Chainlink settle ≥ K) over-books near-tie wins relative to the market’s Chainlink Data Streams settlement (the source Polymarket actually resolves on):
- On the 2026-07-03 doubled-volatility day, ~15% of resolved fills disagreed between
resolved_upandrealized_pnl_usd. - The disagreement is concentrated entirely in sub-5bps near-ties: disputed cells had median |settle − K| of 0.9–4.8bps vs 8.9bps for the agreed-win cell.
- This is the P&L-side confirmation of the refit study’s durable finding —
resolved_upinflates high-conviction win rates by 4–7pt because near-tie flips land in those bins’ loss column (see 2026-07-03 refit-study bullet).
Binding conclusion
pmv2_autotrade_orders.realized_pnl_usd(CLOB / winner-flag derived) is the TRUSTWORTHY P&L label.outcomes.resolved_upis a trading GATE, not settlement truth — do not use it for P&L, sizing, or certainty tiers.- Reconstructed P&L from
resolved_upis optimistically biased — it showed 2026-07-03 as +88.- This reinforces the Chainlink Data Streams licensing track as the real label fix (Data Streams is the market’s settlement source; our on-chain read is a proxy that disagrees on near-ties). Data Streams stays a label-quality concern — see crypto-shortterm-competitor-wowitsamazing-refuted-2026-07-03 (on-chain
settlevs CLOB truth disagree on 12.6% of windows, 35% within 2bps of strike).
Coverage caveat (context, not a correction)
realized_pnl_usd only has coverage from 2026-07-02 onward (the new booking pipeline). There is no pre-tweak settlement-grade P&L, so pre/post-tweak comparisons on true settlement are not possible yet. The only two booked days:
| Day | realized_pnl_usd |
|---|---|
| 2026-07-02 | +$34 |
| 2026-07-03 | −$88 |
| net | ≈ −$54 |
Related
- crypto-shortterm — project index (frozen regime + calibration rules).
- Gotcha — outcomes.window_id is shared across assets (join on (asset, window_id)) — the reusable join rule +
outcomesunique-key fact. - crypto-shortterm-algo-accuracy-audit-2026-07-02 — the live-emit accuracy/P&L session this corrects the label footing for; its refit-study bullet first flagged
resolved_upover-booking (4–7pt) in high-conviction bins. - crypto-shortterm-competitor-wowitsamazing-refuted-2026-07-03 — Data Streams demoted to a label-quality concern; on-chain
settlevs CLOB truth disagree on 12.6% of windows (35% within 2bps of strike). - crypto-shortterm-polymarket-data-api-gotchas — CLOB /
data-apilabel sources;usdcSize-vs-nominal fee identity. - crypto-shortterm-strategy-design — where the settlement label feeds sizing and certainty tiers (must use
realized_pnl_usd, notresolved_up).