GTT as simple as UI not possible with API

xetayeta
I buy at 100
I want to sell at 120 or at stop loss 80
Zerodha UI can do it very easily. Why its not possible from API considering free account and NFO. Pleasehelp
#--- REQUIRED VAR ---#
order_price, price_tgt, price_sl = 100, 120, 80
symbol, q, exchange, = 'NIFTY2630225300CE', 65, kite.EXCHANGE_NFO
#------ORDER DICT --------#
order_oco = [{
"exchange":exchange,"tradingsymbol": symbol,"transaction_type": kite.TRANSACTION_TYPE_SELL,"quantity": q,
"order_type": "LIMIT","product": "CNC","price": price_sl},
{
"exchange":exchange,"tradingsymbol": symbol,"transaction_type": kite.TRANSACTION_TYPE_SELL,"quantity": q,
"order_type": "LIMIT","product": "CNC","price": price_tgt
}]
kite.place_gtt(trigger_type=kite.GTT_TYPE_OCO, tradingsymbol=symbol, exchange=exchange,
trigger_values=[price_sl,price_tgt], last_price=order_price , orders=order_oco)
####################################################################################
Problem: InputException: Trigger already met.
Tagged:
Sign In or Register to comment.