Streaming Prices | Error "coroutine 'StreamingPrice.open_async' was never awaited"?

Installed fresh python 3.11 / fresh eikon and getting below error and can't for the life of me solve it.


Code is simple streaming price pull :

sp = ek.StreamingPrices(instruments=["LCOc1"], fields=['CF_LAST'])
sp.open()


Important bit of error is:

await asyncio.wait(task_list, return_when=asyncio.ALL_COMPLETED)

File "C:\Users\x\.conda\envs\x\Lib\asyncio\tasks.py", line 415, in wait

raise TypeError("Passing coroutines is forbidden, use tasks explicitly.")

TypeError: Passing coroutines is forbidden, use tasks explicitly.

sys:1: RuntimeWarning: coroutine 'StreamingPrice.open_async' was never awaited

Best Answer

  • @andrej.kovacic

    Thank you for reaching out to us.

    Python 11 may change its implementation because the code runs fine on Python 10. I will contact the development team to verify this problem.

    For now, you can try the Refinitiv Data Library for Python instead (https://pypi.org/project/refinitiv-data/).

    The following code runs fine on Python 11.

    import refinitiv.data as rd
    import os
    os.environ["RD_LIB_CONFIG_PATH"] = "./"


    rd.open_session('desktop.workspace')


    stream = rd.open_pricing_stream(
        universe=['/LCOc1'],
        fields=['CF_LAST']
    )
    print(stream.get_snapshot())

    1694427278821.png

    You can check the example code on GitHub.