get_data: How to automatically check if all data was properly returned?

Hello,

I am accessing the Eikon API via Python to pull some data on fund holdings. Does the "err" part that get_data returns contain any information whether all requested data was properly returned?

For example, it could theoretically be the case that some call limit is binding and not all data is returned. Would such a case be indicated by "err", and if so how?

Right now I have the following line just to get an idea which kinds of errors are returned:

data , err = ek.get_data(fundidentifiers[i:i+9], ['TR.FundHoldingRIC','TR.FundHoldingName','TR.FundPercentageOfFundAssets','TR.FundNumberOfShares','TR.FundNumberOfSharesChanged','TR.FundAllocationDate'],{'Endnum':'100'})

if err is not None:   
print(err)

The only errors I got were "[{'code': 416, 'col': 1, 'message': "Unable to collect data for the field 'TR.FundHoldingRIC' and some specific identifier(s).", 'row': 41}, ...", which I think are fine because not all funds have 100 items (or even any items) in their portfolio and I think this is what this error indicates. But nothing that would indicate some call limit.

Ideally, I would like to add an if-condition that soudns the alarm if not all data was properly returned, so that I can get it later. Otherwise I would miss this and build an incomplete data set.

Thanks!

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @CSI

    When requesting the data, we should know the number of rows and columns in the returned data frame or the start date or end date in the data frame.

    Therefore, we can initially check if all data was properly returned by using the number of rows and columns in the data frame.

    For example, the following code uses the get_data method to retrieve three fields of three items. Therefore, the number of rows is the number of items (3) and the number of columns is 4 which are the number of fields including the instrument column.

    image

    Currently, there is no method call to check data usage. However, you can verify it from the log file as mentioned on this thread.

Answers