How to set sources for get_news_headlines

I'm currently using the the following query:
headlines = ek.get_news_headlines('R:EQNR.OL and Language:LEN', date_from='2018-08-21T00:00:00', date_to='2018-09-21T12:00:00', count=15)
but would like to specify which news sources to include. Is there any way to do this?
or more conveniently, translate query filter made in eikon newsroom to api calls?
Best Answer
-
The get_news_headlines method of Eikon Data API Python (0.1.13) can only retrieve news headlines from the NewsWire source. To get headlines from the NewsRoom source, the application needs to create a custom request and then send it through the send_json_request method. For example:
headlines = ek.send_json_request("News_Headlines",
{
'number': '15',
'query': 'R:EQNR.OL and Language:LEN',
'dateFrom':'2018-08-21T00:00:00',
'dateTo':'2018-09-21T12:00:00',
'repository':'NewsRoom'
}
)The above request specifies the NewsRoom source in the repository property. You can also specify both NewsRoom and NewsWire in the repository property ('repository':'NewsRoom, NewsWire').
However, the send_json_request method returns raw JSON data, not a data frame. From the response, the storyId of the NewsRoom headline is prefixed with 'urn:newsml:newsroom'.
0
Answers
-
@markusrk
I think what you may have meant is how you specify newswire sources in your news search expression or more generally how you build a news search expression for use in get_news_headlines method. If this is the case, the answer is you can build a news search expression using the GUI helpers in News Monitor app in Eikon. And then you can copy & paste it into your Python code. To copy the news search expression from the News Monitor app in Eikon highlight the content of the command/search bar in the app, which will then display the string representation of the news search expression, which you can use in get_news_headlines method.0 -
@deepali.kumar one more for reference if this is what you are looking for.
0 -
This can be converted into the same data frame returned by
get_news_headlines()
with:headlines = ek.send_json_request("News_Headlines", ...)
df = ek.news_request.get_data_frame(headlines)0
Categories
- All Categories
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 684 Datastream
- 1.4K DSS
- 613 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 248 ETA
- 552 WebSocket API
- 37 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 630 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 191 TREP Infrastructure
- 228 TRKD
- 915 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 86 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛