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.
For a deeper look into our Eikon Data API, look into:
Overview | Quickstart | Documentation | Downloads | Tutorials | Articles
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.
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.
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?
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.
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.Thanks. 15 months is too short for our purposes. We might have to find an alternative news source.
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
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
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.