For the complete documentation index, see llms.txt. This page is also available as Markdown.

OptionsMultiOrder

Place multiple option legs in a single request. Ideal for complex options strategies like Iron Condor, Strangles, Spreads, and more. BUY legs are executed before SELL legs for margin efficiency.

Endpoint URL

Local Host   :  POST http://127.0.0.1:5000/api/v1/optionsmultiorder
Ngrok Domain :  POST https://<your-ngrok-domain>.ngrok-free.app/api/v1/optionsmultiorder
Custom Domain:  POST https://<your-custom-domain>/api/v1/optionsmultiorder

Sample API Request (Iron Condor - Same Expiry)

{
  "apikey": "<your_app_apikey>",
  "strategy": "Iron Condor Test",
  "underlying": "NIFTY",
  "exchange": "NSE_INDEX",
  "expiry_date": "25NOV25",
  "legs": [
    {"offset": "OTM6", "option_type": "CE", "action": "BUY", "quantity": 65},
    {"offset": "OTM6", "option_type": "PE", "action": "BUY", "quantity": 65},
    {"offset": "OTM4", "option_type": "CE", "action": "SELL", "quantity": 65},
    {"offset": "OTM4", "option_type": "PE", "action": "SELL", "quantity": 65}
  ]
}

Sample cURL Request

Sample API Response (Iron Condor)

Sample API Request (Diagonal Spread - Different Expiry)

Sample API Response (Diagonal Spread)

Request Body

Parameter
Description
Mandatory/Optional
Default Value

apikey

Your OpenAlgo API key

Mandatory

-

strategy

Strategy identifier

Mandatory

-

underlying

Underlying symbol (NIFTY, BANKNIFTY, etc.)

Mandatory

-

exchange

Underlying's exchange. Any value in the shared VALID_EXCHANGES list passes validation; the practical values are NSE_INDEX, NSE, BSE_INDEX, BSE

Mandatory

-

expiry_date

Common expiry date in DDMMMYY format (can be overridden per leg)

Optional

Derived when underlying includes expiry

strike_int

Strike interval, positive integer or null. Omit it so the actual strikes in the instrument master are used

Optional

Derived from the instrument master

legs

Array of 1 to 20 leg objects

Mandatory

-

These six fields are the complete top-level OptionsMultiOrderSchema. Any other top-level field returns HTTP 400.

Leg Object Fields

Parameter
Description
Mandatory/Optional
Default Value

offset

Strike offset: ATM, ITM1-ITM50, OTM1-OTM50

Mandatory

-

option_type

Option type: CE or PE (lowercase accepted)

Mandatory

-

action

Order action: BUY or SELL (lowercase accepted)

Mandatory

-

quantity

Order quantity, positive integer

Mandatory

-

splitsize

Split size for this leg (0 = no split)

Optional

0

expiry_date

Leg-specific expiry (for calendar and diagonal spreads)

Optional

Uses the top-level expiry

pricetype

Price type: MARKET, LIMIT, SL, SL-M

Optional

MARKET

product

Product type: MIS or NRML. CNC is rejected for options

Optional

MIS

price

Limit price (for LIMIT orders)

Optional

0

trigger_price

Trigger price (for SL orders)

Optional

0

disclosed_quantity

Disclosed quantity

Optional

0

A leg carries no symbol and no strike: the contract is resolved from offset plus the shared underlying. Any field outside this list returns HTTP 400 for the whole request.

Response Fields

Field
Type
Description

status

string

"success" or "error"

underlying

string

Underlying symbol

underlying_ltp

number

Last traded price of underlying

results

array

Array of leg results

Results Array Fields

Field
Type
Description

leg

number

Leg number (1, 2, 3...)

action

string

BUY or SELL

offset

string

Offset used

option_type

string

CE or PE

symbol

string

Resolved option symbol

orderid

string

Order ID from broker

status

string

"success" or "error"

mode

string

"analyze" in analyzer mode. The key is absent in live mode; there is no "mode": "live"

Supported Strategies

Strategy
Legs
Description

Iron Condor

4

OTM CE buy, OTM PE buy, closer OTM CE sell, closer OTM PE sell

Strangle

2

OTM CE, OTM PE (same expiry)

Straddle

2

ATM CE, ATM PE (same expiry)

Bull Call Spread

2

Buy lower strike CE, sell higher strike CE

Bear Put Spread

2

Buy higher strike PE, sell lower strike PE

Calendar Spread

2

Same strike, different expiry

Diagonal Spread

2

Different strike, different expiry

Notes

  • BUY legs are always executed first for margin efficiency

  • Each leg can have its own expiry_date for calendar/diagonal spreads

  • If a leg fails, subsequent legs are still attempted

  • The underlying_ltp is used for all legs to ensure consistent ATM calculation

  • The request schema accepts 1 to 20 legs; broker limits can be stricter.

  • Rate limit: ORDER_RATE_LIMIT, default 10 requests per second


Back to: API Documentation

Last updated

Was this helpful?