Issue in bracket order

Hi, I was experimenting with python Kite API client. There I placed a few orders, but facing few problems. Take this parent order 170418000638204 for example. Once this was executed, two child orders were automatically placed for SL and PT. I wanted to exit this trade. As far as I understood, if I cancel any one of the two orders (on any child order if original order was hit in multiple lots) , then the open position will be exited at Market and all child orders will be cancelled.

Upon execution this BO generate the following child orders: 170418000641812(Limit) and 170418000641813 (SL-M). However, when I cancelled one of the the child order, only that child order got cancelled leaving the other order intact. Further, the position was also not squared. After than I was able to cancel the remaining child order as well without getting the position to be squared. So at 3.30 what I could see was open position on Kite web. This is not all, later on say after 3:45, I saw the following on Kite web:

Product Instrument Qty. Avg. price LTP P&L Chg.
MIS PNB -50 155.9 155.9 0 0
MIS INFY -1 922.65 922.65 0 0
BO INFY 1 927.9333333 922.65 -8.9 -0.005693656
BO PNB 50 156.75 155.9 -42.5 -0.005422648

All this leads to mutliple questions:

1. I see PNB +50 under BO and PNB-50 under MIS, so can I assume that squared off and no margin in blocked and no transfer to demat is happening.

2. Why did these entries come after 3.45. So I place these orders, and they are being exited at market after 3.20, wont I see squared off positions at 3.30. Do I need to hope and pray that all positions with BO have been exited and I am not carrying any overnight positions. How I am expected to run a trading system if I trade in multiple scrips.

3. When I exited a child order, why didnt the trade exit completely. So basically, i am clueless to what happens when I exit a bracket order once the entry is made. This is what I used to cancel the order:

childorderid = 170418000641812
parentorderid = 170418000638204
kite.order_cancel(order_id = childorderid, parent_order_id = parentorderid)

  • sujith
    Hi @skk,
    You need to send order_variety while canceling bracket order as mentioned here.
    This was a special scenario, Hence admin had to square off position using MIS product type in post-market session.
  • sauravkedia
    Thanks, all worked well today.
This discussion has been closed.