Broker apis
Market Data APIs for Systematic Traders: Feeds, Latency, and What Breaks
On December 6, 2026, US equities start trading 23 hours a day. Your data feed is about to get a new session, a nightly pause, and a whole new set of ways to silently break. Here is how to pick a market data API and wire it so it fails loudly instead of quietly.
Educational content, not investment advice. Trading involves risk of loss.
In brief
- From December 6, 2026, US equities trade 23 hours a day with a 9:00 p.m. to 4:00 a.m. overnight session and an 8:00 to 9:00 p.m. pause — feed handlers that assume the day ends at 4:00 p.m. will misread the tape.
- Pick a market data API on freshness, history depth, cost at your volume, and failure behaviour — free tiers are end-of-day or delayed, real-time costs real money.
- The four failure modes are missing bars, stale quotes, out-of-order messages, and session boundaries; check for all four by timestamp, not by count.
- Backfill over REST on every reconnect, timestamp every message on receipt, and keep the session calendar in code.
On this page
The short answer
A market data API is the pipe between the exchange and your strategy: it delivers trades, quotes, and bars over REST or WebSocket. Pick it on four questions — how fresh is the data, how complete is the history, what does it cost at your volume, and what happens when it breaks. And from December 6, 2026, there is a fifth question: does your feed handler understand the new 23-hour US trading day? On that date the consolidated tape (the SIPs), five exchanges, and FINRA trade reporting all go live on a 23-hours-a-day, five-days-a-week schedule, with an overnight session from 9:00 p.m. to 4:00 a.m. ET and a one-hour pause from 8:00 to 9:00 p.m. ET. Any feed handler that assumes the day ends at 4:00 p.m. will misread the tape within hours of the switch.
What a market data API actually delivers
Every vendor sells the same three message types, and confusing them is the first way a system breaks.
Trades are prints: price, size, venue, timestamp. They tell you what actually changed hands. Quotes are the bid and ask — the spread, the depth, the NBBO. A strategy that needs the live spread needs quotes; a strategy that only needs the last price does not. Bars (OHLCV candles) are trades aggregated over a window: one minute, one day. Most systematic strategies run on bars, which is why bars are the cheapest data to buy and the easiest to get wrong.
Two delivery shapes exist. REST is request-response: you ask for a range of bars and get them back. It is right for backfills and end-of-day work. WebSocket is a live stream: you subscribe to symbols and messages arrive as they happen. It is right for anything that trades intraday. A production stack almost always runs both — REST to fill history, WebSocket to stay current — and the handoff between them is where gaps appear.
The four questions that pick the feed
Freshness. Free tiers are not real-time. Massive (formerly Polygon.io) serves end-of-day data on its free Basic tier at 5 calls per minute; 15-minute-delayed intraday starts at the $29 Starter tier, and real-time stock data only arrives at the $199 Advanced tier. Alpaca's free plan, by contrast, streams real-time data from the IEX feed by default in its StockDataStream client. The price you pay is the freshness you get, and the most common beginner mistake is backtesting on delayed data and then wondering why the live system behaves differently.
History. A backtest needs years; a live monitor needs minutes. Massive's free tier carries 2 years of history, Starter 5, Developer 10, Advanced 20+. Decide how far back your strategy actually needs to go before you pay for depth you will never query.
Cost at your volume. Count calls, not months. A free tier at 5 calls per minute is 300 calls an hour — enough for a daily screen, nowhere near enough for polling quotes on a watchlist. WebSocket subscriptions replace polling, which is why paid tiers that include streaming are usually cheaper per symbol than hammering a REST endpoint.
Failure behaviour. This is the question vendors never put on the pricing page. What does the feed do when a bar never arrives, when a quote goes stale, when the socket drops and reconnects mid-session? The answer determines whether your system degrades gracefully or trades on yesterday's prices.
What breaks in a market data feed?
Missing bars. Feeds drop messages. A bar for 16:07 simply never arrives, and a strategy that indexes bars by position instead of by timestamp silently shifts every calculation after the gap by one bar. Check for gaps by timestamp, not by count.
Stale quotes. A quote that arrived 90 seconds ago is not a quote, it is a souvenir. If your system uses the last quote it received without checking its age, it will happily trade at a price that no longer exists.
Out-of-order messages. Late trades arrive after the bar they belong to has already been emitted. Alpaca's v3 stock stream handles this with a dedicated updatedBars channel that re-emits a corrected bar after a late trade lands. If your feed has no equivalent, your bars are wrong in exactly the moments that matter most.
Session boundaries. This is the one that is about to get worse. From December 6, 2026, the US trading day has four sessions — overnight 9:00 p.m. to 4:00 a.m., pre-market 4:00 to 9:30 a.m., regular 9:30 a.m. to 4:00 p.m., after-hours 4:00 to 8:00 p.m. — plus a one-hour pause from 8:00 to 9:00 p.m. A feed handler that treats 8:00 to 9:00 p.m. as a data outage will page you every night. One that treats the overnight session as a continuation of the regular session will compute the wrong daily bars. And the overnight session is thin: early measurements put overnight spreads several times wider than regular-session spreads, so a strategy that ignores the session label will read a wide spread as a signal.
Working code: a feed-health checker
The fix is a small checker that runs on every message and fails loudly. Below is a runnable version: it builds a synthetic feed across the December 6 session boundary — regular close, after-hours, the 8:00–9:00 p.m. pause, then the overnight session — with a 3-bar gap and one stale quote injected, then checks for missing bars, stale quotes, out-of-order timestamps, and bars inside the pause.
import random
from datetime import datetime, timedelta, timezone
random.seed(11)
ET = timezone(timedelta(hours=-5)) # EST, November
def bar(ts, price):
return {"t": ts, "o": price, "h": price + 0.12,
"l": price - 0.09, "c": price + 0.04,
"v": random.randint(800, 4200)}
bars, quotes = [], []
price = 248.10
t = datetime(2026, 12, 6, 16, 0, tzinfo=ET)
for i in range(4):
bars.append(bar(t, price)); price += 0.05; t += timedelta(minutes=1)
for i in range(3):
bars.append(bar(t, price)); price += 0.03; t += timedelta(minutes=1)
t += timedelta(minutes=3) # GAP: 3 bars never arrive
for i in range(3):
bars.append(bar(t, price)); price += 0.02; t += timedelta(minutes=1)
# overnight session after the 20:00-21:00 pause
t = datetime(2026, 12, 6, 21, 0, tzinfo=ET)
for i in range(3):
bars.append(bar(t, price)); price += 0.04; t += timedelta(minutes=1)
now = datetime(2026, 12, 6, 21, 3, tzinfo=ET)
quotes = [
{"t": now, "bid": 248.62, "ask": 248.65},
{"t": now - timedelta(seconds=90), "bid": 248.10, "ask": 248.14},
]
missing = []
for a, b in zip(bars, bars[1:]):
gap = int((b["t"] - a["t"]).total_seconds() // 60) - 1
# the 20:00-21:00 pause is expected silence, not a gap
if gap > 0 and not (a["t"].hour == 16 and b["t"].hour == 21):
missing.append((a["t"].strftime("%H:%M"), b["t"].strftime("%H:%M"), gap))
stale = [q for q in quotes if (now - q["t"]).total_seconds() > 30]
out_of_order = any(bars[i]["t"] >= bars[i+1]["t"] for i in range(len(bars)-1))
pause_bars = [b for b in bars if b["t"].hour == 20]
print(f"bars received: {len(bars)}")
print(f"missing bars: {missing}")
print(f"stale quotes (>30s): {len(stale)}")
print(f"out of order: {out_of_order}")
print(f"bars inside the 20:00-21:00 pause (should be 0): {len(pause_bars)}")
print(f"first overnight bar: {bars[-3]['t'].strftime('%H:%M')} close {bars[-3]['c']:.2f}")
Executed output:
bars received: 13
missing bars: [('16:06', '16:10', 3)]
stale quotes (>30s): 1
out of order: False
bars inside the 20:00-21:00 pause (should be 0): 0
first overnight bar: 21:00 close 248.49
The checker catches the 3-bar gap between 16:06 and 16:10, flags the 90-second-old quote, and — critically — does not mistake the scheduled 8:00–9:00 p.m. pause for an outage. That last rule is the one most feed handlers will get wrong on December 6. Expected silence and missing data look identical unless your code knows the session calendar.
How to wire it into a live system
Three rules, in order of importance.
Timestamp everything, trust nothing. Every bar and quote your system stores should carry the vendor's timestamp and the timestamp your code received it. The difference between the two is your latency measurement, and it is the first number to look at when a strategy starts misbehaving.
Backfill on reconnect, never assume continuity. When a WebSocket drops and reconnects, fetch the missing range over REST before resuming live processing. The gap between the last bar you received and the first bar after reconnect is exactly the window where a silent shift happens.
Know the session calendar in code. Hard-code the four sessions and the nightly pause, and update the calendar when the exchanges change it. The December 6 change is the biggest session-calendar shift in years, and it is a scheduled event — the only excuse for being surprised by it is not reading the calendar.
A data feed is infrastructure, not a feature. The strategy gets the credit when it works; the feed gets the blame when it does not. Build the checker first, and the strategy second — because a strategy running on broken data is not a strategy, it is a random number generator with confidence.
What to do next
Pick one feed, wire the checker above into it, and run it for a week before you trust a single signal it produces. If you want the data layer handled as part of a larger automated setup — feed, signal, risk, execution, monitoring — that is what the embedded engineer inside QuantIDE builds with you: describe the system, and it comes back wired. And if the same feed-plumbing problem shows up in your business operations rather than your trading, BlackShore Agency covers how teams wire live data into production systems. Start with how to automate a strategy end to end, then read how to connect Python to your broker's API for the execution half of the same stack.
Frequently asked questions
Is Polygon.io (Massive) free tier data real-time?
No. Massive's free Basic tier serves end-of-day data at 5 calls per minute. 15-minute-delayed intraday starts at the $29 Starter tier, and real-time stock data only arrives at the $199 Advanced tier.
When does 23/5 trading start?
Sunday, December 6, 2026. US equities trade 23 hours a day, five days a week, with an overnight session from 9:00 p.m. to 4:00 a.m. ET and a one-hour pause from 8:00 to 9:00 p.m. ET.
How do you detect missing bars in a market data feed?
Check for gaps by timestamp, not by count. Compare each bar's timestamp to the previous one; any jump larger than your bar interval is a missing bar. Treat the 8:00 to 9:00 p.m. nightly pause as expected silence, not a gap.
Should I use REST or WebSocket for market data?
Use REST to backfill history and WebSocket to stay current. On every reconnect, fetch the missing range over REST before resuming live processing.
Sources
- Databento — 23/5 trading in US equities: What you need to know
- FINRA — Notice of Filing: TRF 23/5 Amendments, Federal Register, Nov 18, 2026
- Alpaca Docs — Real-time Stock Data v3
- Alpaca-py — Market Data
- AI Fin Hub — Polygon.io Pricing 2026: Massive Plans, Free to $199 (read from massive.com/pricing, Oct 11, 2026)
Related reading
- GuideOrder Types, Partial Fills, and Idempotency: Making Every Order Safe to RetryOn November 23, 2026, four major brokerages were reported down at once. Your order timed out — did it land? A naive retry doubles your position; an idempotent retry doesn't. The difference is one ID, chosen before the first submit.6 min read
- GuideBroker API Rate Limits, Downtime, and Reconnects: The Plumbing That Decides Whether Your Strategy TradesYour strategy trades when the broker's API accepts the request — and every broker rations that. A naive poller lost 44.4% of its requests to 429s; a paced one lost none. The plumbing decides whether your strategy trades.5 min read
- GuideHow to Connect Python to Your Broker's API and Place Your First Automated OrderConnecting Python to a broker takes about an hour the first time, and most of it is setup, not code. Here is the full path — Alpaca and Interactive Brokers, paper first — with code that was actually run.5 min read