How to get realtime data using ib_insync, Django, Redis and Channels?

Hi there! Right now i’m trying to obtain a real time hour using ib.reqCurrentTimeAsync() method from ib_insync library that returns a coroutine object.

I’m doing this to display it on a HTML template in order to provide a realtime socket endpoint later on with Django Rest Framework.

I don’t know how to do this using coroutines and async code without blocking the code using a while True: (It worked on Jupyter but it was sync code)

I provide my, my to ease the solution. I’m also providing my github.

Thanks in advance!

1 Like