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?
@wesley.ng
Eikon Data API doesn't provide async interfaces. However, you can run it in an executor. For example:
import eikon as ekimport asynciodef 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 dfdef get_timeseries(instruments, fields, start_date, end_date, interval="daily"): df = ek.get_timeseries(instruments, fields, start_date, end_date, interval) return dfasync 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())
Hi @wesley.ng
You can find an async example using the Refinitiv Data Library for Python here: Example.DataLibrary.Python/EX-2.01.02-HistoricalPricing-ParallelRequests.ipynb at main · Refinitiv-API-Samples/Example.DataLibrary.Python · GitHub