how to place a bracket order in php

raminde
raminde edited November 2017 in PHP client
I am trying to place an bracket order but its not working, the order what gets placed is mis and not bracket order(BO).
please check and let me know if I am doing something wrong pleace check the parameters below. Below is the url with parameters.

https://api.kite.trade/orders/regular?api_key=xxxxxxxxxxx&access_token=xxxxxxxxxxxxx&tradingsymbol=IBREALEST&exchange=NSE&order_variety=bo&validity=DAY&bo&order_type=LIMIT&product=MIS&transaction_type=BUY&quantity=1&price=220&squareoff_value=1&stoploss_value=1&variety=bo
Tagged:
  • sujith
    Hi,
    You are placing the order as regular hence it is placed as MIS order.

    Your URL should be something like https://api.kite.trade/orders/bo and send params in the body.
    You can check out example for sending params here.
  • raminde
    raminde edited November 2017
    thanks got it.. besides now how do I get the stop-loss and squareoff order ids which gets automatically placed when bracket order gets executed...
  • sujith
    Once the first leg is placed, there will be two second leg orders which will be a LIMIT order and SL-M order.
    You can modify trigger_price for stop-loss and modify price for the limit order.
  • sujith
    You can go through this thread to know more about bracket order.
  • raminde
    Thanks I know how it works but I wanted to know is there are shorcut way to know what are the ids of the leg orders... created from parent order..

    now I can only see a way where i have to get all orders then scan each order parent id

    isnt there a like a custom search order where i can just put condition like

    show orders where parent parent_order_id = "XXXXXXXXXXXX"
  • sujith
    You need to fetch orderbook and look for orders with parent_order_id same as the order_id. If it is target LIMIT order then you can modify the price and if it is stop-loss SL-M order then you need to modify trigger_price.
    This is the only available way to modify second leg orders.

    You can take a look at example here.
This discussion has been closed.