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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
46 1 4 3

Pull news headlines together with RIC or ISIN identifier

Dear support,

For pulling news headlines for a specific universe we currently make a list of RICs, and use a for loop to iterate over them and get headlines for all the RICs in the list.

The outputted data frame has more than one news headline for each company. We would like to add an adjacent column to the output with the pertinent identifier (RIC or ISIN). To be able to know what company the headlines pertain to. Could you help us figure out how to add that to the for loop using the ek.get_news_headlines function?


Thanks in advance


See our current code below:

df1 = pd.DataFrame()

RIC_List

for ric in RIC_List:

q='R:'+ ric + ' AND Topic:ESG AND Language:LEN'

#print(q)

df = ek.get_news_headlines(q,count=3, date_from='2020-09-15T09:00:00', date_to='2020-10-08T18:00:00')

df1 = df1.append(df)

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythonricsnews
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.

1 Answer

Upvotes
Accepted
6.7k 8 6 7

H @Erik77 - so the best place to do this is right after you get the return from the API, see below:

RIC_List = ['VOD.L','IBM.N']
df1 = pd.DataFrame()
RIC_List

for ric in RIC_List:
    q='R:'+ ric + ' AND Topic:ESG AND Language:LEN'
    df = ek.get_news_headlines(q,count=3, date_from='2020-09-15T09:00:00', date_to='2020-10-08T18:00:00')
    df['RIC1'] = ric
    df1 = df1.append(df)

I hope this can help.


1608247300884.png (196.0 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.

Click below to post an Idea Post Idea