Kiteticker & Threading not working

sourabh33
Hi

I have been using your API since last three years. Things were working fine since till last friday. Since today morning Kiteticket seems to be not threading (Not working). KiteConnect appears to be fine. This is urgent could someone please help.

There is no change in code.

Regards
Sourabh
8420195300
  • rakeshr
    Since today morning Kiteticket seems to be not threading (Not working)
    Everything is fine at our end for kiteconnect ticker/websocket stream. Just tried, an threaded example, and it's working fine. Can you paste here the complete error stack trace/log?
  • sourabh33
    Running The following code on Websocket


    subscribe =[]
    trd_portfolio = {}
    sht = wb.sheets['dStream2']
    mode = 'MODE_QUOTE'


    #function to read symbols from dStream portfolio
    def read_excel():
    for x in range (3,1305):
    name = sht.range('A'+str(x)).value
    if name == None:
    break
    token = sht.range('E' + str(x)).value
    subscribe.append(token)
    trd_portfolio[token] = {"name":name, "row":x}

    read_excel()


    def on_ticks(ws, ticks):
    print('yell')
    feed_ltp(ticks)
    print("1 Cycle Completed at ", datetime.datetime.now())
    logging.info("Ticks: {}".format(ticks))

    #order_place()


    def on_connect(ws, response):
    ws.subscribe(subscribe)
    ws.set_mode(ws.MODE_QUOTE, subscribe)

    def on_close(ws, code, reason):
    ws.stop()



    def feed_ltp(ticks):
    #wb.sheets['OHLC'].range('B1:P2000').value = None

    df_ltp_df1 = pd.DataFrame(ticks)
    df_ohlc = pd.DataFrame(columns=['open','high','low','close'])

    for(i5,r5) in df_ltp_df1.iterrows():
    e=r5['ohlc']
    df_ohlc.loc[i5] = [e['open'],e['high'],e['low'],e['close']]
    df_ltp_df1 = pd.concat([df_ltp_df1,df_ohlc], axis=1)
    df_ltp_df1.drop('ohlc',axis=1,inplace=True)
    df_ltp_df1 = df_ltp_df1.sort_values(by=['instrument_token'])
    wb.sheets['OHLC'].range('B1').value = df_ltp_df1


    #input("Press enter")
    order_place()

    #time.sleep(3)


    print('ji')
    print('pi')

    kws.on_ticks = on_ticks
    kws.on_connect = on_connect
    kws.on_close = on_close
    kws.connect()





    The output is as below

    Press Enter to Continue
    ji
    pi
    Connection error: 0 - error parsing request
    Connection error: 0 - error parsing request.

    no progress from there
  • rakeshr
    for x in range (3,1305):
    name = sht.range('A'+str(x)).value
    if name == None:
    break
    token = sht.range('E' + str(x)).value
    subscribe.append(token)
    Can you check, if you are not sending any invalid token?
  • sourabh33
    All the tokens are valid and refreshed on a daily basis.
  • sourabh33
    Getting the follwoing error

    ERROR:kiteconnect.ticker:Connection error: 0 - error parsing request
    ERROR:kiteconnect.ticker:Connection error: 0 - error parsing request.
  • sourabh33
    Have been running the exact same threading code since last three years. Facing the problem since today morning
  • dknaix
    dknaix edited August 12
    facing same issue
  • sourabh33
    Found the issue and solution

    since today , while fetching the instrument code from Kite connect the return value is a float and not an integer.

    try converting the instrument code to int and then run your code. hope it should work.
Sign In or Register to comment.