There is no particular method for executing a square-off order. To square off an order, you must utilize the same method (PlaceOrderRequest) that was originally used for placing the order.
To perform the square-off, you need to modify the transaction_type parameter based on the type of your initial leg. The square off transaction_type will be the opposite of the order type that was initially placed.
So, technically, if I place a “SELL” order request, then initially the system checks whether there is an already open order/holding for the same instrument & Holding-period (i.e. Intraday or Day) or not.
If an holding exists for that instrument,then next order is executed on the existing order. If not, then a new is created.
Thanks for the great support I have received from you guys @shanmu & @Pradeep_Jaiswar . It has been really helpful.
I got one more connected question though, when it comes to selling off a “Holding”, we usually enter that CDSL eDIS Transactions OTP once in a day so that selling can happen on the holdings… How does that work in the SDK case?
Do I need to do that operation using the APP so that selling is enabled for the entire day. Are there general steps I can use to do so using the app?
Or, there is a method that I can call to overcome this.
In order to enable the sale of your holdings throughout the entirety of the day, and also when selling holdings via SDK, it becomes necessary to follow CDSL steps via either the mobile app or the web app.
I was trying to place CO on index options but it was getting rejected, saying its “not allowed”.
So I was just curious, if I place 2 seprate orders , i.e 1 for BUY order and other as a Stop Loss order using the same method
then will the 2nd order be treated as a square off order or a proper Stop Loss order by the system?