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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvote
Accepted
16 0 1 1

[URGENT] Eikon news headlines and country of origin

check_headlines_eikon.zipDear all,


I am trying to download news headlines using the Python APIs (ek.get_news_headlines) and the following filters:


QUERY 1

(Eurozone OR Austria OR Belgium OR Cyprus OR Germany OR Estonia OR Spain OR Finland OR France OR Greece OR Ireland OR Italy OR Lithuania OR Luxembourg OR Latvia OR Malta OR Netherlands OR Portugal OR Slovenia OR Slovakia OR Europe)

AND

("credit line" OR "credit lines" OR "line of credit" OR "lines of credit" OR "revolving credit" OR "credit facility" OR "credit facilities" OR "drawdown" OR "drawdowns")


Basically, I want to see which news stemming from the Eurozone/Europe refer to certain terms.


One difficulty that I face is that I cannot know which country (or group of countries) a specific headline stems from or refers to. To work around this, I tried to run the following queries:


QUERY 2

(Eurozone) AND ("credit line" OR "credit lines" OR "line of credit" OR "lines of credit" OR "revolving credit" OR "credit facility" OR "credit facilities" OR "standby line" OR "standby lines" OR "drawdown" OR "drawdowns" OR "drew down" OR "drawn down" OR "drawing down" OR "draw down" OR "draws down" OR "undrawn")


(Austria) AND ("credit line" OR "credit lines" OR "line of credit" OR "lines of credit" OR "revolving credit" OR "credit facility" OR "credit facilities" OR "standby line" OR "standby lines" OR "drawdown" OR "drawdowns" OR "drew down" OR "drawn down" OR "drawing down" OR "draw down" OR "draws down" OR "undrawn")


(Belgium) AND ("credit line" OR "credit lines" OR "line of credit" OR "lines of credit" OR "revolving credit" OR "credit facility" OR "credit facilities" OR "standby line" OR "standby lines" OR "drawdown" OR "drawdowns" OR "drew down" OR "drawn down" OR "drawing down" OR "draw down" OR "draws down" OR "undrawn")

……


and so on for all countries specified in QUERY 1 (plus some additional ones like the UK and the Nordics), appending the results of each individual country-query to each other….


At this point, I expected the results of QUERY 1 to be a subset of QUERY 2, as cross-border headlines retrieved with QUERY 2 should be repeated for all reference countries AND because all country-level subqueries of QUERY 2 contain more keywords. Inexplicably, this does not hold.



The code that I use is the following, with the query q corresponding to one of the above:


date = dt.datetime.today().strftime("%Y-%m-%dT%H:%M:%S")

start_date = dt.datetime(2019,1,1,hour=0, minute=0, second=0).strftime("%Y-%m-%dT%H:%M:%S")

prev_date = date

while date > start_date: # While loop needed to work around limit of 100 headlines per query

print('Retrieving headlines up to '+date[:10])

hdlns_dwld = ek.get_news_headlines(query=q, count=100, date_to=date, debug=True)

headlines = pd.concat([hdlns_dwld,headlines], sort=True)

date = min(headlines.index).strftime("%Y-%m-%dT%H:%M:%S")

if prev_date == date:

break

prev_date = date


To give you a better insight into the problem, I provide in the attachment a csv file that contains the merging of the results of the two queries, with the variable origin specifying with which query I retrieved the headline.


Question 1: How is it possible that QUERY 1 retrieves news that were not matched with the results of QUERY 2?


Question 2: Furthermore, it would extremely helpful to have a better way to identify the country(-ies) of origin of one specific headline. Is this somehow possible with the Eikon APIs?


Thank you

Kind regards

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythonnews
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.

1 Answer

Upvotes
Accepted
23k 22 9 14

Hello @michele.federle,

Question 1:

I did a quick test, into Eikon News Screen (News Monitor) I entered query1, and also run your code on it from python, and I find that the results match.

this was just a sanity check that indicated that the content matches and what is brought over by Eikon Data API is the content that is available within Eikon as result for the query.

I am sure that Eikon content experts would know more about the correct query to round up the required news set. As a customer, you can open a content inquiry via Refinitiv Content Helpdesk, product = Eikon, "I need help finding content". Once you have the query for news screening that meets your requirement, the same query should work via Eikon Data API. Looks like there is a subtlety in how the set coverage is calculated.

Additionally, in Eikon Data API, you may wish to take advantage of IN operator:

(Topic1 OR Topic) IN (Country1 OR Contry2)

Question 2:

Looks like you are looking for metadata pertaining to the story. Eikon Data API is a desktop retrieval API and does not include metadata with story.

Machine Readable News from Elektron includes this information and other metadata that can be relevant is included as well, and is available via Elektron APIs. Perhaps this is worth looking into, in MRN Models Guide and also may be helpful to discuss with your Refinitiv account manager if this is something your organization requires.

I hope this info helps.


newscreen.gif (375.9 KiB)
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.

Click below to post an Idea Post Idea