I want to make use of kite.place_gtt function to create stoploss. I could not understand the documentation. Please give me a sample program. Thanks in advance.
@ronstrader the first order is sl. This gtt is for selling. Means after you buy it,to squareoff. So ,the first order is sl. And second one is target. When one of the two is triggered,the other one is cancelled.
The problem is when gtt for target is triggering it showing error that insufficiennt holding and you are taking a CNC order but as you can see in the code I am placing MIS order for both Stoploss and target. Please help it is urgent.
Here is my code for gtt oco order
def placeGTT(symbol,quantity,sl_price, target, ltp,buy_sell):
t_type=kite.TRANSACTION_TYPE_SELL
if buy_sell == "buy":
t_type=kite.TRANSACTION_TYPE_BUY
elif buy_sell == "sell":
t_type=kite.TRANSACTION_TYPE_SELL
order_dict = [{"transaction_type": t_type, "quantity": quantity,
'order_type': kite.ORDER_TYPE_LIMIT, "product": kite.PRODUCT_MIS , "price": sl_price},
{"transaction_type": t_type, "quantity": quantity,
'order_type': kite.ORDER_TYPE_LIMIT, "product": kite.PRODUCT_MIS , "price": target}
]
kite.place_gtt(kite.GTT_TYPE_OCO, symbol, kite.EXCHANGE_NSE, [sl_price, target], ltp, order_dict)
The problem is when gtt for target is triggering it showing error that insufficiennt holding and you are taking a CNC order but as you can see in the code I am placing MIS order for both Stoploss and target. Please help it is urgent.