It looks like you're new here. If you want to get involved, click one of these buttons!

from kiteconnect import KiteConnect
import time
from kiteconnect import KiteTicker
kws = KiteTicker(zerodha_api_key,acc_tkn)
tokens = instrument_token
print(tokens)
print(strike)
# dict={9410818:'BANKNIFTY22MAR27000CE',9411074:'BANKNIFTY22MAR27000PE'}
def conditions(ticks):
    for i in range(len(ticks)):
        instrumnet_token = ticks[i]['instrument_token']
        if instrumnet_token in tokens:
            index_number = tokens.index(instrumnet_token)
            strike_price = strike[index_number] 
            
            datetime = ticks[i]['exchange_timestamp']
            bid_price = ticks[i]['depth']['buy'][0]['price']
            ask_price = ticks[i]['depth']['sell'][0]['price']
            
            print(instrumnet_token, " ", strike_price, " ", datetime, " ", bid_price, " ", ask_price)
            
            output_df = pd.DataFrame(columns = ['Instrument_token', 'Strike', 'Datetime', 'Bid_price', 'Ask_price'])
            c = 0
            output_df.loc[c] = [instrumnet_token, strike_price, datetime, bid_price, ask_price]
            display(output_df)
        else:
            pass
        print("-------------------------------------------------")
    print("\n\n")
        
        
def on_ticks(ws, ticks):
    ticks = (ticks)
    conditions(ticks)
         
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)
And This is my code.
https://kite.trade/forum/discussion/7399/kiteconnect-ticker-connection-error-1006-connection-was-closed-uncleanly-none
Still, I'm getting the same error. as well as now
full data isn't loading
If any other local error is happening,we can't help you with that.
and when I get this error, I'm not getting values ahead of this.
For computation on the heavier side , you need to follow the task queue method mentioned as solution1 in this thread. You can go through this example of the task queue method.