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

Best Answer

  • umer.nalla
    Answer ✓

    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?

Answers

  • Hi Umer,

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

    Kind Regards

  • Hi ,


    Have one query . If we go like above ...and put asyncio call in continuous while loop ....will after 60 seconds the code will again request for new streaming.open() request and it will be counted as 1 more request or it will just keep the current stream open and will not count it as a seperate request. This i'm asking in context of the number of streaming.open requests we can send in a day ..Also in one request how many instruments i can send for streaming prices . I need to get the AT THE MONEY strike prices of a particular option during a session ...instead of subscribing to all strikes is there a way i can subscribe to ATM strike RIC's in between the session ...I have used above streamingPrices open request only at start of the session .


    Thanks

    Sumit

  • Hi ,


    Have one query . If we go like above ...and put asyncio call in continuous while loop ....will after 60 seconds the code will again request for new streaming.open() request and it will be counted as 1 more request or it will just keep the current stream open and will not count it as a seperate request. This i'm asking in context of the number of streaming.open requests we can send in a day ..Also in one request how many instruments i can send for streaming prices . I need to get the AT THE MONEY strike prices of a particular option during a session ...instead of subscribing to all strikes is there a way i can subscribe to ATM strike RIC's in between the session ...I have used above streamingPrices open request only at start of the session .


    Thanks

    Sumit