Search code examples
pythonthomson-reuters-eikon

Merge CRSP and Eikon through the Eikon api


I am trying to merge CRSP and IBES through the Eikon API.

I have extracted CUSIP codes from CRSP and wants to convert those to RIC codes in order to extract analyst estimates.

When I do the following in python it returns an error (Payload Too Large). I guess that means I have reached some datalimit. But how can the datalimit be so low - we are talking approx 28.000 requests (datapoints)? and secondly, how can I circumvent it - if that is possible?

ric = ek.get_symbology(cusips,from_symbol_type="CUSIP", to_symbol_type="RIC")


Solution

  • You could create a loop to retrieve the data in batches:

    dfs = []  # Will be a list of dataframes
    batchsize = 200
    
    for i in range(0, len(cusips), batchsize):
        batch = cusips[i:i + batchsize]
        r = ek.get_symbology(batch,from_symbol_type="CUSIP", to_symbol_type="RIC")
        dfs.append(r)
    
    rics = pd.concat(dfs)
    
    print(rics)
    

    NB: I haven't tested this specific batch size, you can play around with the number to see what works best for you.

    Hopefully this helps!