Building a News Sentiment Pipeline End to End
A sentiment score is only as good as its weakest stage — sourcing, entity matching, scoring and timestamping each fail differently, and any one of them can quietly wreck the signal.
Prerequisites: Sentiment Signals
"Run sentiment analysis on the news" sounds like one step. In practice it's four separate stages — sourcing, entity matching, scoring, timestamping — each with its own failure mode, and a pipeline is only as good as the weakest one. A near-perfect sentiment classifier fed articles matched to the wrong company, or timestamped an hour late, produces a signal that looks fine in a demo and loses money live.
Sentiment scoring gets the attention because it's the interesting machine-learning part. Sourcing, entity matching and timestamping are the boring parts, and they're where financial news pipelines actually break.
The four stages
Sourcing decides which articles enter the pipeline at all. A feed that includes every wire story double-counts — the same Reuters piece syndicated to twenty outlets shouldn't produce twenty sentiment observations. A feed that's too narrow misses the story that actually moves the stock. Deduplication by near-identical text, not just identical headline, matters here.
Entity matching links an article to the specific instrument it's about. This is harder than it sounds: "Meta" the company, "meta" the common word, and "META" as a ticker for an unrelated small-cap all appear in text, and a company routinely gets referred to by several names, subsidiaries and former names in the same news cycle. See Coreference and Alias Resolution for Issuers.
Scoring turns matched text into a number — positive, negative, neutral, or a continuous score. A general-purpose sentiment model trained on product reviews reads "shares fell sharply" as neutral, missing that in financial text a falling share price is unambiguously bad news; domain-tuned scoring, or an LLM prompted specifically for financial framing, does better here than an off-the-shelf classifier.
Timestamping records when the information was actually available, which is not necessarily the article's published timestamp — some feeds backfill or correct timestamps after the fact, and a news API's "publish time" can lag the moment the story actually went live by minutes that matter for a fast signal.
Worked example: one story, four failure points
A headline crosses: "XYZ Corp cuts full-year guidance, shares tumble in after-hours trading." Sourcing picks it up correctly — good. Entity matching correctly attaches it to XYZ Corp rather than a similarly-named unrelated firm — good. Scoring correctly classifies it as strongly negative — good. But the pipeline's timestamp is the wire service's editorial timestamp, recorded eleven minutes after the story first appeared on the company's own investor relations page. A signal built on this feed reacts eleven minutes late to every guidance cut, and in a backtest using the same delayed timestamps for both signal and fill, the lag is invisible — it only shows up as underperformance once live.
Practical discipline
Validate each stage independently rather than only checking the final signal's backtest performance — a good backtest can hide a broken stage that happens to cancel out over the sample. Keep a hand-labelled set of articles with known correct entity and sentiment labels, and re-check pipeline output against it after any vendor or model change. Store the raw article text alongside the score, not just the score, so a surprising signal can be traced back to the source in seconds rather than requiring a re-pull from the vendor.
Backtesting sentiment against same-day closing prices using a same-day "publish" timestamp silently assumes zero latency between story and trade. Real feeds have latency that varies by source and sometimes by time of day; measure it, don't assume it away.
Related concepts
Practice in interviews
Further reading
- Tetlock, Giving Content to Investor Sentiment (2007)