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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
3 0 0 2

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-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpython
1613743629431.png (223.4 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.

Upvote
Accepted
18k 21 12 20

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 5.0 MiB each and 10.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
6.7k 8 6 7

@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 5.0 MiB each and 10.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?

Click below to post an Idea Post Idea