A question about Eikon api

I set a scheduled task to obtain multiple types of data at eight o 'clock every day. Today, I found out whether the data acquisition failure was caused by obtaining multiple types of data at the same time

error info: pyeikon json_requests.py:145:HTTP request failed: unknown async library, or not in async context

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @joneliu

    Thank you for reaching out to us.

    I searched this error on Google and found that this error is from the underlying library.

    1691471731600.png

    Does this issue happen randomly or all the time?

    You can enable logging in the API by using the below code to verify the problem.

    import eikon as ek
    ek.set_log_level(1)

Answers

  • after this, when sends request, no any response

  • it happen all the time , Now I restart application to resolve this problem , but I can't always restart ,so I need solution for this problem

  • @joneliu

    To find the cause of this problem, I need to replicate this issue on my machine.


    Can you share the cut down version of your application and steps to replicate this problem?

  • [INFO:2023-08-15 13:31:48,460] pyeikon session.py:378:Send GET request to http://127.0.0.1:9060/api/status to detect API Proxy...

    after this info,no any response

    data, err = ek.get_data(instruments=code, fields=[
     "TR.RICCode",
     "CF_NAME",
     "TR.IPODate",
     "CF_CURR",
     "TR.AssetCategory",
     "TR.ShareClass",
     "CF_LOTSIZE",
    # "TR.PriceOpen",
        # "TR.PriceClose",
        "CF_DATE",
     "CF_TIME",
     "OPEN_PRC",
     "HST_CLOSE",
     "CF_CLOSE",
     "TR.CompanyMarketCap",
     "TR.PE",
    "TR.DividendYield"
    ])
  • Hi @joneliu ,

    Could you please try enabling the logging in the API by using the below code, as mentioned by my colleague, to verify the problem.

    import eikon as ek
    ek.set_log_level(1)