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
5 0 1 2

Error pulling RIC

I am geetting an error pulling the RIC HOSURF1.


TYpeError: get_data() missing 1 required positional argument: 'fields'


What other API fields do I need?

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

Upvote
Accepted
78.2k 246 52 72

@Richard.Willingham

The get_data method requires the fields parameter as the second parameter. If you run the command without it, you will get the following error.

df, err = ek.get_data(['HOSURF1'])
get_data() missing 1 required positional argument: 'fields'

Therefore, you need to specify fields in the second parameter.

HOSURF1 is a chain RIC that contains child RICs.

First, you need to use the following code to gel all child RICs in HOSURF1.

#Define getUnderlying() function
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


rics = getUnderlying('HOSURF1')

I defined the getUnderlying method to get all child RICs and called the method with HOSURF1. The function returns a list of child RICs.

Then, I called the get_data method with the list of child RICs and fields.

df, err = ek.get_data(rics, ["GV4_DATE","GV4_TEXT","GEN_VAL1","PRIMACT_1"]);
df

The output is:

91976-1.png

You can use Eikon Quote to see available fields.

91976-2.png

You may need to refer to the Instrument Pricing Analytics - Volatility Surfaces and Curves article that shows how to use RDP to get Volatility Surfaces and Curves.


91976-1.png (23.9 KiB)
91976-2.png (82.1 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.

@Jirapongse Thank you very much.

Upvotes
1.3k 3 2 4

Hi @Richard.Willingham ,

It seems you're using get_data() function without providing fields parameter.

Could you share your code ?
Especially to detail which lib (eikon or refinitiv-dataplatform) you're using and which function ?

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
5 0 1 2

Yes this is Eikon for Commodities. Trying to pull this data through. RIC HOSURF1

Trying to pull from the Volatility Surface Calculator

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
5 0 1 2

@pf

Any thoughts?


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.