connection closes after placing order

sanket_one


def buy(name,ltp):
print("in buy")
if(True):
if(name in short):
order_id = kite.place_order(variety=kite.VARIETY_REGULAR,exchange=kite.EXCHANGE_NSE, tradingsymbol=name,transaction_type=kite.TRANSACTION_TYPE_BUY, quantity=1, product=kite.PRODUCT_MIS, order_type=kite.ORDER_TYPE_MARKET,)
playsound('audio.mp3')

if(name not in long):
order_id = kite.place_order(variety=kite.VARIETY_REGULAR, exchange=kite.EXCHANGE_NSE, tradingsymbol=name,transaction_type=kite.TRANSACTION_TYPE_BUY, quantity=1, product=kite.PRODUCT_MIS, order_type=kite.ORDER_TYPE_MARKET,)
playsound('audio.mp3')


def computation(name,ma_i,ltp):
.....code
buy(name,ltp)

def ohlcmaker(ticks)
....code
computation()
##--------------------------calls------------------------------------
def on_ticks(ws, ticks):
print("ticks!")
ohlc_maker(ticks)


def on_connect(ws,response):
ws.subscribe(comp_list)
ws.set_mode(ws.MODE_FULL,comp_list)
print("connected")

def on_close(ws, code, reason):
print(ws,"-",code,"-",reason)
ws.stop()

def on_error(ws, code, reason):
print('inside theeeee error block')
print(reason)

ws.stop()

def on_reconnect(ws, attempts_count):
print("Reconnecting")
##----------------------------------------------------------------

kws.on_ticks = on_ticks
kws.on_connect = on_connect
kws.on_close = on_close
kws.on_error = on_error
kws.on_reconnect = on_reconnect



# Infinite loop on the main thread. Nothing after this will run.
# You have to use the pre-defined callbacks to manage subscriptions.
kws.connect(threaded=True)


can anyone please tell me what wrong i am doing, my connection closes after i place orders.
Sign In or Register to comment.