Crossed Order Books: Diagnosing Agent Market Inputs

By DX Research Group · · Market data

A reconstruction checklist for negative spreads, mismatched snapshots, and venue state.

A crossed state snapshot can distort an autonomous trading agent’s reasoning before any action is proposed. We retain the contradictory prices as a regression fixture and diagnose the reconstruction that produced them.

A crossed book has a best bid above its best ask. That condition deserves investigation before downstream features treat the midpoint as an ordinary market observation. The cause may be a reconstruction error, mixed sources, or a venue state with different quote semantics.

Start with a visible contradiction

Assume a synthetic reconstructed bid of 101 and ask of 100. The arithmetic spread is minus one and the midpoint is 100.5. A feature pipeline can calculate both without raising an exception. The problem is semantic: the pair may not represent one coherent continuous-trading book.

Preserve the signed spread and original sides. Such repairs remove the diagnostic evidence and can turn corrupted input into a believable series. Preserve the raw pair, mark the state, and investigate its origin.

Check whether the sides belong together

Compare venue, product identifier, snapshot generation, and sequence. A bid from one capture and an ask from another can cross even if each original snapshot was coherent. A generic cache keyed only by symbol can create this problem across markets. Trace each side back to the same reconstruction state.

Next inspect update ordering and recovery. An older ask deletion applied after a newer snapshot can resurrect a stale level. Record when a new snapshot supersedes earlier queued updates. A deterministic replay of a short problematic interval is more informative than repeatedly reconnecting without retaining evidence.

Read the venue-state fields

Coinbase's product-book documentation describes auction-mode fields and indicative quotes. A consumer should distinguish those from ordinary book observations. The interpretation depends on the endpoint and venue state; a single universal spread rule cannot substitute for the documented protocol.

In your schema, store the venue state next to the prices rather than in an unrelated log. This lets a reader filter continuous-trading observations without guessing which timestamps belonged to an auction or transition.

Build a classification fixture

Use four synthetic cases: a normal bid of 99 and ask of 100, equal bid and ask of 100, a crossed pair of 101 and 100, and an incomplete book with no ask. Give them distinct states: positive spread, locked, crossed, and incomplete. A missing side should not become a zero price.

Then add provenance fields. A crossed pair with inconsistent snapshot identifiers should receive a reconstruction diagnostic. One explicitly labeled indicative by its source should retain that label. These classifications organize investigation; they do not prove the ultimate cause of a real incident.

Quarantine derived values

Record how many observations and decisions are affected. Report the changed population when excluding affected observations. If the system operates during those intervals, a failure or abstention policy is part of behavior worth measuring.

What a clean check proves

Nonnegative spreads are a useful invariant for a specified continuous-book representation, while freshness and complete depth require separate checks. A stale book can look internally consistent. Combine structural validation with sequencing and availability evidence, and keep unresolved anomalies in the diagnostic record.

Place this check in the agent loop

Our state and memory framework explains how this input contract fits a persistent trading agent. Use the harness-transfer test design to distinguish a data-adapter change from a change in model behavior.

Sources

Related field notes