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

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-apipythonricsDownloadforwardsqual-id
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.

@eva_maria.vela.palomino

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

1 Answer

· Write an Answer
Upvotes
Accepted
79.2k 251 52 74

@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.

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.