alpha-xone / xbbg

An intuitive Bloomberg API
https://xbbg.readthedocs.io/
Apache License 2.0
244 stars 51 forks source link

async with blp.live #60

Closed maurohamz closed 1 year ago

maurohamz commented 2 years ago

Trying to set up a live feed as shown in the Jupyter example unsuccessfully:

async for snap in blp.live(['ESA Index', 'NQA Index'], max_cnt=2):
    print(snap)

Tried to define an async function like this:

async def live_data():
    async for snap in blp.live(['ESA Index', 'NQA Index'], max_cnt=2):
        print(snap)

def run_data():
    loop = asyncio.get_event_loop()
    loop.run_until_complete(live_data())
    loop.close()

run_data()

Still doesn't work for me. any help appreciated.

mrhaa commented 2 years ago

your codes are working via recent xbbg.