trader.news.search module

Search by phrase, returning the symbols the news is talking about.

NewsProvider goes symbol -> news. This goes the other way, which is what discovery needs: given “nuclear energy”, which tickers are in the story?

Two sources inside one response, and both matter. quotes are symbols whose name or description matches the phrase. news[].relatedTickers are symbols Yahoo tagged onto an article — noisier (an article about a small nuclear company came back tagged NVDA and BAC on 2026-08-03) but the only way a symbol that does not contain the phrase in its name is ever surfaced.

class trader.news.search.NewsSearchProvider(*args, **kwargs)[source]

Bases: Protocol

Symbols mentioned in news matching a phrase.

search(phrase, limit=5)[source]

Raises MarketDataError if the search fails. [] is normal.

Parameters:
  • phrase (str)

  • limit (int)

Return type:

list[SearchHit]

class trader.news.search.SearchHit(symbol, theme, origin, headline=None, url=None)[source]

Bases: object

One symbol a phrase surfaced, and why.

Parameters:
  • symbol (str)

  • theme (str)

  • origin (str)

  • headline (str | None)

  • url (str | None)

symbol: str
theme: str
origin: str
headline: str | None
url: str | None
class trader.news.search.YFinanceSearchProvider(search_factory=None)[source]

Bases: object

Phrase search via yf.Search. No yfinance type escapes.

Parameters:

search_factory (Callable[[...], object] | None)

search(phrase, limit=5)[source]
Parameters:
  • phrase (str)

  • limit (int)

Return type:

list[SearchHit]