API to square off NIFTY Options in Intraday

Hi @Pradeep_Jaiswar

I need to square-off Nifty Option positions using API.
As of now, I place a sell order for Nifty options to square off, but this requires about 10x margin.

Example:

Step 1: Order API: BUY Order 1 lot of CE NIFTY-08AUG23-2500 @Market
Step 2: Order API: SL Order 1 lot of CE NIFTY-08AUG23-2500 @{some-stop-loss-price}
Step 3: Order API: SELL Order 1 lot of CE NIFTY-08AUG23-2500 @Target-Price

My step3 typically fails due to lack of margin :slight_smile:

So, Is there a way to do ‘square-off’ instead of selling options using API?

@Amit_Kumar_Sharma Acknowledged. We are working on a similar approach to enable exiting all positions or specific order numbers through a single API. I will provide more details as soon as possible.

1 Like

Thanks @Pradeep_Jaiswar . Till this API is developed, I believe there are two ways to exit NIFTY options positions :

  1. Manually : using square off button from UI
  2. Manually: using GTT SELL order with target and SL set.
  3. API: using SELL OPTIONS order (which will require ~10x margin).

I am sticking to #2 for now.

Could you please confirm if my analysis is correct?

Yes, @Amit_Kumar_Sharma 2 is a better option in this case.

Hi @Pradeep_Jaiswar
Circling back on this one. Requesting you to please get this taken up on priority, as I am sure I am not the only one impacted. There must be many more API users, who are facing this challenge.

The absence of a options square off API is stopping me dead in the tracks from automating my intraday NIFTY CE & PE trades. I can not place SELL orders for CE and PE bought during day trade. If at least a GTT API can be provided for placing static target and SL, it will meet the requirements.

Example:

  1. I buy NIFTY 25000 CE 12-SEP-2024, 1075 qty @ 94.4. Margin required = INR 1.01 lakh
  2. Target price = 100 (6%)
  3. Target price met
  4. To SELL NIFTY 25000 CE 12-SEP-2024, 1075 qty @ 100, I will need a margin of about INR 28 lakhs!!!

Which means to make 6% on 1 lakh, I need to keep 28 lakhs in my wallet :frowning:

Such margin requirement are not there when squaring off in UI using square off button or GTT orders.

PFA attached screenshots of margin requirements from Upstox margin calculator for your reference.

Raw BUY CE

Raw SELL CE

cc: @MohitGolecha : Could you please help get this prioritized?

Hi @Amit_Kumar_Sharma ,

Yep its on priority. We picked it late August and should be shipping this soon!

1 Like

@MohitGolecha that’s music to my ears :smiley: Thank you so much! Waiting eagerly for the release. Belive me, doing this manually is not good for heart :joy: