# How to get realtime data using ib\_insync, Django, Redis and Channels?

**URL:** <https://forum.djangoproject.com/t/how-to-get-realtime-data-using-ib-insync-django-redis-and-channels/3374>\
**Category:** Using Django\
**Created:** [July 10, 2020, 7:01pm UTC](https://forum.djangoproject.com/t/how-to-get-realtime-data-using-ib-insync-django-redis-and-channels/3374 "2020-07-10T19:01:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![juan9222](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/juan9222/32/1623_2.png) [@juan9222](https://forum.djangoproject.com/u/juan9222)\
**Post date:** [July 10, 2020, 7:01pm UTC](https://forum.djangoproject.com/t/how-to-get-realtime-data-using-ib-insync-django-redis-and-channels/3374/1 "2020-07-10T19:01:49Z")

</div>

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.  
[107518879\_10222696077820047\_5995642844586485440\_o|334x500](https://forum.djangoproject.com/uploads/short-url/d8TCBBsUvvmsP3yBYzp16jb5O3a.jpeg)

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 services.py, my consumer.py to ease the solution. I’m also providing my github.

 ![107486047_10222696094660468_2030328949352309110_o](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/e/e516cef40b6ffb72fdffae4b69d180dec0a2da9f.jpeg)

[https://github.com/juan9222/qsdb](https://github.com/juan9222/qsdb?fbclid=IwAR2-b32_rYgwhJGdFuyySpks6Eg6EOs3mZG9U6UtaR-DjR9wtxju5kT-LFQ)

Thanks in advance!
