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') ?




Answers

  • @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.