BANGER
Product status: Banger’s public beta is paper-only. References to live execution are future-looking. Venue rules and legal claims can change; verify current primary sources for your jurisdiction.
2026-11-03 · 6 min read · facts as of 2026-11-03

Detect Stale Quotes in a Paper Strategy Test

A quote that has not changed in two minutes is not automatically wrong. It might be a quiet market with no new trades, or it might be a dead feed that stopped delivering. Your paper strategy cannot tell the difference unless you make it. This post covers three things: the two different ages every tick carries, how to pick a freshness rule on purpose instead of by accident, and why recording a gap beats pretending the last quote still holds.

Two clocks, two kinds of age

Every quote has at least two timestamps that matter, and confusing them is the most common way staleness checks go wrong.

These diverge. A market can be genuinely idle, so observation age grows while messages (heartbeats, unrelated channel traffic) still arrive and receipt age stays near zero. The reverse is worse: your socket silently drops, no messages arrive, and the last quote you cached looks perfectly valid because you are only reading its price, not asking when it landed.

Kalshi's WebSocket ticker payloads give you the venue clock directly. Older messages carried ts in Unix seconds and time as an RFC3339 datetime; Kalshi has since added millisecond ts_ms fields to non-margin messages while keeping the seconds and RFC3339 fields for now, and has marked the older ticker.ts, ticker.time, trade.ts and similar fields deprecated in its AsyncAPI docs. If you parse these yourself, read the current field, not a removed one.

Idle market versus disconnected worker

The signal that separates a quiet market from a dead connection is the heartbeat, and Kalshi is explicit about it. Kalshi sends WebSocket Ping frames every 10 seconds with the body heartbeat, and clients respond with Pong. The practical consequence: if those pings stop arriving, the connection is dead and you should reconnect, independent of whether any price changed.

So you actually have three states, not two:

A single threshold on price-change age cannot distinguish the first two. You need the receipt clock and the heartbeat, measured separately from the quote's own timestamp. Note that some well-behaved clients delegate ping handling to the library: the Python websockets library, for example, answers ping/pong automatically, which keeps the socket alive but means your strategy code never sees those frames. If the library handles liveness, track receipt age at the layer that still sees message arrivals.

Choose a freshness rule, do not inherit one

There is no universally correct staleness threshold. The right number depends on how fast your market moves and how much slippage a stale fill would cost you. A 90-second-old quote on a slow weekly settlement market may be fine. The same age on a fast-moving event is a trap. Pick the rule deliberately and write it down as part of the experiment, because it changes what your results mean.

A workable rule has three independent limits rather than one:

The following is a hypothetical rule with chosen inputs, not a recommendation or a tested parameter. Suppose heartbeats arrive every 10 seconds. Setting max receipt age to 25 seconds trips after roughly two missed pings; setting max observation age to 60 seconds is a separate judgment about how stale a price can be before you stand aside. Those two numbers answer different questions and should not be collapsed into one.

Record the gap, do not paper over it

The failure mode that quietly corrupts results is carrying the last good quote forward and valuing positions against it as if it were current. In a backtest that inflates confidence; in forward paper it produces fills that could never have happened. The discipline is to preserve missing data as missing. When a quote is absent or past your freshness limit, log that state and let valuation reflect the uncertainty, rather than substituting the stale number and moving on.

This mirrors how careful feed clients are built. One open-source async Kalshi client, for instance, preserves unknown WebSocket message kinds as a raw variant so applications can log or handle newly introduced events instead of dropping them. The same instinct applies to gaps: an unexplained silence is information, and throwing it away is a modeling choice you did not mean to make.

Where this fits in a paper workflow

If you are testing on Banger, this matters because a paper result is evidence under a specific data, fill, fee and valuation model, not proof of real execution. Banger is a paper-research beta: it runs code-first strategies against current Kalshi and Polymarket market data without venue keys, and public live deployment is blocked. Hosted historical backtesting currently supports Kalshi binary markets. The strategy callback is on_market_tick(self, market, tick, ctx), tick prices are Decimal, bid and ask can be absent, and the tick timestamp is a datetime. That absent-quote case and that timestamp are exactly the inputs your freshness check consumes.

A couple of simulation details sharpen why staleness handling is not optional. The public 0.1.7 forward-paper context can fill a non-crossing requested limit at that limit and logs paper.fill.resting-assumed when it does, and missing quotes can trigger a price fallback. If you feed a stale or fallback price into a sizing decision and the simulator fills it, your recorded P&L reflects a world that did not exist. Inspect the actual result model to see which assumption produced a given fill, rather than assuming every fill walked a live book.

To check behavior locally, run an existing file with banger run strategy.py --paper after account setup, watch it under supervision, and Ctrl+C to stop; that creates a local paper record. Deliberately choose and preserve one exact current market ticker for the run, because taking whatever a discovery call returns first does not make the test reproducible. Stopping preserves your research history and says nothing about any real account, since there is no live order path here to begin with.

The short version

Sources

Keep reading

Run your first strategy free

Paper-trade on Polymarket and Kalshi market data without venue keys.

Start free