How can I download bulk news data for all the companies listed on ASX from 2000 till 2025 I need the whole news data set not only the headlines can please give me a Python code such that I use to run and get the data on Workspace?
My sample companies are CBA.AX, BHP.AX, ANZ.AX
Hi @AnilMishra & @AbdulSamad, Thank you for reaching out! To fetch all the companies listed on ASX, I can use the screener code.
import lseg.data as ld ld.open_session() screener_expr = ( 'U(IN(Equity(active,public,primary))), ' 'IN(TR.ExchangeMarketIdCode,"XASX")' ## or TR.ExchangeCode = ASX ) ld.get_data( universe=f'SCREEN({screener_expr}, CURN=AUD)', fields=['TR.RIC', 'TR.CommonName', 'TR.ExchangeName'] )
Note: Remove 'active' if you want inactive ones too.
Once I have the list of companies, I can feed them into another call and get the news headlines.
rics = ["BHP.AX", "CBA.AX"] DATE_FROM = "2024-01-01T00:00:00Z" DATE_TO = "2024-12-31T23:59:59Z" for ric in rics: response = ld.news.get_headlines( rics, start=DATE_FROM, end=DATE_TO, count=10)
This would give me the story ID for each headline which I can use to get the news story. Please note that you can fetch only 1 news story per call.
from IPython.display import HTML ld.news.get_story(<storyId goes here>, format=ld.news.Format.HTML) HTML(story)
We have examples in CODEBOOK app within Workspace too. You would need to write a script to loop and get news stories.
If you are interested in MRN you can check this out: Getting Machine Readable News (MRN) with Data Library for Python | Developer Community GitHub: LSEG API Samples ยท GitHub How to chunk you calls: LSEG Data Library - Patterns and Features - Vol. 3: Calls That Survives Scale More on API limits: The Data Library for Python - Maximum Usage Reference Guide Please let me know if you have questions further. Happy to help. Thank you : ) - Ujjawal Khandelwal
The libraries provide a way to retrieve news headlines along with their associated story IDs. Each story ID must then be queried individually to retrieve the corresponding news story. This is how the News API works in Workspace.
To retrieve news headlines related to RICs, the news query should look like this:
df_news = ld.news.get_headlines("R:BHP.AX OR R:CBA.AX") df_news
The R: prefix must be applied to each RIC, and multiple RICs can be combined using the OR expression.
To retrieve historical news in bulk, you may check other news products, such as Machine Readable News History. Please contact your LSEG account team or sales team directly for more information.
Hi @Ujjawal Khandelwal,
We require sentiment scores for all the ASX listed firms from 2000 to 2025. How can we access MRN?
You need to contact your LSEG account team or sales team directly regarding this LSEG Machine Readable News Analytics product.
Once you have an access, please refer to these articles: