Handling Stale Position Data When Trading Crypto Futures
Summary
The article examines a futures execution hazard: an exchange may report an outdated position after a limit order has already filled. A strategy that interprets the stale response as an unfilled order can submit another opening order and accumulate unintended exposure. The author recounts seeing a strategy repeatedly add to a long position and explains why favorable market movement made that incident less damaging than it could have been.
Three approaches are discussed: use one aggressive limit order, rely on an exchange’s market-order function, or keep limit orders while checking whether they disappear from the open-order list and then waiting for position data to refresh. The supplied template follows the third approach, calculating remaining requested quantity from observed position changes, retrying orders, and pausing when position data appears delayed. It also includes routines for closing positions. This is a proposed beta template, not a validated execution guarantee; stale data, partial fills, cancellation behavior, and venue-specific API semantics still require careful handling.
Key ideas
- Stale position responses can make a strategy mistake a completed order for an unfilled one and overtrade.
- An open order disappearing can indicate either cancellation or execution, so position data needs follow-up checks.
- The proposed method retries only the remaining target quantity and waits when observed position changes stall.
- Aggressive limits and market orders are alternatives, each with potential execution or missed-trade costs.
- The template is described as a beta approach and does not establish that it prevents all duplicate exposure.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.