New posts are disabled while we improve the user experience.

You can browse the site, or for urgent issues, raise a query at MyAccount.

question

Upvotes
1 0 0 0

How to search by news headlines text

My code is as follows :

import eikon as ek

headlines = ek.get_news_headlines(query='IBM.N', count=1, date_from=None, date_to=None,
                                  raw_output=True, debug=False)
print(headlines)

Running result is as follows :

{'headlines': [{'displayDirection': 'LeftToRight', 'documentType': 'Story', 'firstCreated': '2024-11-07T08:55:01.000Z', 'isAlert': False, 'language': 'L:en', 'reportCode': '', 'sourceCode': 'NS:ZAWYA', 'sourceName': 'Zawya', 'storyId': 'urn:newsml:newswire.refinitiv.com:20241107:nZawJWcL:1', 'text': 'PRESSR: DMCC AI Centre collaborates with IBM Consulting to expand key AI services offering', 'versionCreated': '2024-11-07T08:55:01.000Z'}], 'newer': '/headlines?payload=ey.......'}

My Question is as follows:

What value should be assigned to the parameter 'query' in the get_news_headlines method to query news filtered by keyword based on the keyword of the headline (i.e., the keyword in the returned 'text' property value, such as 'AI Centre') ?




eikon-data-apipython#productnews-filter
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.

1 Answer

· Write an Answer
Upvote
11.1k 22 6 9

@yinct2 I have written an article on how to work with news headlines queries. This explains how you can use the NEWS or NEWS2.0 monitor app to generate the queries you want then copy and paste them into query='your query here' parameter. 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.

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.