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/V3/optionChain
Request details
Parameter | Description | Data types | Example |
---|---|---|---|
userId | User Id of the login user | String | "AA199" |
exchange | Exchange - NFO | String | "NFO" |
tradingSymbol | Trading Symbol (use url encoding to avoid special char error for symbols like M&M) NSE NFO. | String | "BANKNIFTY28APR22C37400" |
strikePrice | Mid price for option chain selection | String | "37400" |
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) | String | "5" |
jKey | Key Obtained on login success. | String | "d4180daa72ea70885ab0 d0fb38f0fa5796352b57d e0641d4442294b87f2b7315" |
- cURL
curl -X POST 'https://connect.thefirstock.com/api/V3/optionChain'
-H 'Content-Type: application/json'
-d '{
"userId": "AA123",
"jKey": "e6a211bea63adff386578988e1cf4a9521c4744e6a39ad63174c8797e2af8c38",
"exchange": "NFO",
"tradingSymbol": "NIFTY23FEB23C18000",
"strikePrice": "18000",
"count": "5"
}'
from thefirstock import thefirstock
optionChain = thefirstock.firstock_OptionChain(
exchange="NFO",
tradingSymbol="NIFTY23FEB23C18000",
strikePrice="18000",
count="5"
)
const Firstock = require("thefirstock");
const firstock = new Firstock();
firstock.getOptionChain(
{
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.getOptionChain(exchange: "NFO",
tradingSymbol: "NIFTY23FEB23C18000",
strikePrice: "18000",
count: "5");
}
}
Response Success Details
Parameter | Description | Data types | Examples |
---|---|---|---|
status | Market watch success or failure indication. | String | "Success" |
values | Array of json objects. (object fields given in below table) | String | ["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.
Parameter | Description | Data Type | Example |
---|---|---|---|
data.requestTime | Response received time | String | "13:25:51 24-08-2022" |
values.exchange | NFO | String | "NFO" |
values.tradingSymbol | Trading symbol of the scrip (contract) | String | "NIFTY19JAN23C20050" |
values.token | Token of the scrip (contract) | String | "48831" |
values.optionType | Option Type | String | "CE" |
values.strikePrice | Strike price | String | "35500.00" |
values.pricePrecision | Price precision | String | "2" |
values.tickSize | Tick size | String | "0.05" |
values.lotSize | Lot size | String | "25" |
Failure response details
Parameter | Description | Data Type | Example |
---|---|---|---|
status | Failed | String | "Failed" |
code | HTTP Code | String | "401" |
name | Type of error | String | "INVALID_COUNT" |
error.field | Error field | String | "Count" |
error.message | Error message | String | "Count parameter is invalid" |
Sample response
- Success response
- Failure response
{
"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"
}
]
}
}
{
"status": "Failed",
"code": "401",
"name": "INVALID_COUNT",
"error": {
"field": "Count",
"message": "Count parameter is invalid"
}
}