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
16 0 2 4

No results were returned when accessing the eikon api

A python program that tries to access the eikon api does not return a result. It will only work if you restart the service, but it may be hours later when you try to access the api

log:

[INFO:2023-10-07 09:46:39,467] web.views views.py:944:get bond dirty price request: {'code': ['JPYCNY=R'], 'endDate': '2023-07-31', 'interval': 'daily', 'startDate': '2023-07-28'}
[INFO:2023-10-07 09:46:39,467] web.views views.py:23:set_rv_app_key: 4b45e9df491c43af8266bde1e96d1e94692ae941
[INFO:2023-10-07 09:46:39,469] pyeikon session.py:378:Send GET request to http://127.0.0.1:9060/api/status to detect API Proxy...

code:

def get_exchange_rate_history_price(request):
success = True
    val = json.loads(request.body)
loggers.info("get bond dirty price request: " + str(val))
code = val.get("code")
startDate = val.get("startDate")
endDate = val.get("endDate")
return_dict = {'return_code': '200', 'return_info': 'success', 'result': False}

    set_rv_app_key()
    rd.open_session()
# response = bond.Definition(
    # instrument_code="CND100063XD1",
    # fields=['DirtyPrice'],
    # pricing_parameters=bond.PricingParameters(
    #     market_data_date="2023-05-05")).get_data()

    try:
        df = ek.get_timeseries(code,
# fields=["OPEN", "CLOSE"],
                               start_date=startDate,
 end_date=endDate,
interval='daily',
calendar=None,
corax=None,
normalize=False,
raw_output=True)

except Exception as result:
errorMsg = str(result)
loggers.error("get bond dirty price exception: " + str(result))
success = False

    if success:
 print(df)
# print(df.keys())
        # print(df.values())
        dflist = list(df.values())
# print(dflist[0])
        newList = dflist[0]
for dt in newList:
 print(dt)
if (dt['statusCode'] == 'Error'):
            newList.remove(dt)
 print(newList)
#
        # print(dflist[0][0])
        # obj1 = dflist[0][0]
        # print(obj1['dataPoints'])
        # data_dict = ["timeseriesData", newList]
        # print(dflist.get(0))
        # numy = df.to_json()
        # loggers.info("get stock info response: " + numy)
        # data.to_excel("C:\\dpp\\refinitive\\test\\stock.xlsx", sheet_name='Sheet1', index=False)
        # return_dict['result'] = json.loads(numy)

        # return_dict['result'] = json.loads(json.dumps(newList))
        return_dict['result'] = json.loads(json.dumps(df))
 else:
return_dict['return_code'] = 500
        return_dict['return_info'] = errorMsg
return_dict['result'] = {}
return HttpResponse(json.dumps(return_dict), content_type="application/json")

pls help me solve this problem

eikon-data-api#technology
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.

1 Answer

· Write an Answer
Upvotes
Accepted
80.1k 257 52 75

@joneliu

Thank you for reaching out to us.

According to the code, you are using the get_timeseries method in Eikon Data API to get the data.

        df = ek.get_timeseries(code,
# fields=["OPEN", "CLOSE"],
                               start_date=startDate,
 end_date=endDate,
interval='daily',
calendar=None,
corax=None,
normalize=False,
raw_output=True)

To get the dataframe, you need to set the raw_output to False.

I ran the following code and could get the data.

df = ek.get_timeseries("JPYCNY=R",
                 start_date="2023-07-28",
                 end_date="2023-07-31",
                 interval="daily",
                 calendar=None,
                 corax=None,
                 normalize=False,
                 raw_output=False)

The output is:

1696826253870.png

To verify the problem in Eikon Data API, you can enable tracing in the API by using the followin code.

import eikon as ek
ek.set_log_level(1)
ek.set_app_key('<app key>')

1696826253870.png (9.4 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.