Eikon API - Missing Data (vs Excel/Desktop Application)

Hi,

import pandas as pd
import eikon as ek

start_date = '2022-07-22'
end_date = '2022-07-22'
api_key = <API KEY>
id_list = ["US06654DAG25"]

ek.set_app_key(api_key)

if isinstance(id_list, str):
id_list =[id_list]

fields = ['TR.BIDPRICE', 'TR.ASKPRICE', 'TR.ASKPRICE.calcdate', 'TR.FiCurrency']
parameters = {'Frq': 'D', 'Sdate': start_date, 'Edate': end_date}

df, _ = ek.get_data(instruments = id_list, fields = fields, parameters = parameters)


Output:

1659690729105.png


However, using it from Excel:

=@TR("06654DAG2=","TR.BIDPRICE;TR.ASKPRICE","SDate=2022-07-22 CH=Fd RH=IN",B2)

1659690812786.png

Would appreciate any help as to why NA is being returned.

Thanks.


Best Answer

  • Hello @wesley.ng and all,

    Conveying the resolution from the support team:

    "...Have you tried restarting your computer to refresh your system?

    =========
    Client replied confirming it's now working. case good to close

    "

Answers

  • @wesley.ng

    I can run it properly.

    1659692154376.png

    You may need to check the error returned from the get_data method.

    df, err = ek.get_data(instruments = id_list, fields = fields, parameters = parameters)
    err

    Are you using "import eikon as ek" or "import refinitiv.dataplatform.eikon as ek"?

  • Using

    import eikon as ek

    Have updated the original post accordingly.

    Here is the error:

    1659692462416.png

  • @wesley.ng

    Please set the log_level to one and share the request and response log.

    import eikon as ek
    ek.set_log_level(1)

    For example:

    2022-08-05 16:50:32,075 P[24780] [MainThread 39764] entity: DataGrid_StandardAsync
    2022-08-05 16:50:32,076 P[24780] [MainThread 39764] payload: {'requests': [{'instruments': ['US06654DAG25'], 'fields': [{'name': 'TR.BIDPRICE'}, {'name': 'TR.ASKPRICE'}, {'name': 'TR.ASKPRICE.calcdate'}, {'name': 'TR.FiCurrency'}], 'parameters': {'Frq': 'D', 'Sdate': '2022-07-22', 'Edate': '2022-07-22'}}]}
    2022-08-05 16:50:32,079 P[24780] [MainThread 39764] Request:{'Entity': {'E': 'DataGrid_StandardAsync', 'W': {'requests': [{'instruments': ['US06654DAG25'], 'fields': [{'name': 'TR.BIDPRICE'}, {'name': 'TR.ASKPRICE'}, {'name': 'TR.ASKPRICE.calcdate'}, {'name': 'TR.FiCurrency'}], 'parameters': {'Frq': 'D', 'Sdate': '2022-07-22', 'Edate': '2022-07-22'}}]}}}
    2022-08-05 16:50:32,080 P[24780] [MainThread 39764] Request to http://127.0.0.1:9001/api/v1/data
        headers = {'Content-Type': 'application/json', 'x-tr-applicationid': '...', 'Authorization': 'Bearer ...'}
        params = None
    2022-08-05 16:50:33,509 P[24780] [MainThread 39764] Send request with headers [(b'Host', b'127.0.0.1:9001'), (b'Accept', b'application/json'), (b'Accept-Encoding', b'gzip, deflate'), (b'Connection', b'keep-alive'), (b'User-Agent', b'python-httpx/0.21.3'), (b'Content-Type', b'application/json'), (b'x-tr-applicationid', b'...'), (b'Content-Length', b'296')] and cookies None
    2022-08-05 16:50:33,510 P[24780] [MainThread 39764] HTTP request response 200: {"responses":[{"columnHeadersCount":1,"data":[["US06654DAG25",79.684,79.932,"2022-07-22","USD"]],"headerOrientation":"horizontal","headers":[[{"displayName":"Instrument"},{"displayName":"Bid Price","field":"TR.BIDPRICE"},{"displayName":"Ask Price","field":"TR.ASKPRICE"},{"displayName":"Calc Date","field":"TR.ASKPRICE.calcdate"},{"displayName":"Currency","field":"TR.FICURRENCY"}]],"rowHeadersCount":1,"totalColumnsCount":5,"totalRowsCount":2}]}
    2022-08-05 16:50:33,512 P[24780] [MainThread 39764] HTTP Response code: 200
    2022-08-05 16:50:33,513 P[24780] [MainThread 39764] HTTP Response: {"responses":[{"columnHeadersCount":1,"data":[["US06654DAG25",79.684,79.932,"2022-07-22","USD"]],"headerOrientation":"horizontal","headers":[[{"displayName":"Instrument"},{"displayName":"Bid Price","field":"TR.BIDPRICE"},{"displayName":"Ask Price","field":"TR.ASKPRICE"},{"displayName":"Calc Date","field":"TR.ASKPRICE.calcdate"},{"displayName":"Currency","field":"TR.FICURRENCY"}]],"rowHeadersCount":1,"totalColumnsCount":5,"totalRowsCount":2}]}
    2022-08-05 16:50:33,514 P[24780] [MainThread 39764] Response size: 530

    You may try to use id_list = ["06654DAG2="] instead.

    start_date = '2022-07-22'
    end_date = '2022-07-22'
    id_list = ["06654DAG2="]
     
    if isinstance(id_list, str):
        id_list =[id_list]
      
    fields = ['TR.BIDPRICE', 'TR.ASKPRICE', 'TR.ASKPRICE.calcdate', 'TR.FiCurrency']
    parameters = {'Frq': 'D', 'Sdate': start_date, 'Edate': end_date}
      
    df, err = ek.get_data(instruments = id_list, fields = fields, parameters = parameters)
    df
  • I can't use the RIC instead of the ISIN due to the existing process I've set up - this is one ISIN out of hundreds that is failing - the rest work fine.

    Log response:

    2022-08-05 17:58:03,609 P[31436] [MainThread 18388] entity: DataGrid_StandardAsync
    2022-08-05 17:58:03,612 P[31436] [MainThread 18388] payload: {'requests': [{'instruments': ['US06654DAG25'], 'fields': [{'name': 'TR.BIDPRICE'}, {'name': 'TR.ASKPRICE'}, {'name': 'TR.ASKPRICE.calcdate'}, {'name': 'TR.FiCurrency'}], 'parameters': {'Frq': 'D', 'Sdate': '2022-07-22', 'Edate': '2022-07-22'}}]}
    2022-08-05 17:58:03,615 P[31436] [MainThread 18388] Request:{'Entity': {'E': 'DataGrid_StandardAsync', 'W': {'requests': [{'instruments': ['US06654DAG25'], 'fields': [{'name': 'TR.BIDPRICE'}, {'name': 'TR.ASKPRICE'}, {'name': 'TR.ASKPRICE.calcdate'}, {'name': 'TR.FiCurrency'}], 'parameters': {'Frq': 'D', 'Sdate': '2022-07-22', 'Edate': '2022-07-22'}}]}}}
    2022-08-05 17:58:03,618 P[31436] [MainThread 18388] Request to http://127.0.0.1:9060/api/v1/data
    headers = {'Content-Type': 'application/json', 'x-tr-applicationid': '...', 'Authorization': 'Bearer...'}
    params = None
    2022-08-05 17:58:05,646 P[31436] [MainThread 18388] HTTP request response 200: {"responses":[{"columnHeadersCount":1,"data":[["US06654DAG25",null,null,null,"USD"]],"error":[{"code":416,"col":1,"message":"Unable to collect data for the field 'TR.BIDPRICE' and some specific identifier(s).","row":0},{"code":416,"col":2,"message":"Unable to collect data for the field 'TR.ASKPRICE' and some specific identifier(s).","row":0},{"code":416,"col":3,"message":"Unable to collect data for the field 'TR.ASKPRICE.calcdate' and some specific identifier(s).","row":0}],"headerOrientation":"horizontal","headers":[[{"displayName":"Instrument"},{"displayName":"Bid Price","field":"TR.BIDPRICE"},{"displayName":"Ask Price","field":"TR.ASKPRICE"},{"displayName":"Calc Date","field":"TR.ASKPRICE.calcdate"},{"displayName":"Currency","field":"TR.FICURRENCY"}]],"rowHeadersCount":1,"totalColumnsCount":5,"totalRowsCount":2}]}
    2022-08-05 17:58:05,650 P[31436] [MainThread 18388] HTTP Response code: 200
    2022-08-05 17:58:05,652 P[31436] [MainThread 18388] HTTP Response: {"responses":[{"columnHeadersCount":1,"data":[["US06654DAG25",null,null,null,"USD"]],"error":[{"code":416,"col":1,"message":"Unable to collect data for the field 'TR.BIDPRICE' and some specific identifier(s).","row":0},{"code":416,"col":2,"message":"Unable to collect data for the field 'TR.ASKPRICE' and some specific identifier(s).","row":0},{"code":416,"col":3,"message":"Unable to collect data for the field 'TR.ASKPRICE.calcdate' and some specific identifier(s).","row":0}],"headerOrientation":"horizontal","headers":[[{"displayName":"Instrument"},{"displayName":"Bid Price","field":"TR.BIDPRICE"},{"displayName":"Ask Price","field":"TR.ASKPRICE"},{"displayName":"Calc Date","field":"TR.ASKPRICE.calcdate"},{"displayName":"Currency","field":"TR.FICURRENCY"}]],"rowHeadersCount":1,"totalColumnsCount":5,"totalRowsCount":2}]}
    2022-08-05 17:58:05,662 P[31436] [MainThread 18388] Response size: 937
  • @wesley.ng

    The request messages are similar but the responses are different. It could be a permission issue.

    I have submitted a new case on your behalf to the Eikon support team to verify what the problem is. The case number is 11481934. The Eikon support team will contact you directly to investigate the issue.

  • Thanks Jirapongse, have a good weekend.