> For the complete documentation index, see [llms.txt](https://docs.openalgo.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.openalgo.in/api-documentation/v1/data-api/optiongreeks.md).

# OptionGreeks

Calculate Option Greeks (Delta, Gamma, Theta, Vega, Rho) and Implied Volatility for an option.

## Endpoint URL

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

## Sample API Request

```json
{
  "apikey": "<your_app_apikey>",
  "symbol": "NIFTY25NOV2526000CE",
  "exchange": "NFO",
  "interest_rate": 0.00,
  "underlying_symbol": "NIFTY",
  "underlying_exchange": "NSE_INDEX"
}
```

## Sample cURL Request

```bash
curl -X POST http://127.0.0.1:5000/api/v1/optiongreeks \
  -H 'Content-Type: application/json' \
  -d '{
  "apikey": "<your_app_apikey>",
  "symbol": "NIFTY25NOV2526000CE",
  "exchange": "NFO",
  "interest_rate": 0.00,
  "underlying_symbol": "NIFTY",
  "underlying_exchange": "NSE_INDEX"
}'
```

## Sample API Response

```json
{
  "status": "success",
  "symbol": "NIFTY25NOV2526000CE",
  "exchange": "NFO",
  "underlying": "NIFTY",
  "strike": 26000.0,
  "option_type": "CE",
  "expiry_date": "25-Nov-2025",
  "days_to_expiry": 28.5071,
  "spot_price": 25966.05,
  "option_price": 435,
  "interest_rate": 0.0,
  "implied_volatility": 15.6,
  "greeks": {
    "delta": 0.4967,
    "gamma": 0.000352,
    "theta": -7.919,
    "vega": 28.9489,
    "rho": 9.733994
  }
}
```

## Request Body

| Parameter            | Description                            | Mandatory/Optional | Default Value       |
| -------------------- | -------------------------------------- | ------------------ | ------------------- |
| apikey               | Your OpenAlgo API key                  | Mandatory          | -                   |
| symbol               | Option symbol                          | Mandatory          | -                   |
| exchange             | Exchange: NFO, BFO, CDS, MCX, CRYPTO   | Mandatory          | -                   |
| interest\_rate       | Risk-free interest rate (annualized %) | Optional           | Exchange default    |
| underlying\_symbol   | Underlying symbol for spot price       | Optional           | Derived from option |
| underlying\_exchange | Underlying exchange                    | Optional           | NSE\_INDEX          |
| forward\_price       | Custom forward/synthetic futures price | Optional           | -                   |
| expiry\_time         | Custom expiry time in "HH:MM" format   | Optional           | -                   |

## Response Fields

| Field               | Type   | Description                           |
| ------------------- | ------ | ------------------------------------- |
| status              | string | "success" or "error"                  |
| symbol              | string | Option symbol                         |
| exchange            | string | Exchange                              |
| underlying          | string | Underlying symbol                     |
| strike              | number | Strike price                          |
| option\_type        | string | CE or PE                              |
| expiry\_date        | string | Expiry date                           |
| days\_to\_expiry    | number | Days remaining to expiry (fractional) |
| spot\_price         | number | Current spot/underlying price         |
| option\_price       | number | Current option LTP                    |
| interest\_rate      | number | Risk-free rate used                   |
| implied\_volatility | number | Calculated IV (%)                     |
| greeks              | object | Greeks values                         |

### Greeks Object Fields

| Field | Type   | Description                                  |
| ----- | ------ | -------------------------------------------- |
| delta | number | Price sensitivity to underlying movement     |
| gamma | number | Delta sensitivity to underlying movement     |
| theta | number | Time decay per day (negative)                |
| vega  | number | Price sensitivity to 1% IV change            |
| rho   | number | Price sensitivity to 1% interest rate change |

## Understanding Option Greeks

| Greek     | Description                                        | Typical Range            |
| --------- | -------------------------------------------------- | ------------------------ |
| **Delta** | How much option price moves for ₹1 underlying move | CE: 0 to 1, PE: -1 to 0  |
| **Gamma** | Rate of change of delta                            | Higher near ATM          |
| **Theta** | Daily time decay (negative for buyers)             | Increases near expiry    |
| **Vega**  | Price change for 1% IV move                        | Higher for longer expiry |
| **Rho**   | Price change for 1% interest rate move             | Usually small            |

## Notes

* Uses the **Black-76 model**. For F\&O contracts the service attempts to resolve a per-expiry synthetic future as the forward and falls back to the underlying quote when a synthetic forward cannot be computed.
* **Implied Volatility** is calculated using Newton-Raphson method
* For **deep ITM** options with no time value, returns theoretical Greeks (delta = ±1)
* **days\_to\_expiry** includes fractional days for accuracy
* `forward_price` bypasses automatic forward resolution. `underlying_symbol` and `underlying_exchange` override automatic underlying lookup.

## Use Cases

* **Position sizing**: Use delta for hedge ratios
* **Risk management**: Monitor gamma exposure
* **Time decay analysis**: Track theta decay
* **Volatility trading**: Monitor vega exposure

***

**Back to**: [API Documentation](/api-documentation/v1.md)
