I run a script wherein the code after meeting certain conditions first places a buy order, then prints the order ID, then checks if the order is complete and then places a sell order and prints 'Sell' to signify that.
All this happened thrice within 5 seconds. However, on checking my order book, I noticed an order not placed by me (output would have shown it) was placed too. Order ID - 200902002395607, time being the same as with order ID - 200902002395587.
Is there any reason for this or is it just a bug? I am tracking close to 2900 instruments within a single code so could it be an overload issue?
This is the code I'm using. As you can see, there's no way the code can place two orders without printing, meaning there must be some bug at your end. Please see if you have any remedy/info on this as this can result in losses.
The same thing happened again, Kite Connect placed an order that wasn't authorised by the algorithm. Clearly there is something that deserves your attention here. Please help me regarding this, I can give you more info if you need.
print(name)
status = 'R'
buy_leg = kite.place_order(tradingsymbol=name_lower, price=offer_lower, variety=kite.VARIETY_REGULAR, exchange='NFO', transaction_type=kite.TRANSACTION_TYPE_BUY, quantity=min(bidq, offer_lower_q, maxi), order_type=kite.ORDER_TYPE_LIMIT, product=kite.PRODUCT_NRML)
print(buy_leg)
order_id=kite.orders()
number = next((d for d in order_id if d['order_id'] == buy_leg), '0')
id1 = number['status']
if id1 == 'COMPLETE':
kite.place_order(tradingsymbol=name, price=bid, variety=kite.VARIETY_REGULAR, exchange='NFO', transaction_type=kite.TRANSACTION_TYPE_SELL, quantity=min(offer_lower_q, bidq, maxi), order_type=kite.ORDER_TYPE_LIMIT, product=kite.PRODUCT_NRML)
default_settings[111000]['count'] = 20001
print('Sell')
sleep(1)