Hedging and Margin Benefits with Dhan API

Hi Team,

I am currently working on implementing a hedging strategy using Dhan API, with the intent to also utilize margin benefits for my SELL order. While experimenting with the API, I faced some issues, and unfortunately, I was unable to retain the detailed stats. However, I do remember the sequence of events and have a few specific questions based on that experience:

  1. Is it possible to execute a hedge on the same option strike price using a normal order or a super order?
  2. What should be the ideal time gap between the BUY and SELL orders in order to qualify for margin benefits while selling?
  3. While attempting to hedge with a super order, I placed a BUY order with a target and stop loss, which worked as expected. However, when the market turned and I tried placing a SELL order, I observed two unexpected behaviors:
  • The sell order was canceled due to “insufficient balance,” even though the buy order had been placed earlier (with a gap of more than one minute, as per my observation).
  • Immediately after placing the sell order, the stop loss on my buy order was triggered, even though the price had not come close to the specified range.

took trade on 15th September, do let me know if you need more info related to that trade to deep dive

  1. Could you please share what challenges or precautions I should be aware of when performing hedging using the Dhan API? I have come across discussions online that mention certain rules and best practices for availing margin benefits while hedging, and I would like to confirm them directly with the team.

Thank you in advance for your guidance.

Tagging @Sammy @Hardik for better reach.

Hey @aditya3 ,

Please find the response to your query below:

  1. Same strike hedge: If you are referring to the same strike but different option types (Call and Put), this is possible using a normal order.
  2. Time gap: There is no mandatory time gap required. Please ensure that your Buy order is triggered first, followed by your Sell order.
  3. Super Orders: We will get back to you with further details on hedging using Super Orders.
  4. Margin benefit: Kindly ensure that you maintain margin as per the naked position for both legs individually. Please note that you will only receive the margin benefit once your Sell order is executed, but for this you need to maintain margin as per each individual leg.
  5. Order rejection (15th September): Please share your registered details with us at help@dhan.co so we can investigate and assist you further