> 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/orders-api/optionsorder.md).

# OptionsOrder

Place an options order by specifying offset (ATM/ITM/OTM) instead of exact strike price. The API automatically resolves the correct option symbol based on the current underlying price.

## Endpoint URL

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

## Sample API Request (ATM Option)

```json
{
  "apikey": "<your_app_apikey>",
  "strategy": "python",
  "underlying": "NIFTY",
  "exchange": "NSE_INDEX",
  "expiry_date": "28OCT25",
  "offset": "ATM",
  "option_type": "CE",
  "action": "BUY",
  "quantity": "65",
  "pricetype": "MARKET",
  "product": "NRML",
  "splitsize": "0"
}
```

## Sample cURL Request

```bash
curl -X POST http://127.0.0.1:5000/api/v1/optionsorder \
  -H 'Content-Type: application/json' \
  -d '{
  "apikey": "<your_app_apikey>",
  "strategy": "python",
  "underlying": "NIFTY",
  "exchange": "NSE_INDEX",
  "expiry_date": "28OCT25",
  "offset": "ATM",
  "option_type": "CE",
  "action": "BUY",
  "quantity": "65",
  "pricetype": "MARKET",
  "product": "NRML",
  "splitsize": "0"
}'
```

## Sample API Response (ATM Option)

```json
{
  "exchange": "NFO",
  "offset": "ATM",
  "option_type": "CE",
  "orderid": "25102800000006",
  "status": "success",
  "symbol": "NIFTY28OCT2525950CE",
  "underlying": "NIFTY28OCT25FUT",
  "underlying_ltp": 25966.05
}
```

## Sample API Request (ITM Option)

```json
{
  "apikey": "<your_app_apikey>",
  "strategy": "python",
  "underlying": "NIFTY",
  "exchange": "NSE_INDEX",
  "expiry_date": "28OCT25",
  "offset": "ITM4",
  "option_type": "PE",
  "action": "BUY",
  "quantity": "65",
  "pricetype": "MARKET",
  "product": "NRML",
  "splitsize": "0"
}
```

## Sample API Response (ITM Option)

```json
{
  "exchange": "NFO",
  "offset": "ITM4",
  "option_type": "PE",
  "orderid": "25102800000007",
  "status": "success",
  "symbol": "NIFTY28OCT2526150PE",
  "underlying": "NIFTY28OCT25FUT",
  "underlying_ltp": 25966.05
}
```

## Sample API Request (OTM Option)

```json
{
  "apikey": "<your_app_apikey>",
  "strategy": "python",
  "underlying": "NIFTY",
  "exchange": "NSE_INDEX",
  "expiry_date": "28OCT25",
  "offset": "OTM5",
  "option_type": "CE",
  "action": "BUY",
  "quantity": "65",
  "pricetype": "MARKET",
  "product": "NRML",
  "splitsize": "0"
}
```

## Offset Values

| Offset        | Description                                    |
| ------------- | ---------------------------------------------- |
| ATM           | At-The-Money (strike closest to current price) |
| ITM1 to ITM50 | In-The-Money (1-50 strikes away)               |
| OTM1 to OTM50 | Out-of-The-Money (1-50 strikes away)           |

### Understanding ITM/OTM for CE and PE

| Option Type | ITM Direction  | OTM Direction  |
| ----------- | -------------- | -------------- |
| CE (Call)   | Lower strikes  | Higher strikes |
| PE (Put)    | Higher strikes | Lower strikes  |

## 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       | Exchange: NSE\_INDEX, BSE\_INDEX, NFO, BFO    | Mandatory          | -                                         |
| expiry\_date   | Expiry date in DDMMMYY format (e.g., 30JUL26) | Optional           | Derived when `underlying` includes expiry |
| offset         | Strike offset: ATM, ITM1-ITM50, OTM1-OTM50    | Mandatory          | -                                         |
| option\_type   | Option type: CE or PE                         | Mandatory          | -                                         |
| action         | Order action: BUY or SELL                     | Mandatory          | -                                         |
| quantity       | Order quantity                                | Mandatory          | -                                         |
| pricetype      | Price type: MARKET, LIMIT, SL, SL-M           | Optional           | MARKET                                    |
| product        | Product type: MIS or NRML                     | Optional           | MIS                                       |
| splitsize      | Split order into chunks (0 = no split)        | Optional           | 0                                         |
| price          | Limit price (for LIMIT orders)                | Optional           | 0                                         |
| trigger\_price | Trigger price (for SL orders)                 | Optional           | 0                                         |

## Response Fields

| Field           | Type   | Description                                        |
| --------------- | ------ | -------------------------------------------------- |
| status          | string | "success" or "error"                               |
| orderid         | string | Unique order ID from broker                        |
| symbol          | string | Resolved option symbol                             |
| exchange        | string | Exchange where order was placed (NFO/BFO)          |
| offset          | string | Offset used for resolution                         |
| option\_type    | string | CE or PE                                           |
| underlying      | string | Underlying futures symbol used for price reference |
| underlying\_ltp | number | Last traded price of underlying                    |
| mode            | string | "live" or "analyze"                                |

## Notes

* The **underlying** is used to fetch the current price for ATM calculation
* For **NSE\_INDEX** or **BSE\_INDEX** exchange, the order is placed on NFO/BFO respectively
* The **expiry\_date** must be in DDMMMYY format (e.g., 28OCT25, 25NOV25)
* Use **splitsize** to break large orders into smaller chunks (max 100 orders per split)
* The API uses the synthetic futures price or spot price to determine ATM strike
* Quantity is a positive integer. Offset is validated from `ATM`, `ITM1`-`ITM50`, or `OTM1`-`OTM50`.

***

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