Upgrade from Eikon -> Workspace. Learn about programming differences.

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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
6 1 0 2

How to use RICs under a chain in a code without typing all underlying rics of a chain?


Is there a way to pull the cop xccy basis data for the whole curve in codebook without pulling each individual tenor ric? Example below, I have to enter all the RICs under COPCBS=TRNY. Can we just use COPCBS=TRNY and pull all necessary data like Bid and Ask across all tenors?


Currently i am using: df_cop_xccy_curve = ek.get_timeseries(['COPCBS3M=TRNY','COPCBS6M=TRNY','COPCBS3M=TRNY','COPCBS9M=TRNY','COPCBS1Y=TRNY','COPCBS18M=TRNY','COPCBS2Y=TRNY','COPCBS3Y=TRNY','COPCBS4Y=TRNY', 'COPCBS5Y=TRNY',,'COPCBS6Y=TRNY','COPCBS7Y=TRNY']) df_cop_xccy_curve


but this is quite long. I need to do this for every currency so would appreciate a way to speed this up basically im trying to pull the cross currency curves into python for all currencies so wondering if there's a way to do this quickly

eikon-data-api#technology#productpython apiricschain-ric
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.

@HannaCP

Hi,

Thank you for your participation in the forum.

Is the reply below satisfactory in answering your question?

If yes please click the 'Accept' text next to the reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,


AHS


Upvote
Accepted
79.2k 251 52 74

@HannaCP

Thank you for reaching out to us.

Please try this code:

LONGNEXTLR = 'COPCBS=TRNY'
fields = ['LONGLINK{}'.format(x) for x in range(1, 15)]
fields.append('LONGNEXTLR')
all_components = []
while LONGNEXTLR!='':
    df,e = ek.get_data(LONGNEXTLR,fields)
    LONGNEXTLR = df.iloc[0]['LONGNEXTLR'] if pd.notnull(df.iloc[0]['LONGNEXTLR']) else ''
    for x in range(1, 15):
        currentField = 'LONGLINK{}'.format(x)
        all_components.append(df.iloc[0][currentField]) if pd.notnull(df.iloc[0][currentField]) else None
        
ts = ek.get_timeseries(all_components[1:])
ts

The code gets the underlying RICs from this chain by accessing the LONGLINK fields directly. Then, it passes the list of underlying RICs to the get_timeseries method.



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.

Upvotes
6 1 0 2

thank you!

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.