For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
7 0 1 3

How to get news headlines for list of stocks at once using Python API?

For a one share I do :

ek.get_news_headlines(query='R:ALCLS.PA IN FRENCH', date_from='2018-11-05', date_to='2018-11-11', count=20)

How can I do for my all portfolio (BpiFrance)?

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpython
icon clock
10 |1500

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

Upvote
Accepted
36 0 2 1

try using PF:portfolioname in your query -> ie. ek.get_news_headlines(query='PF:BpiFrance IN FRENCH', date_from='2018-11-05', date_to='2018-11-11', count=20)

icon clock
10 |1500

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

@simone.dacosta thanks it worked. User asking any way they can add filters like they want only important news and not all news.

Some kind of information which directly impact the compagny , no macro economics news

Upvotes
36 0 2 1

the news code for major news (not all news) is NEWS1 - so i would definitely suggest adding this, as well as a language filter. I would suggest adapting a news browser window in Eikon to the needs and then to copy the text over into the code.

I have a news monitor (F9) on my Eikon desktop that has the following filters Topic:NEWS1 NOT R:AMZN.O NOT Topic:BRXT AND Language:LEN and I can simply paste that into my Jupyter notebook:

ek.get_news_headlines(query='Topic:NEWS1 NOT R:AMZN.O NOT Topic:BRXT AND Language:LEN', count=20)

Bringing your attention to the fact you can use things like Topic, RIC, Language etc.

Good luck!

icon clock
10 |1500

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

Upvotes
1 0 0 0

@simone.dacosta How can we do the same for lets say sp500 underlying stocks news headline? Thank you!

icon clock
10 |1500

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

@feras.obeid

When asking a new question, please always start a new thread. Old threads with accepted answers are not monitored by forum moderators. A post added to an old thread can easily me missed and not receive a response.

To answer your question, if you'd like company news for all index constituents, you need to retrieve index constituents, transform the list of constituent RICs into a space separated string and use the latter as the news search expression. E.g.

df, err = ek.get_data('0#.SPX','TR.RIC')
instr = df['Instrument'].tolist()
news_search_expr = ' '.join(instr)
ek.get_news_headlines(news_search_expr)

Alternatively you can use the index RIC as the news search expression, which retrieves the news headlines relevant to the index or the stock market the index represents.

Click below to post an Idea Post Idea