Skip to main content

Market Connect

Get Option Chain

The Get Option Chain APIs allow you to access the complete list of option scrip codes for a specific underlying instrument. With this scrip code, you can subscribe to real-time data via websocket.

Method: POST

https://connect.thefirstock.com/api/V4/optionChain

Request details

API Parameters
Parameter Description Example
userId
string
Identifier for the user upon login, unique to each user in the system. AA199
exchange
string
Exchange on which the order is placed (e.g., NSE, BSE, NFO, BFO) NFO
tradingSymbol
string
Encoded trading symbol of the security BANKNIFTY28APR22C37400
strikePrice
string
The specified price at which an option contract can be exercised. It is crucial for determining the value and potential profitability of an option. 37400
count
string
Specifies the number of option strike prices to be returned on each side (PUT and CALL) of the mid-price in an options chain. 5
jKey
string
Authentication token obtained from the login API d4180daa72ea70885

Libraries and SDKs

Tabbed Interface
from thefirstock import thefirstock

optionChain = thefirstock.firstock_OptionChain(
            exchange="NFO",
            tradingSymbol="NIFTY21DEC23P21000",
            strikePrice="21000",
            count="5",
            userId="{{userId}}"
)
curl --location --request POST 'https://connect.thefirstock.com/api/V4/optionChain' \
--header 'Content-Type: application/json' \
--data-raw '{
    "userId": "{{userID}}",
    "exchange": "NFO",
    "tradingSymbol": "NIFTY21DEC23P21000",
    "strikePrice": "20000",
    "count": "5",
    "jKey": "{{jKey}}"
}'
const Firstock = require("thefirstock");

const firstock = new Firstock();

firstock.getOptionChain(
  {
    userId: {{userId}},
    tradingSymbol: "NIFTY23FEB23C18000",
    exchange: "NFO",
    strikePrice: "18000",
    count: "5",
  },
  (err, result) => {
    console.log("Error, ", err);
    console.log("Result: ", result);
  }
);
using thefirstock;

class Program
{
    public static void Main()
    {
      Firstock firstock = new Firstock();
      var result = firstock.getOptionChainuserId: {{userId}},(exchange: "NFO",
                                           tradingSymbol: "NIFTY23FEB23C18000",
                                           strikePrice: "18000",
                                           count: "5");
    }
}

Success Response Details

API Parameters
Parameter Description Example
status
String
Market watch success or failure
indication
success
values
String
Array of JSON objects
(object fields below)
["exchange": "NFO", "token": "51909",
"tradingSymbol": "NIFTY19JAN23C20050",
"optionType": "CE", "pricePrecision": "2",
"lotSize": "50", "tickSize": "0.05",
"strikePrice": "20050.00"]

Response Details: Array of Object Values in JSON Fields.

API Parameters
Parameter Description Example
data.requestTime
String
The exact time when the API response was generated and sent, providing a timestamp for the operation. 13:25:51
24-08-2022
values.exchange
String
Indicates the financial exchange where trading activities are conducted. For example, 'NFO' refers to the Futures and Options segment of a particular exchange. NFO
values.tradingSymbol
String
The unique code or symbol assigned to a particular security or derivative contract for trading on the exchange. URL encoding should be used for symbols with special characters. BANKNIFTY28APR22C37400
values.token
String
A specific code or token assigned to the trading instrument for identification within the trading system. 37400
values.strikePrice
String
The specified price at which an option contract can be exercised, key in determining its value and potential profitability. 35500.00
values.pricePrecision
String
The number of decimal places to which the price of the instrument is calculated, defining the smallest price movement. 2
values.tickSize
String
The smallest increment by which the price of a security or contract can move in the market. 0.05
values.lotSize
String
The standard number of units in one trading lot for the security, representing the minimum tradable quantity. 25
API Parameters
{
  "status": "success",
  "data": {
    "requestTime": "13:25:51 24-08-2022""values": [
      {
        "exchange": "NFO",
        "token": "48831",
        "tradingSymbol": "NIFTY19JAN23C20050",
        "optionType": "CE",
        "pricePrecision": "2",
        "lotSize": "25",
        "tickSize": "0.05",
        "strikePrice": "35500.00"
      },
      {
        "exchange": "NFO",
        "token": "48834",
        "tradingSymbol": "NIFTY19JAN23C20050",
        "optionType": "CE",
        "pricePrecision": "2",
        "lotSize": "25",
        "tickSize": "0.05",
        "strikePrice": "35600.00"
      }
    ]
  }
}

Failure response details

API Parameters
Parameter Description Example
status
String
Indicates the result status of the
API operation
failed
code
String
HTTP status code associated with the error 401
name
String
Type of error encountered INVALID_COUNT
error.field
String
Field in the request that triggered
the error
Count
error.message
String
Detailed message describing the error Count parameter is invalid
{
  "status": "failed",
  "code": "401",
  "name": "INVALID_COUNT",
  "error": {
      "field": "Count",
      "message": "Count parameter is invalid"
  }
}