Skip to main content

News Aggregator Providers

NewsService (news/news_service.py) asks the seven providers of news/providers/ in parallel for GET /news/{ticker}.

ModuleSourceMethodLanguage
yfinance_news.pyYahoo Financeyfinance (ticker.news), ticker as typeden
google_finance_news.pyGoogle FinanceEmbedded JSON, HTML fallbackDeduced from the ticker suffix
zonebourse_news.pyZoneBourseHTMLfr
boursorama_news.pyBoursoramaHTMLfr
investing_news.pyInvesting.comHTML, needs a mappingen
marketwatch_news.pyMarketWatchHTMLen
msn_finance_news.pyMSN FinanceJSON endpoint, HTML fallbacken

Mappings​

Three providers read a mapping of the instrument, by provider name in lower case: ZoneBourse (zonebourse) and Boursorama (boursorama) share the mapping of the fundamentals provider of the same name; Investing.com needs a mapping named investing_com and returns nothing without it. The four others build their request from the ticker.

Deduplication​

  1. URL — lower case, utm_* parameters, fragment and trailing slash removed; the first article received is kept.
  2. Title — difflib.SequenceMatcher on normalised titles (lower case, no punctuation); at or above NEWS_DEDUP_SIMILARITY (0.85) the most recent article is kept.

With language, articles whose language is known and different are removed before deduplication. Articles are sorted newest first and cut to limit; each provider is asked for twice that number.

Storage​

Articles of instruments that are in the catalogue are upserted into news_articles (ON CONFLICT (url) DO UPDATE); GET /news/feed and GET /news/stats read that table. Old articles are not purged automatically.

A failing provider returns an empty list without blocking the others.