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
1 1 1 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-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-apistreaming-prices
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.

Upvote
Accepted
25.3k 87 12 25

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 512.0 KiB each and 1.0 MiB total.

Upvotes
1 1 1 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 512.0 KiB each and 1.0 MiB total.

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.