Hi. My strategy requires me to buy and hold equity ETFs for a few days. However inorder to save on margin, I like to place MIS Buy orders and if they get executed, convert them to CNC.
#1 What API can I use to do this update from MIS to CNC?
#2 When the order gets executed, I get a postback call. Can I call this update API when I am processing that postback?
#3 Is there a timelimit by which the MIS to CNC conversion should happen? Like by 3PM or so? Typically when the orders are only partially executed , I get a postback by 330PM. Can I update the MIS to CNC status in response to that postback?
Thank you for the response. Is there some sample code for the margins API - on how to use that? I want to cancel order pending MIS order if margin is below threshold. Also how will the cancellation behave if the MIS order has been partially executed. Say I had ordered for 100 units, and 20 have been purchased. Then if I cancel, do I get the option to square-off the 20 or do I get an error when I try to cancel this ?
You can refer to the API documentation here and the pykiteconnect docs here.
To square off the 20 qty, you need to place another order with quantity as 20 with same product type and opposite transaction type. You won't get an error, if you try to cancel a partially executed order.
You can use convert_position API call. Yeah, you can update_position, once the position is successfully created. Before the order square off timing for respective exchange.
Is there some sample code for the margins API - on how to use that? I want to cancel order pending MIS order if margin is below threshold.
Also how will the cancellation behave if the MIS order has been partially executed. Say I had ordered for 100 units, and 20 have been purchased. Then if I cancel, do I get the option to square-off the 20 or do I get an error when I try to cancel this ?
To square off the 20 qty, you need to place another order with quantity as 20 with same product type and opposite transaction type.
You won't get an error, if you try to cancel a partially executed order.