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

Upvotes
Accepted
3 0 2 5

How to translate news monitor query to Python API headlines query? The query is ("Hospital" AND ( "build" OR "reopen" OR "construct" OR "expansion" OR "upgrade" OR "develop" OR "repurpose" OR "modern" ))

eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-api
1613743629431.png (223.4 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.

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 appropriate reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.
Thanks,
-AHS


Hello @alankar.gupta,

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,

-AHS

Upvote
Accepted
18.2k 21 13 21

Hi @alankar.gupta

With Eikon Data API version 1.1.8

I just tested this code and this should be the code you are looking for:

syntax = "Hospital AND ( build OR reopen OR construct OR expansion OR upgrade OR develop OR repurpose OR modern )"
df = ek.get_news_headlines(syntax)

df


ahs.png (55.1 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.

Many Thanks! One last thing. Can we filter news based on most important? We can do that in Eikon Desktop.

1614008868238.png (16.3 KiB)

Hi @alankar.gupta

I believe that it is not possible to filter by "only important" with ek.get_news_headlines()

You can run help(ek.get_news_headlines) to see the function description.

Upvotes
10.2k 18 6 9

@alankar.gupta you can double click on the query in NEWS monitor app and it will generate the query string for you which you can copy and paste into the get_news_headlines() API call. Please see my article which goes through this. I hope this can help.

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.

Hello Jason. I think i need to convert this to a python format before copy pasting it. That's what i am trying to understand.

I was trying with this query but it's not working.

df = ek.get_news_headlines(query="Hospital\\\" AND \\\ ("build\\\" OR \\\"reopen\\\" OR \\\"construct\\\" OR \\\"expansion\\\" OR \\\"upgrade\\\" OR \\\"develop\\\" OR \\\"repurpose\\\" OR \\\"modern\\\" ))

Can You help me with this?

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.