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

Option Chain

Get the complete option chain for a given underlying and expiry, including quotes for all strikes.

Endpoint URL

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

Sample API Request

{
  "apikey": "<your_app_apikey>",
  "underlying": "NIFTY",
  "exchange": "NSE_INDEX",
  "expiry_date": "30DEC25",
  "strike_count": 10
}

Sample cURL Request

curl -X POST http://127.0.0.1:5000/api/v1/optionchain \
  -H 'Content-Type: application/json' \
  -d '{
  "apikey": "<your_app_apikey>",
  "underlying": "NIFTY",
  "exchange": "NSE_INDEX",
  "expiry_date": "30DEC25",
  "strike_count": 10
}'

Sample API Response

Request Body

Parameter
Description
Mandatory/Optional
Default Value

apikey

Your OpenAlgo API key

Mandatory

-

underlying

Underlying symbol (NIFTY, BANKNIFTY, SENSEX)

Mandatory

-

exchange

Underlying exchange. Any value in the shared VALID_EXCHANGES list

Mandatory

-

expiry_date

Expiry date in DDMMMYY format

Mandatory

-

strike_count

Number of strikes above and below ATM, 1 to 100, or null

Optional

All strikes

with_greeks

When true, attaches implied_volatility, delta, gamma, theta, and vega to every CE and PE leg, computed from the quotes already fetched

Optional

false

interest_rate

Annualized risk-free rate as a percentage, 0 to 100. Used only when with_greeks is true

Optional

0

These seven fields are the complete OptionChainSchema. Any other field returns HTTP 400.

Broker adapters may use an optimized option-chain call; otherwise the service resolves contracts locally and retrieves quotes through the normalized market-data layer.

Response Fields

Field
Type
Description

status

string

"success" or "error"

underlying

string

Underlying base symbol

underlying_symbol

string

The exact symbol whose quote was used as the reference price

underlying_exchange

string

The exchange that reference quote came from

underlying_ltp

number

Current underlying price

underlying_prev_close

number

Underlying previous close

expiry_date

string

Expiry date in DDMMMYY format

expiry_ts

number

Exact expiry instant as a Unix epoch value in seconds, or null if it could not be derived

server_ts

number

Server time as a Unix epoch value in seconds, so a client can correct for its own clock skew before computing time to expiry

atm_strike

number

At-the-money strike price

quotes_included

boolean

Whether live quotes were attached to the legs

greeks_included

boolean

Whether Greeks were attached, that is with_greeks was true and quotes were available

forward_price

number

Forward price used for the Greeks, or null when Greeks were not computed

chain

array

Array of strike data

Chain Array Fields

Field
Type
Description

strike

number

Strike price

ce

object

Call option data, or null when no CE contract exists at that strike

pe

object

Put option data, or null when no PE contract exists at that strike

Option Data Fields

Field
Type
Description

symbol

string

Option symbol

label

string

ATM, ITM1, ITM2..., OTM1, OTM2...

ltp

number

Last traded price

bid

number

Best bid price

ask

number

Best ask price

bid_qty

number

Quantity at the best bid

ask_qty

number

Quantity at the best ask

open

number

Day's open

high

number

Day's high

low

number

Day's low

prev_close

number

Previous close

volume

number

Trading volume

oi

number

Open interest

lotsize

number

Lot size

tick_size

number

Tick size

implied_volatility

number

Only when with_greeks is true

delta

number

Only when with_greeks is true

gamma

number

Only when with_greeks is true

theta

number

Only when with_greeks is true

vega

number

Only when with_greeks is true

There is no rho on chain legs. Use Option Greeks for a single contract when you need it.

Notes

  • Without strike_count, returns the entire option chain for the expiry

  • The label field indicates whether the option is ATM, ITM, or OTM

  • For CE options: strikes below ATM are ITM, above are OTM

  • For PE options: strikes above ATM are ITM, below are OTM

  • Use this for options analysis and strategy selection

  • Greeks are skipped, and greeks_included comes back false, when the expiry instant cannot be derived or the chain has already expired

Use Cases

  • Option analysis: View premiums across strikes

  • Strategy selection: Find suitable strikes for spreads/strangles

  • Volatility analysis: Compare premiums at different strikes


Back to: API Documentation

Last updated