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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted

FX Forward Swap

I would like to be able to download with Python for a specific RIC for example 'EURFWD=' the RICs curve for the different tenors, i.e. get in Python what is obtained when it executes the following function in excel TR(EURFWD=;;"CH=Fd RH=IN";cell), Output --> [EUR=, EURON=, EURTN=.....EUR10Y].

I have tried the next funcion but it doesn't work,

ek.get_data('EURFWD=', fields = 'RIC_NAME')

Could you help me?

Thanks you for you help

eikon-data-apipythonricsDownloadqual-idforwards
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.

1 Answer

Upvotes
Accepted
49.6k 124 44 62

@eva_maria.vela.palomino

You can use the solution mentioned in this thread.

def getUnderlying(baseRic):
    LONGNEXTLR = baseRic
    #For LONGLING1 to LONGLINK15 and LONGNEXTLR fields
    fields = ['LONGLINK{}'.format(x) for x in range(1, 15)]
    fields.append('LONGNEXTLR')
 
    all_underlying_rics = []
 
    #if LONGNEXTLR is not empty, try to retrieve the data fields
    while LONGNEXTLR!='':
        df,e = ek.get_data(LONGNEXTLR,fields)
        LONGNEXTLR = df.iloc[0]['LONGNEXTLR'] if pd.notnull(df.iloc[0]['LONGNEXTLR']) else ''
        
        #If LONGLINK<x> field is not null, append its value to all_underlying_rics list
        for x in range(1, 15):
            currentField = 'LONGLINK{}'.format(x)
            all_underlying_rics.append(df.iloc[0][currentField]) if pd.notnull(df.iloc[0][currentField]) else None
        #delay between each API call for 1 second
        time.sleep(1)
    return all_underlying_rics

The output is:

1646366605543.png



1646366605543.png (15.7 KiB)
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.