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

# question

Accepted
4 0 0 1

## 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 Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
Accepted
72.7k 225 49 71

Thank you for reaching out to us.

```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['LONGNEXTLR'] if pd.notnull(df.iloc['LONGNEXTLR']) else ''
for x in range(1, 15):
all_components.append(df.iloc[currentField]) if pd.notnull(df.iloc[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. Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

4 0 0 1

thank you! Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total. 