Modifying BO

botany02
Dear Kite Team,
Im facing problem with bracket order.

Scenario 1:
Ltp @ 523
Placed Buy BO with Qty 1 Price 520.00
Order is Open.
Now I want to modify Qty 1 --> 2 & Price --> 521.00
What are the Parameters needs to be sent as PUT request.
Is the above possible ..? or need to cancel that BO order & Place Fresh.

Scenario 2
Ltp @523
Placed Buy BO with Qty 1 Price 524.00 with Tgt 2.00 Sl 2.00
Main Order Completed Immediately
Now I have One Open Sell Limit Order @ 525.00
One Trigger Pending Sell SL-M order @ 521.00

now i want to increase my Tgt price to 527.
& sl price to 520.00
What are the parameters needs to be sent...? or not possible.

I tried many options, but getting exceptions 400 or 502.

Im able to successfully modify CO stoploss price.
Tagged:
  • Vivek
    Scenario 1: You can modify price and quantity as normal order since the first leg is not executed yet - https://kite.trade/docs/connect/v1/#modifying-orders (Check section Bracket Order (BO) parameters)

    Scenario 2: For modifying second leg orders you have to send additional param called parent_order_id
  • botany02
    botany02 edited September 2016
    Yes vivek, I have done the same, But still getting Error 400 bad request.
    Below is how im sending
    For FirstLeg Order Modification i.e. Main Order.
    reqparm.Add("api_key", api_key)
    reqparm.Add("access_token", access_token)
    reqparm.Add("quantity", TrdQty)
    reqparm.Add("price", LmtPrice)
    reqparm.Add("trigger_price", 0)'I tried Putting non zero value also
    Request -PUT https://api.kite.trade/orders/bo/160929000180766
    Even added reqparm.Add("parent_order_id", OrderId) to check.
    Nothing worked..

    For SecondLeg Orders i.e Target .
    reqparm.Add("api_key", api_key)
    reqparm.Add("access_token", access_token)
    reqparm.Add("parent_order_id", ParentOrderId)
    reqparm.Add("quantity", TrdQty)
    reqparm.Add("price", LmtPrice)
    reqparm.Add("trigger_price", 0)'I tried Putting non zero value also
    Request -PUT https://api.kite.trade/orders/bo/160929000180767

    For SecondLeg Orders i.e Stoploss .
    reqparm.Add("api_key", api_key)
    reqparm.Add("access_token", access_token)
    reqparm.Add("parent_order_id", ParentOrderId)
    reqparm.Add("quantity", TrdQty)
    reqparm.Add("price",0) 'I tried Putting non zero value also
    reqparm.Add("trigger_price", TrgPrice)
    Request -PUT https://api.kite.trade/orders/bo/160929000180768

    Am i missing anything...?

    Same function is working well with CO stoploss order modification.

  • Vivek
    @botany02 Can you check the error response please? for bad input we do send reason for request failure. Since market is closed now I can check this tomorrow morning only.
  • botany02
    @vivek

    Im gettin the following Response.
    The remote server returned an error: (500) Internal Server Error.
    Message:An internal server error occurred
    ErrorType:GeneralException

    Order Ids
    160930000102723 (Main)
    160930000102724 (Tgt)
    160930000102725 (Sl)

    160930000112075 (Main)

    Could u pls address this issue...?

  • Vivek
    @botany02 Please try sending tradingsymbol and exchange in PUT order.
  • botany02
    Ok Vivek..
    Let me try
  • botany02
    Hi Vivek, It worked
    Please update your Kite Doc with these additional parameters.
    Thanks
  • Vivek
    @botany02 Yeah will update it
This discussion has been closed.