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
4 4 7 11

Support for asyncio via Python

Hi, could I check if there is anyone who has experience using, or knows how to use the Eikon API with the asyncio package for Python?

eikon-data-apipython#technologyasynchronous
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.

Upvotes
Accepted
80k 257 52 75

@wesley.ng

Eikon Data API doesn't provide async interfaces. However, you can run it in an executor. For example:

import eikon as ek
import asyncio

def set_app_key(app_key):
    ek.set_app_key(app_key)

def get_data(instruments, fields, condition=None):    
    df, err = ek.get_data(instruments,fields,condition)
    return df

def get_timeseries(instruments, fields, start_date, end_date, interval="daily"):   
    df  = ek.get_timeseries(instruments, fields, start_date, end_date, interval)
    return df

async def main():    
    loop = asyncio.get_running_loop();     
    await loop.run_in_executor(None, set_app_key,"<App key>")   
    df = await loop.run_in_executor(None, get_data, ["IBM"],["TR.PriceClose"])
    print(df)
    df = await loop.run_in_executor(None, get_timeseries, ["PTT.BK"],"*","2022-01-01","2022-01-31")
    print(df)

asyncio.run(main())



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.

Upvotes
17.7k 82 39 63
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.

Hi @nick.zincone, thanks for this. What about for the Eikon data API?

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.