How to specify Trigger_price and Price and then use GTT for placing SL and Target legs

pgu


How to achieve the above order using python kiteconnect APIs.
In the above pic, I am trying to place a BUY order with SL order type by specifying trigger_price as 320 with price as 321.
Then club it with GTT Stoploss and Target percentages.
In the above example, I am setting stoploss at -3% of executed price and target at 9% of executed price.

I have put together following code but dont know how to specify trigger_price and price.

exchange = "NFO"
ts = "BANKNIFTY21AUG32000CE"
price = 320
sl = 0.97 * price
target = 1.09 * price

orders = [
{
"exchange": exchange,
"tradingsymbol": ts,
"transaction_type": "SELL",
"quantity": 1,
"order_type": "LIMIT",
"product": "NRML",
"price": sl
},
{
"exchange": exchange,
"tradingsymbol": ts,
"transaction_type": "SELL",
"quantity": 1,
"order_type": "LIMIT",
"product": "NRML",
"price": target
}
]

kite.place_gtt(tradingsymbol=name,
trigger_type=kite.GTT_TYPE_OCO,
exchange=kite.EXCHANGE_NFO,
trigger_values=[sl, target],
last_price=price,
orders=orders)
  • sujith
    Adding GTT params while placing order is a Kite exclusive feature as of now. You can listen to postback and place GTT using the APIs.
Sign In or Register to comment.