Two-Leg Order Placement & Combined Margin Calculation via DhanHQ API

Feature Request: Two-Leg Order Placement & Combined Margin Calculation via DhanHQ API

Description:
Currently, when placing multi-leg option strategies (e.g., short strangles/straddles) using the DhanHQ Trading API, each leg is treated as an independent order and margin is blocked separately for each leg. This results in significantly higher margin requirements compared to placing the same strategy via Basket Orders or the Option Strategy Builder on the Dhan web/app, where hedge benefits are applied upfront.

Problem:

  • API users cannot place basket or multi-leg hedged orders.

  • Margin benefits for hedged strategies are not considered at order placement time.

  • This makes systematic and algo-based options trading capital-inefficient and inconsistent with the web/app experience.

Requested Features:

  1. Two-leg (or multi-leg) order placement via API

    • Ability to submit multiple option legs as a single atomic/basket order.
  2. Combined margin calculation at order placement

    • Apply hedge benefits upfront for defined option strategies (e.g., short strangle, iron condor, spreads).
  3. Strategy-level order status & execution handling

    • Partial fills, rejections, and cancellations handled at the strategy level.

Benefits:

  • Enables true algo and systematic options trading on Dhan.

  • Ensures parity between API and web/app trading experiences.

  • Reduces unnecessary margin blocking and improves capital efficiency.

  • Encourages more active and professional traders to adopt DhanHQ APIs.

Use Case Example:
Placing a short strangle (CE sell + PE sell) via API should block margin equivalent to a hedged strategy, similar to Basket Orders, instead of blocking margin for two naked positions.
@Hardik @RahulDeshpande @Dhan

1 Like

Perfectly describe & very much in need of this.

1 Like

Hey @Dhananjay_Umalkar @Varsha777

We are working on something similar - to get combined margin calculation API. Will look into multi-leg orders and strategy level handling as well.

The idea behind keeping the APIs simple is to ensure any combination or handling can be done by the user using them as per their own preference. Will look into this if we can make it highly customisable and roll it out.

1 Like

However, implementing a Combined Margin Calculator API alone won’t solve the core issue. Even if the calculator shows a reduced margin, the Order Placement API currently processes legs sequentially.

The system will treat the first leg as a naked position, demand full margin, and likely reject the order for “Insufficient Funds” before the second leg can be placed to provide the hedge benefit. To make this work for algo trading, we need:

Atomic Basket Placement: A single API call to submit all legs simultaneously.

Upfront Margin Validation: The risk management system (RMS) must validate the margin against the entire basket, not individual legs.

Without this, we still face the same capital efficiency bottleneck regardless of having a calculator.



-

I understand this adds complexity to the API architecture, but it would make the DhanHQ API truly specialized and superior for professional algo traders who prioritize capital efficiency.

Again thank you for considering the request @Hardik