For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 1

StreamingPrices run forever

Hi,

I'm using the Eikon Data API and trying to get streaming prices working from a script (not jupyter). I'm using the example code provided on PyPI and on github (in a script form). Currently the streaming_prices.open() receives updates and refreshes for the specified instruments and then almost immediately completes and ends the script. Is there a way to run a StreamingPrices instance "forever" and use the callbacks to evaluate realtime data?

Cheers
eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythonstreaming-prices
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvote
Accepted
20.3k 73 10 20

Hi @airxhi

You can try something like

streaming = ek.StreamingPrices(....) 
streaming.open() 
asyncio.get_event_loop().run_until_complete(asyncio.sleep(60)) 
streaming.close()


where the above will open the stream, run for 60 seconds before closing the stream.

If you want to run forever you can put the asyncio call in a continuous loop?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
1 0 0 1

Hi Umer,

That's exactly what I was looking for, thanks!

Kind Regards

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea