'How can i create a live chart with the help of Live streaming data?
I'm receiving live streaming data from the kite every second, and now I want to create a Chart with the help of that data. Any Chart can work, I don't need any specific chart type. but I don't understand how can I create a chart which is automatically changing every second.
I want that chart to change like the stock market chart changes every second.
I'm getting this type of values data in each second.
And This is my code-
from kiteconnect import KiteConnect
import time
from kiteconnect import KiteTicker
kws = KiteTicker(zerodha_api_key,acc_tkn)
tokens=[ 60702215, 60700167, 60701191]
# dict={9410818:'BANKNIFTY22MAR27000CE',9411074:'BANKNIFTY22MAR27000PE'}
def on_ticks(ws, ticks):
ticks = (ticks)
bid_price_1 = ticks[0]['depth']['buy'][0]['price']
ask_price_1 = ticks[1]['depth']['sell'][0]['price']
combination_1 = bid_price_1 - ask_price_1
print(combination_1)
def on_connect(ws, response):
ws.subscribe(tokens)
ws.set_mode(ws.MODE_FULL,tokens)
kws.on_ticks = on_ticks
kws.on_connect = on_connect
kws.connect(threaded=True)
count=0
while True:
count+=1
if(count%2==0):
if kws.is_connected():
kws.set_mode(kws.MODE_FULL,tokens)
else:
if kws.is_connected():
kws.set_mode(kws.MODE_FULL,tokens)
time.sleep(1)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

