Issue with bracket order

sauravkedia
Dear Team,
Today I placed a BO order with params indicated below. I had placed the square-off value of 10.15 but apparently it got placed at only 3.75 points. I had placed 5 such orders and everywhere the same issue cropped up.

What has gone wrong here?

{'client_id': 'DS5211',
'disclosed_quantity': None,
'exchange': 'NFO',
'order_id': '180227000228317',
'order_type': 'LIMIT',
'ordertime': datetime.datetime(2018, 2, 27, 9, 30, 50, 889308),
'price': 105.15,
'product': 'BO',
'quantity': 8000,
'squareoff_value': 10.15,
'status': 'NEW',
'stoploss_value': 1.7,
'tag': 3295,
'tradingsymbol': 'PNB18MARFUT',
'trailing_stoploss': 0.0,
'transaction_type': 'SELL',
'trigger_price': 0,
'validity': 'DAY',
'variety': 'bo'}
The second leg of the BO got filled at 101.40.

[{'average_price': 105.15,
'cancelled_quantity': 0,
'disclosed_quantity': 0,
'exchange': 'NFO',
'exchange_order_id': '1700000001003449',
'exchange_timestamp': Timestamp('2018-02-27 09:30:51'),
'exchange_update_timestamp': None,
'filled_quantity': 8000,
'guid': 'kWjts8RH8A7R1EfV',
'instrument_token': 12236290,
'market_protection': 0,
'order_id': '180227000228317',
'order_timestamp': Timestamp('2018-02-27 09:30:51'),
'order_type': 'LIMIT',
'parent_order_id': None,
'pending_quantity': 0,
'placed_by': 'DS5211',
'price': 105.15,
'product': 'BO',
'quantity': 8000,
'status': 'COMPLETE',
'status_message': None,
'tag': '3295',
'tradingsymbol': 'PNB18MARFUT',
'transaction_type': 'SELL',
'trigger_price': 0.0,
'validity': 'DAY',
'variety': 'bo'},
{'average_price': 101.4,
'cancelled_quantity': 0,
'disclosed_quantity': 0,
'exchange': 'NFO',
'exchange_order_id': '1700000001003980',
'exchange_timestamp': Timestamp('2018-02-27 09:30:51'),
'exchange_update_timestamp': None,
'filled_quantity': 8000,
'guid': None,
'instrument_token': 12236290,
'market_protection': 0,
'order_id': '180227000228384',
'order_timestamp': Timestamp('2018-02-27 12:48:13'),
'order_type': 'LIMIT',
'parent_order_id': '180227000228317',
'pending_quantity': 0,
'placed_by': 'DS5211',
'price': 101.4,
'product': 'BO',
'quantity': 8000,
'status': 'COMPLETE',
'status_message': None,
'tag': '3295',
'tradingsymbol': 'PNB18MARFUT',
'transaction_type': 'BUY',
'trigger_price': 0.0,
'validity': 'DAY',
'variety': 'bo'},
{'average_price': 0.0,
'cancelled_quantity': 4000,
'disclosed_quantity': 4000,
'exchange': 'NFO',
'exchange_order_id': '1700000001003981',
'exchange_timestamp': Timestamp('2018-02-27 12:48:13'),
'exchange_update_timestamp': None,
'filled_quantity': 0,
'guid': None,
'instrument_token': 12236290,
'market_protection': 0,
'order_id': '180227000228385',
'order_timestamp': Timestamp('2018-02-27 12:48:13'),
'order_type': 'SL-M',
'parent_order_id': '180227000228317',
'pending_quantity': 4000,
'placed_by': 'DS5211',
'price': 0.0,
'product': 'BO',
'quantity': 4000,
'status': 'CANCELLED',
'status_message': None,
'tag': '3295',
'tradingsymbol': 'PNB18MARFUT',
'transaction_type': 'BUY',
'trigger_price': 106.85,
'validity': 'DAY',
'variety': 'bo'}]
I checked if I had amended the Limit value midway . However it seems the order was placed originally with 3.75 points only.

[{'average_price': 0,
'cancelled_quantity': 0,
'disclosed_quantity': 8000,
'exchange': 'NFO',
'exchange_order_id': None,
'exchange_timestamp': None,
'exchange_update_timestamp': None,
'filled_quantity': 0,
'guid': None,
'instrument_token': 2,
'market_protection': 0,
'order_id': '180227000228384',
'order_timestamp': datetime.datetime(2018, 2, 27, 9, 30, 51),
'order_type': 'LIMIT',
'parent_order_id': '180227000228317',
'pending_quantity': 8000,
'placed_by': 'DS5211',
'price': 101.4,
'product': 'BO',
'quantity': 8000,
'status': 'PUT ORDER REQ RECEIVED',
'status_message': None,
'tag': '3295',
'tradingsymbol': 'PNB18MARFUT',
'transaction_type': 'BUY',
'trigger_price': 0,
'validity': 'DAY',
'variety': 'bo'},
{'average_price': 0,
'cancelled_quantity': 0,
'disclosed_quantity': 8000,
'exchange': 'NFO',
'exchange_order_id': None,
'exchange_timestamp': None,
'exchange_update_timestamp': None,
'filled_quantity': 0,
'guid': None,
'instrument_token': 12236290,
'market_protection': 0,
'order_id': '180227000228384',
'order_timestamp': datetime.datetime(2018, 2, 27, 9, 30, 51),
'order_type': 'LIMIT',
'parent_order_id': '180227000228317',
'pending_quantity': 8000,
'placed_by': 'DS5211',
'price': 101.4,
'product': 'BO',
'quantity': 8000,
'status': 'OPEN PENDING',
'status_message': None,
'tag': '3295',
'tradingsymbol': 'PNB18MARFUT',
'transaction_type': 'BUY',
'trigger_price': 0,
'validity': 'DAY',
'variety': 'bo'},
{'average_price': 0,
'cancelled_quantity': 0,
'disclosed_quantity': 8000,
'exchange': 'NFO',
'exchange_order_id': '1700000001003980',
'exchange_timestamp': datetime.datetime(2018, 2, 27, 9, 30, 51),
'exchange_update_timestamp': None,
'filled_quantity': 0,
'guid': None,
'instrument_token': 12236290,
'market_protection': 0,
'order_id': '180227000228384',
'order_timestamp': datetime.datetime(2018, 2, 27, 9, 30, 51),
'order_type': 'LIMIT',
'parent_order_id': '180227000228317',
'pending_quantity': 8000,
'placed_by': 'DS5211',
'price': 101.4,
'product': 'BO',
'quantity': 8000,
'status': 'OPEN',
'status_message': None,
'tag': '3295',
'tradingsymbol': 'PNB18MARFUT',
'transaction_type': 'BUY',
'trigger_price': 0,
'validity': 'DAY',
'variety': 'bo'},
{'average_price': 101.4,
'cancelled_quantity': 0,
'disclosed_quantity': 0,
'exchange': 'NFO',
'exchange_order_id': '1700000001003980',
'exchange_timestamp': datetime.datetime(2018, 2, 27, 9, 30, 51),
'exchange_update_timestamp': None,
'filled_quantity': 4000,
'guid': None,
'instrument_token': 12236290,
'market_protection': 0,
'order_id': '180227000228384',
'order_timestamp': datetime.datetime(2018, 2, 27, 12, 48, 13),
'order_type': 'LIMIT',
'parent_order_id': '180227000228317',
'pending_quantity': 4000,
'placed_by': 'DS5211',
'price': 101.4,
'product': 'BO',
'quantity': 8000,
'status': 'OPEN',
'status_message': None,
'tag': '3295',
'tradingsymbol': 'PNB18MARFUT',
'transaction_type': 'BUY',
'trigger_price': 0,
'validity': 'DAY',
'variety': 'bo'},
{'average_price': 101.4,
'cancelled_quantity': 0,
'disclosed_quantity': 0,
'exchange': 'NFO',
'exchange_order_id': '1700000001003980',
'exchange_timestamp': datetime.datetime(2018, 2, 27, 9, 30, 51),
'exchange_update_timestamp': None,
'filled_quantity': 8000,
'guid': None,
'instrument_token': 12236290,
'market_protection': 0,
'order_id': '180227000228384',
'order_timestamp': datetime.datetime(2018, 2, 27, 12, 48, 13),
'order_type': 'LIMIT',
'parent_order_id': '180227000228317',
'pending_quantity': 0,
'placed_by': 'DS5211',
'price': 101.4,
'product': 'BO',
'quantity': 8000,
'status': 'COMPLETE',
'status_message': None,
'tag': '3295',
'tradingsymbol': 'PNB18MARFUT',
'transaction_type': 'BUY',
'trigger_price': 0,
'validity': 'DAY',
'variety': 'bo'}]
  • sujith
    It is because, at the time of opening, the lower circuit value was 101.4
  • sauravkedia
    This is not making sense. Can you send me detailed rules and limitations around Bracket Orders. PNB opened at 107 range and lower circuit value was 101.4 implying 5% barrier which is rubbish. More likely it was lower circuit for previous day. If so, while it may be correct for an order placed at open, it obviously is a cause of concern for order placed at 9.30 to take advantage of the market fluctuations early in morning.

    This entire this is not making sense, as I am not able to place intended order. Further, its not a one off thing. So, I would like to know how bracket orders work so as to set my expectation right/tweak my algo.


  • sujith
    Hi @sauravkedia,
    You can check out this blogpost.
    This is the circular from NSE.

    If the price entered is below execution range then the order will sit at lower execution range value.
  • sauravkedia
    In a nutshell, are you saying that both the SL and Limit leg of Bracket orders for Futures has to be placed within 5% of the price trading at the time of placing the order?
  • sujith
    Yes, you can place an order within 5% range only.
  • sauravkedia
    @Sujith,

    There is something we are missing here. Today I placed a bracket order to Short SBI March futures. It got filled at 253.20.Now, in line with our discussion and as happened in the PNB case cited above, if my Limit leg on BO was below 253.2 * 0.95 = 240.50, then the Limit leg should automatically be placed at lower bound i.e 240.50. However, I successfully placed my limit Leg at 231.30 and not one, but multiple orders.

    I like to keep my Limit and SL leg tuned with the volatility of the future contract under consideration and hence when vols are high, my Limit leg could be wide, more than 10%. So, I want to understand how your BO order work when you place the Limit leg at significant deviation (>8%) from prevailing market price and which explains both: the SBI today and PNB earlier.

    first leg:
    {'average_price': 253.2,
    'cancelled_quantity': 0,
    'disclosed_quantity': 0,
    'exchange': 'NFO',
    'exchange_order_id': '1200000001673923',
    'exchange_timestamp': datetime.datetime(2018, 3, 7, 9, 39, 26),
    'exchange_update_timestamp': None,
    'filled_quantity': 3000,
    'guid': 'VHh7tqT3GV1nsVNn',
    'instrument_token': 12244738,
    'market_protection': 0,
    'order_id': '180307000292593',
    'order_timestamp': datetime.datetime(2018, 3, 7, 9, 39, 26),
    'order_type': 'LIMIT',
    'parent_order_id': None,
    'pending_quantity': 0,
    'placed_by': 'DS5211',
    'price': 253.15,
    'product': 'BO',
    'quantity': 3000,
    'status': 'COMPLETE',
    'status_message': None,
    'tag': '3371',
    'tradingsymbol': 'SBIN18MARFUT',
    'transaction_type': 'SELL',
    'trigger_price': 0,
    'validity': 'DAY',
    'variety': 'bo'}

    Second Leg (LIMIT):

    {'average_price': 0,
    'cancelled_quantity': 0,
    'disclosed_quantity': 3000,
    'exchange': 'NFO',
    'exchange_order_id': '1200000001673952',
    'exchange_timestamp': datetime.datetime(2018, 3, 7, 9, 39, 26),
    'exchange_update_timestamp': None,
    'filled_quantity': 0,
    'guid': None,
    'instrument_token': 12244738,
    'market_protection': 0,
    'order_id': '180307000292594',
    'order_timestamp': datetime.datetime(2018, 3, 7, 9, 39, 26),
    'order_type': 'LIMIT',
    'parent_order_id': '180307000292593',
    'pending_quantity': 3000,
    'placed_by': 'DS5211',
    'price': 231.3,
    'product': 'BO',
    'quantity': 3000,
    'status': 'OPEN',
    'status_message': None,
    'tag': '3371',
    'tradingsymbol': 'SBIN18MARFUT',
    'transaction_type': 'BUY',
    'trigger_price': 0,
    'validity': 'DAY',
    'variety': 'bo'},
  • krtrader
    Hi @sujith

    As you mentioned execution range for future is 5% of reference value. Just to confirm this I placed BO in LUPIN MAR 18 fut.

    Buy Price : 764.2
    Target : 100.0 (864.2)
    Stoploss : 1.0 (763.2)

    When Order was executed, the target price was reduced to 839.6 which is around 9.87% of the buying price.
    PFB screen shot


    Theoretically Target limit order should be placed around 812.4 . Could you please explain reason behind this?

  • MadanGoyal
    MadanGoyal edited March 2018
    Hi @sujith

    I also faced similar issues. Although I figured out that the price range for Futures is not limited to 5% like you mentioned earlier. I think the following NSE link explains the reason why

    https://www.nseindia.com/products/content/derivatives/equities/price_bands.htm

    With Equity futures, NSE has a price band policy being capped at 10% of the base price. What is unclear here is the term "base price" mentioned on NSE site and why does it keep changing during the day. With my experience, when I place a bracket order for a NSE Scrip future, whose target or stop loss exceeds the price band limit, the respective leg gets capped at the extreme limit. For eg: – Lets say PNB Future closed at 100 Rs on the previous day. It opened at 106 today (6% Up). After 5 minutes of market opening, if I place a Buy BO at 106 with a 5 Rs Target (relative) and 2 Rs Stop loss (relative), I notice that the target leg of the order in Kite says 110 Rs = (110 – 106 = 4Rs relative instead of 5Rs). I understand that since this is NSE policy this is how it is, but its not that during the rest of the trading day the price of PNB is capped at 110 Rs. I notice that probably after 15 minutes, lets say it has risen to 112 Rs. Clearly, this means that the calculation of 10% of the 'base price' keeps shifting during the day. This dynamic nature needs to be understood in these cases.

    Here lies another problem, that if the price band is dynamic in nature, then it means to achieve the desired target / SL, one has to modify them when the desired limit is extended by NSE. But that won't be possible with BO, because one can not modify the second leg orders in BO. One can only cancel the previous BO and place a new one.

    Please shed some light on this.

    Thanks
  • sauravkedia
    The picture is murkier than this. My PNB order got capped at around 5% percent whereas SBI order got away with around 10%. So, neither of this 5% or 10% number is explaining what I have observed.

    This needs more clarity from Zerodha.
  • MadanGoyal
    I agree with that. Certainly needs more clarity
  • trade_then
    trade_then edited March 2018
    I apologise for sounding stupid or out of place, but until it is resolved/understood for you, why don't you experiment with
    1. pnb lowpriceBand
    2. pnb upperpriceBand
    (+-) adjusted to what might be the future price at that point of time.

    There must be something in python which fetches this page from NSE for you and gets the value of tags with ID`s
    1. lowpriceBand
    2. upperpriceBand
    So you can be sure of not jumping the range at that point of time.
    And similarly for other future scrips.

    Thanks
    Regards






  • sujith
    You guys can check out 1.4 and 1.6 section of the circular.
  • sauravkedia
    @trade_then ,
    Extracting the upper and lower band limit values is not a tough task at all, and infact I do it for one of the Algos using the excellent "nsepy" python library. One should check it out, it scrapes a lot of information out of nse website.

    Nevertheless, do we know for sure if Zerodha is placing the BO orders as per these bands. As per the circulars sighted by others, upper price band and lower price band are relevant for cash market not for derivatives.

    Referring to various circular etc will not close the matter because, in the end, it all boils down to what Zerodha is following. By now, we already know that these circulars are not so clear.

    Regards
    Saurav


  • sauravkedia
    @sujith
    Sorry I had missed your post while replying to earlier one. Let me review it.
Sign In or Register to comment.