I am new to Upstox SDK / API and trying to see how I can place a Delivery Order and then Square it off both programmatically.
I am confused whether I need to use the same method using which I placed the order or I need to use some other method by passing the OrderId to signify which holdings I need to sell.
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.
Hi @shanmu
Thanks for the quick response. For now, I squared off the position manually so that my trade doesnât enter in loss ⌠Let me try for next trade and revert.
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.
However, there exists a viable approach to circumvent this situation. To completely bypass the procedural requirements of CDSL, you can opt-in for DDPI. For additional details, you can refer to this link: How do I activate DDPI (POA) on Upstox? - Upstox Help Center
Hi @Pradeep_Jaiswar
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?
Cover orders are not available on index options on Upstox pro app and on cover orders on index options via API is automatically rejected via risk management team.
For second query, the second order will be treated as Stop Loss order by the system.