Getting Started
Trading Bot Stale Data: Why It Happens and How to Fix It
Trading bot stale data is one of the most common — and most underdiagnosed — causes of unexpected fill prices and strategy underperformance. Your bot fires at the right signal, the order goes in, and the fill comes back worse than expected. The culprit is often not your execution logic but the data your bot consumed before placing the trade. If that data was stale, the price your bot acted on was not the price the market was at when the order arrived.
This article explains how staleness happens, how to measure it, and what to do about it.
What Stale Data Means
Stale data is market data that has been delayed between when a price event occurred on an exchange and when your trading application consumed it. The delay may be milliseconds, seconds, or even longer depending on your data feed tier and the delivery path.
For most retail-grade trading bots using free or low-cost data subscriptions, staleness is a structural feature, not a bug. The data provider deliberately introduces delay as part of their free tier terms. When your bot reads that price and places a market order, the fill arrives at the real current price — which may be significantly different from what the bot measured.
In slow-moving, multi-day trend strategies this matters little. In intraday strategies, momentum scalps, or any approach that depends on acting quickly after a signal, stale data is a systematic tax on every trade.
The IEX vs SIP Problem
The most widely used free data feed for retail trading bots is IEX (Investors Exchange). IEX provides real-time and historical data for free under its public API. However, IEX has structural characteristics that create data delay relative to the National Best Bid and Offer (NBBO) and the consolidated Securities Information Processor (SIP) feeds that institutional participants use.
For a full explanation of how IEX, SIP, NBBO, and consolidated feeds work together, see the US Stock Market Exchanges and Data Feeds guide. The key point for this article: IEX data reflects IEX's own order book and the trades that occur on IEX's exchange. It does not always reflect the consolidated NBBO in real time. When a large move happens primarily on NASDAQ or NYSE, your IEX feed may not update immediately.
Here is the flow from a market-moving news event to your bot's order:
By the time your bot reads the IEX update and routes an order, the market has continued moving from the initial event price. The SIP-feed traders were already positioned. Your bot is chasing a print that is now history.
How Staleness Causes Bad Fills
The practical effect of stale data depends on your strategy type:
For scalping or intraday momentum strategies, a 200ms data lag on a $50 stock moving 0.5% per minute means your quote is already 0.08% stale before your bot processes it. On a round trip, that is 0.16% of slippage from data alone — before you account for spread and market impact. At 10 trades per day, that is roughly 1.6% daily drag on a strategy whose edge may only be 0.2–0.3% per trade.
How to Detect Stale Data in Your Bot
Before upgrading your data feed, confirm that staleness is actually your problem. Three diagnostic approaches work reliably:
Compare your bot's received quote timestamps against trade execution timestamps. Log quote_timestamp, signal_timestamp, and fill_timestamp for every order. Calculate fill_price - quote_price across 50+ trades. If the average is consistently negative (you are buying above your quote price), staleness or slippage is the cause. Also compare your bot's quote against a second data source at the same moment — use requests.get against two different endpoints and log the prices with time.time() nanosecond precision. A consistent delta between sources is your staleness estimate.
Match your data feed to your strategy type. For multi-day swing trades: IEX free is adequate. For intraday strategies with holds over 5 minutes: Polygon Starter (roughly $29/month) provides WebSocket streaming with sub-100ms latency. For high-frequency or scalping strategies: IBKR's real-time feed via TWS API is the most accessible institutional-quality option for retail. For professional latency requirements: Direct SIP access via a co-located server — cost is $1,000+/month before infrastructure. Check feed_type in your broker's documentation to confirm which consolidated feed your order router actually uses for pricing.
Before switching to a paid feed in live trading, validate the impact in paper trading. Run two paper bots simultaneously — one on IEX free, one on your target paid feed. Log fill quality (fill vs mid-quote at signal time) for both over 50+ trades. Calculate average slippage per trade for each bot. The difference is your data feed's edge contribution. If it exceeds the monthly feed cost divided by your monthly trade count, the upgrade pays for itself. This test also confirms whether staleness is actually the limiting factor or whether your execution logic has other issues.
Data Feed Options and What They Cost
| IEX Free | |
|---|---|
| Latency | 50–500ms typical; spikes during events | Under 100ms WebSocket | Near-real-time via TWS API | Microseconds — co-located |
| Coverage | IEX exchange trades only | All US exchanges consolidated | All US exchanges via IBKR routing | Full consolidated tape |
| Cost | Free | ~$29/month | Included with IBKR account (commissions apply) | $1,000+/month plus infrastructure |
| Suitable For | Swing trading, EOD signals, learning | Intraday strategies, mid-frequency bots | Active intraday traders already using IBKR | Professional HFT and institutional |
For most retail systematic traders, the practical upgrade path is: IEX for development and swing strategies, Polygon Starter for intraday bot deployment, IBKR TWS API if you are already routing orders through Interactive Brokers. There is no meaningful reason to use a paid feed if you are running daily or weekly signals — IEX latency resolves well within your strategy's decision window.
Survivorship and the Bigger Picture
Data quality is not only about latency. The other dimension is completeness. Free tiers often strip corporate actions, adjust prices inconsistently, or omit pre-market and after-hours data. If your strategy backtested on adjusted close prices but your bot reads unadjusted real-time prices, you have a different kind of data mismatch — not staleness but price series inconsistency. Verify that your live data source and your historical data source use the same adjustment methodology before deploying.
Frequently Asked Questions
Does stale data matter for my swing trading bot?
For swing trading strategies — holding positions for days or weeks, entering at daily close or open — IEX free data is entirely sufficient. The milliseconds of delay are irrelevant when your signal is based on end-of-day prices. Stale data becomes a meaningful problem only when your strategy requires acting on intraday price events where the window between signal and optimal entry is short. If you are placing limit orders rather than market orders, staleness impact is also reduced since you define your fill price rather than accepting the market.
What is the cheapest way to get reliable intraday data for a trading bot?
Polygon.io's Starter plan at approximately $29/month provides WebSocket streaming with full consolidated US equity coverage at sub-100ms latency — the most cost-effective entry point for intraday bot data. If you are already routing orders through Interactive Brokers, their TWS API provides real-time quotes included with the account and is the simplest path for IBKR users. Alpaca's market data subscription is another option if you are already using Alpaca for order execution.
How do I know if data latency is causing my bot's underperformance?
Log three timestamps for every order: when the quote was received, when the signal fired, and when the fill came back. Calculate fill_price - quote_price across at least 50 trades. Consistent negative values (paying more than the quote on buys, receiving less than the quote on sells) indicate staleness or market impact. If the average slip per trade exceeds 0.1%, start with a data feed diagnostic before changing your strategy logic — the problem may be infrastructure, not edge.