Placed a Bracket Order successfully but Sell side orders not generated

Anuj
Hi,

I placed a bracket order using the following code:

payload = {}
payload['api_key']=api_key
payload['access_token']=access_token
payload['tradingsymbol']="RELCAPITAL"
payload['exchange']="NSE"
payload['transaction_type']="BUY"
payload['order_type']="LIMIT"
payload['quantity']=1
payload['product']="MIS"
payload['validity']="DAY"
payload['price']=550
payload['squareoff_value']=552
payload['stoploss_value']=0.5
response = requests.post("https://api.kite.trade/orders/regular", data=payload)

Using this code, the order was placed successfully and was also executed successfully (I saw that order was executed in Kite). Order id is: 171017000220682. However, since its a bracket order, if the order was executed, two corresponding sell-side orders should also have been placed automatically (one for Square-off value and one for stop-loss). But I don't see this in Kite.

Ami I missing something here?

thanks!



  • sujith
    Hi @Anuj,
    You have placed MIS order and not bracket order.
    You can check out example for placing bracket order here.
  • sujith
    You have posted to the wrong endpoint.
    You need to pass variety as 'bo'.
  • Anuj
    Hi Sujith, Thanks!
  • Anuj
    Hi Sujith,

    After your clarification, I have modified the code to:

    payload = {}
    payload['api_key']=api_key
    payload['access_token']=access_token
    payload['tradingsymbol']="RELCAPITAL"
    payload['exchange']="NSE"
    payload['transaction_type']="BUY"
    payload['order_type']="LIMIT"
    payload['quantity']=1
    payload['product']="MIS"
    payload['validity']="DAY"
    payload['price']=550
    payload['squareoff_value']=552
    payload['stoploss_value']=0.5
    response = requests.post("https://api.kite.trade/orders/regular", data=payload, order_variety='bo')

    When I run, I get an error message: "request() got an unexpected keyword argument 'order_variety'"

    I tried replacing "order_variety" with "variety" but still get the same error. What is the exact parameter name that I need to pass?
  • sujith
    Hi,
    Your final endpoint must be "https://api.kite.trade/orders/bo".
  • sujith
    sujith edited October 2017
    order_variety is not a separate argument, it is must be added to the payload.

    payload['variety']='bo'
  • Anuj
    That solved it. Thanks!
This discussion has been closed.