Put-Call Ratio (PCR)โ
API for retrieving the Put-Call Ratio for an underlying asset on a given expiry and date. It accepts the instrument key, expiry, date, and bucket interval, and returns the PCR for the requested date along with spot price insights at each interval.
Requestโ
curl --location 'https://api.upstox.com/v2/market/pcr?instrument_key=NSE_INDEX%7CNifty%2050&expiry=2026-05-29&date=2026-05-07&bucket_interval=60' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'
For additional samples in various languages, please refer to the Sample code section on this page.
Query Parametersโ
| Name | Required | Description |
|---|---|---|
| instrument_key | true | Underlying asset instrument key. For the regex pattern applicable to this field, see the Field Pattern Appendix. |
| expiry | true | Expiry date of the option contract in YYYY-MM-DD format. |
| date | true | Date for which PCR data is required, in YYYY-MM-DD format. |
| bucket_interval | true | Bucket interval in minutes for intraday PCR insights. |
The bucket_interval parameter controls the granularity of the intraday insights array โ it defines the gap in minutes between consecutive data points. For example, bucket_interval=60 returns one data point per hour starting from market open (09:15, 10:15, 11:15, ..., 15:15).
Responses
- 200
- 4XX
Response bodyโ
{
"status": "success",
"data": {
"instrument_key": "NSE_INDEX|Nifty 50",
"expiry_date": "19-05-2026",
"pcr": 0.6162626197672175,
"spot_closing_price": 24044.35,
"insights": [
{
"pcr": 0.6440030253572708,
"spot_price": 23955.0,
"time": "09:15"
},
{
"pcr": 0.6188192668371697,
"spot_price": 23829.65,
"time": "10:15"
},
{
"pcr": 0.6011564491753729,
"spot_price": 23800.0,
"time": "11:15"
},
{
"pcr": 0.6114701925916205,
"spot_price": 23905.75,
"time": "12:15"
},
{
"pcr": 0.6311270125223614,
"spot_price": 23950.65,
"time": "13:15"
},
{
"pcr": 0.6493306043015804,
"spot_price": 24028.5,
"time": "14:15"
},
{
"pcr": 0.652457692695892,
"spot_price": 23988.3,
"time": "15:15"
}
]
}
}
| Name | Type | Description |
|---|---|---|
| status | string | Outcome of the request. Typically success for successful operations. |
| data | object | PCR data object. |
| data.instrument_key | string | Underlying asset instrument key. |
| data.expiry_date | string | Expiry date of the option contract. |
| data.pcr | number | Put-Call Ratio for the requested date (total put OI / total call OI). |
| data.spot_closing_price | number | Closing spot price of the underlying asset. |
| data.insights | array | Intraday PCR data points at the requested bucket interval. |
| data.insights[].pcr | number | PCR at this interval. |
| data.insights[].spot_price | number | Spot price at this interval. |
| data.insights[].time | string | Time of the interval in HH:mm format. |
Error codesโ
| Error code | Description |
|---|---|
| UDAPI100011 | Invalid instrument_key โ The provided instrument_key is invalid or not found. |
| UDAPI1202 | Invalid expiry date format โ The expiry parameter must be in YYYY-MM-DD format. |
| UDAPI1203 | Invalid date format โ The date parameter must be in YYYY-MM-DD format. |
| UDAPI1205 | Invalid bucket_interval โ The bucket_interval value is not accepted. |
Sample Codeโ
Get PCR dataโ
- Curl
- Python
- Node.js
- Java
- PHP
curl --location 'https://api.upstox.com/v2/market/pcr?instrument_key=NSE_INDEX%7CNifty%2050&expiry=2026-05-29&date=2026-05-07&bucket_interval=60' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'
import requests
url = 'https://api.upstox.com/v2/market/pcr'
params = {
'instrument_key': 'NSE_INDEX|Nifty 50',
'expiry': '2026-05-29',
'date': '2026-05-07',
'bucket_interval': 60
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
}
response = requests.get(url, params=params, headers=headers)
print(response.text)
const axios = require('axios');
const url = 'https://api.upstox.com/v2/market/pcr';
const params = {
instrument_key: 'NSE_INDEX|Nifty 50',
expiry: '2026-05-29',
date: '2026-05-07',
bucket_interval: 60
};
const headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
};
axios.get(url, { params, headers })
.then(response => console.log(response.data))
.catch(error => console.error(error));
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String url = "https://api.upstox.com/v2/market/pcr"
+ "?instrument_key=NSE_INDEX%7CNifty%2050"
+ "&expiry=2026-05-29"
+ "&date=2026-05-07"
+ "&bucket_interval=60";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("Authorization", "Bearer {your_access_token}")
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
<?php
$url = 'https://api.upstox.com/v2/market/pcr?'
. http_build_query([
'instrument_key' => 'NSE_INDEX|Nifty 50',
'expiry' => '2026-05-29',
'date' => '2026-05-07',
'bucket_interval' => 60,
]);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Accept: application/json',
'Authorization: Bearer {your_access_token}',
]);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Curl error: ' . curl_error($ch);
}
curl_close($ch);
echo $response;
?>
Loading...