question

Upvotes
1 0 0 2

How to query the news sources

Hello, Is there an endpoint to get a list of news sources? I would like to have an overview for querying news and filtering by source among those that I choose to select. For illustration here's a Python snippet:

from typing import List, Iterable
import refinitiv.data as rd
import pandas as pd


def get_news_sources() -> List[str]:
    ...


def get_news(symbol: str, sources: Iterable[str]) -> pd.DataFrame:
    source_filters = "AND ".join([f"SOURCE:{source}" for source in sources])
    return rd.news.get_headlines(query=f"R:{symbol} {source_filters}")


sources = get_news_sources()

selected_sources = ...
ticker = ...

headlines = get_news(ticker, filter(lambda x: x in selected_sources, sources)

display(headlines)
eikon-data-apiworkspace-data-apirefinitiv-data-platformnews
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

· Write an Answer

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.