Skip to content

Get Option Chain

The Get Option Chain APIs enable you to find all option scrip code for the under laying instrument.

using scrip code you can subscribe for websocket data


POST: /apiV2/optionChain

https://connect.thefirstock.com/apiV2/optionChain

Request Details

Parameter Description
userId User Id of the login user
exchange Exchange - NFO
tradingSymbol Trading Symbol (use url encoding to avoid special char error for symbols like M&M) NSE NFO.
strikePrice Mid price for option chain selection
count Number of strike to return on one side of the mid price for PUT and CALL. (example cnt is 4, total 16 contracts will be returned, if cnt is is 5 total 20 contract will be returned)
jKey Key Obtained on login success.

Code

 curl -X POST 'https://connect.thefirstock.com/apiV2/optionChain' \
    -H 'Content-Type: application/json' \
    -d '{
        "userId": "",
        "jKey": "",
        "exchange": "",
        "tradingSymbol": "",
        "strikePrice": "",
        "count": ""
    }'
from thefirstock import thefirstock

optionChain = thefirstock.firstock_OptionChain(
                exchange="",
                tradingSymbol="",
                strikePrice="",
                count=""
            )
 const Firstock = require('thefirstock');

 const firstock = new Firstock();

 firstock.getOptionChain({
    tradingSymbol: "",
    exchange: "",
    strikePrice: "",
    count: ""
 }, (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.getOptionChain(exchange: "NFO", tradingSymbol: "BANKNIFTY28APR22C37400", strikePrice: "37400", count: "5");
}
}

Response Success Details

Response data will be in json format with below fields.

Parameter Description
status Market watch success or failure indication.
values Array of json objects. (object fields given in below table)

Response Details: Json Fields of object in values Array

Parameter Description
values.exchange NFO
values.tradingSymbol Trading symbol of the scrip (contract)
values.token Token of the scrip (contract)
values.optionType Option Type
values.strikePrice Strike price
values.pricePrecision Price precision
values.tickSize Tick size
values.lotSize Lot size

Sample Response

{
    "Status": "Success",
    "data":{
            "requestTime": "13:25:51 24-08-2022"
            "values": [
                        {
                          "exchange": "NFO",
                          "token": "48831",
                          "tradingSymbol": "",
                          "optionType": "CE",
                          "pricePrecision": "2",
                          "lotSize": "25",
                          "tickSize": "0.05",
                          "strikePrice": "35500.00"
                        },
                        {
                          "exchange": "NFO",
                          "token": "48834",
                          "tradingSymbol": "",
                          "optionType": "CE",
                          "pricePrecision": "2",
                          "lotSize": "25",
                          "tickSize": "0.05",
                          "strikePrice": "35600.00"
                        }
                    ]
                }
            }
{
  "Status": "Failed",
  "data": "Session Expired :  Invalid Session Key"
}