Invalid Session

piyushk921
I am running my script for my friend and in between i got this error "ERROR:websocket:error from callback >: Invalid session".

May I know the reason behind it and how to rectify this ?
  • sujith
    Hi,
    Can you paste your code?
    We will check and get back to you.
  • piyushk921
    piyushk921 edited October 2017
    def on_tick(tick, ws):
    #print tick
    #sys.exit(0)
    with open("C:\\Python27\\COMMAND.txt",'r') as file:
    buff = file.read()
    if "stop" in buff:
    flag = 1
    else:
    flag = 0
    file.close()
    for item in tick:
    LTP = item['last_price']
    ATP = item['average_price']
    INSTRUMENT = item['instrument_token']
    LOT_SIZE = int(20000/LTP)
    TIME_RAW = str(datetime.datetime.now())
    TIME_PART = int(TIME_RAW.split(" ")[1][0:8].replace(':',''))
    symbol_name = SYMBOL_MAP[INSTRUMENT]
    kite.order_place(tradingsymbol=symbol_name,exchange="NSE",transaction_type="SELL",quantity=LOT_SIZE,order_type="MARKET",product="MIS")
  • sujith
    Hi @piyushk921,
    This is error message is from order_place method, it will be called when a session is expired.
    This can happen when a user logged into to any of our platforms like PI or NEST. I would suggest using Kite for monitoring purpose and if you log out of any platform then you are logged out everywhere.
Sign In or Register to comment.