My L1C2 sentiment engine beats Vader on trading signals — here's
Generic sentiment tools treat "liability" and "cost" as red flags. In trading contexts, those are just normal business vocabulary. Loughran and McDonald's 2011 JF study found 75% of Harvard-IV's "negative" hits were false positives in 10-K filings. My automated swing-trading system on NSE stocks was paper-trading fine, but adding a news layer meant I had to build something from scratch.
Free data sources, intentionally redundant
Two independent feeds: Yahoo Finance via yfinance and Google News RSS. No API keys, no paid tiers. I learned the hard way that single-source free data breaks silently — schemas shift, responses change shape, and your pipeline keeps running on garbage without telling you.
The negation bug that nearly shipped
This sentence should score negative:
> "Quarterly results were not impressive, margins weak."
Came back positive. My negation window checked backward from sentiment terms but didn't respect clause boundaries. "Not" was within range of "weak" but belonged to the previous clause. Fixed by stopping negation scope at commas, "but," "however" — the same clause separators humans use intuitively.
Statistical shrinkage prevents overreactions
One dramatic headline on thin coverage gets shrunk toward neutral — same empirical-Bayes trick I use elsewhere in the system to prevent small trade samples from over-influencing pattern weights. Five corroborating headlines? Trusted much more. Headlines also decay exponentially (half-life: one day) so stale news doesn't linger.
Two distinct signals, kept separate
- Conviction factor (10% weight): Mild sentiment nudges the cross-sectional score that combines momentum, trend quality, volume, and relative strength. Price/volume factors still dominate.
- Hard veto: Independent threshold check that blocks trades on fresh, corroborated clusters of litigious/fraud-flagged headlines. Price-only systems stay blind to this until it's already baked into the chart.
The engine uses LM word categories (Negative, Positive, Uncertainty, Litigious) with custom tokenization tuned to financial text patterns.