Upgrade from Eikon -> Workspace. Learn about programming differences.

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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvote
Accepted

How can I get all news and 1000 news

q = "R:VOD.L AND Topic:GB" headlines = tr.get_news_headlines(query=q, date_from=start_date, date_to=end_date, count=100)

Hi, how can I modify the python request above to get:

1. All News

2. A 1000 news, not just 100.

eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-apinews
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.

@jordia @Laarni Evelyn Acierto.Santiago

Thank you for your participation in the forum.

Is the reply below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the reply that best answers your question. This will guide all community members who have a similar question.

Otherwise please add a comment offering further insight into your question.

Thanks, -

AHS

Hi @jordia @Laarni Evelyn Acierto.Santiago

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?

If so please can you click the 'Accept' text next to the appropriate reply. This will guide all community members who have a similar question.

Thanks,

AHS

@Laarni Evelyn Acierto.Santiago
Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.
Thanks,
-AHS

Upvotes
Accepted
17.3k 82 39 63

Hi @Laarni Evelyn Acierto.Santiago,

The get_news_headlines() method does define an upper limit of 100 results. When you look at the results based on the date criteria, the request will retrieve the last N headlines, up to 100, based on your date_to specification. For example,

In the above query, my results went back as far as 2018-01-19. Unfortunately, in order for you to retrieve additional headlines, you will have to execute multiple get_news_headlines() queries based on different date ranges.


ahs.png (41.8 KiB)
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.

Thanks. Can you add a time to each date?

I suppose what you're asking is whether you can specify date and time as values for date_from and date_to arguments of get_news_headlines method? The answer is yes. According to Eikon Python API Reference Guide, which you can find under the Documentation tab on Eikon Data API page on this portal, the values of these arguments are expected either as string in the format '%Y-%m-%dT%H:%M:%S' or as datetime type.

Thanks. So I guess I could loop through every hour and get 100 news at a time. Is there a better way to lop through all news making sure nothing is left out?

Show more comments
Upvotes
39.4k 77 11 27

In addition to the response from @nick.zincone.1 and to answer the first question, to retrieve all news headlines without applying any filters you can use the news query "A". To learn how to construct news filter expressions use the News Monitor app in Eikon application, which provides GUI for constructing news filters. In get_news_headlines method you can use the same news codes and filter expressions that you can use in the News Monitor app in Eikon. If you're not familiar with News Monitor app in Eikon, you can find series of video tutorials by going to the main Eikon menu and selecting Help - Tutorials and Training and typing in "news" in the search box of the Training app.

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.

Thanks. However I've tried q = "A" and it didn't work.

I have no problem using it on my end. E.g.

ek.get_news_headlines("A")
returns 10 latest headlines without any filters applied. When you say "it didn't work", what do you mean exactly? Can you post the exact call you used and the result you received?

start_date, end_date = datetime(2017, 1, 1,0,0,0), datetime(2017, 1, 31,1,0,0)

headlines = tr.get_news_headlines(query="A", date_from=start_date, date_to=end_date, count=100)

It returns no news over a month so something is wrong somewhere.
Show more comments
Upvotes
6 2 1 3

Thanks. 15 months is too short for our purposes. We might have to find an alternative news source.

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.

You may want to consider a Thomson Reuters news feed product, which provides the full depth of TR news archive.
https://financial.thomsonreuters.com/en/products/data-analytics/financial-news-feed.html

Upvotes
6 2 1 3

Hi again

I'm getting intermittent timeout errors like this:

"HTTPError: Request timeout occured"

With the following code:

q = 'Language:LEN AND ( Topic:GLOFIN OR Topic:TOPNWS ) NOT (Source:TRAUT OR ECLCTA OR ECLTND OR ECLPCM OR ECLBFI OR TOPIC:ENT OR JOB OR SPO OR BACT OR STXOPS OR INTER OR MTPDF OR VID OR REP OR VEN OR INFO OR ORDIMB OR NPL OR WEA OR ENV OR TXT OR PCARD OR INSI OR RSUM OR PREV OR OBIT OR NMKR OR NEWR OR FILING OR ADVS OR AAA OR MEVN OR RCH OR PRO OR PPLMOV)'

headlines = tr.get_news_headlines(query=q, date_from=start_date, date_to=end_date, count=100)

Can you please let me know what can I do to stop these intermittent timeouts?

Thanks,

Jordi

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.

Is there any pattern to the timeouts you experienced? Do you have a way of reproducing these timeouts that you could share? I just tried using your news search expression to retrieve the headlines for the past 24 hours in a loop retrieving the headlines for a 30 minute window at a time, and I did not encounter any problems.

Thanks Alex. I had to use try/except as it kept time out.

From your answer I'd assume that the API doesn't allow you to set a timeout.

Correct. The API does not allow to control timeouts.

Show more comments

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.