Option Greek Fieldsโ
This API endpoint provides option Greek data for specified instruments. The response contains all fields required to construct an option chain, as well as the current day's total trading volume. This API supports a maximum of 50 instrument keys in a single request.
Requestโ
curl --location 'https://api.upstox.com/v3/market-quote/option-greek?instrument_key=NSE_FO%7C43885' \
--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 | Comma separated list of instrument keys. For the regex pattern applicable to this field, see the Field Pattern Appendix. |
Responses
- 200
- 4XX
Response bodyโ
Name | Type | Description |
---|---|---|
status | string | A string indicating the outcome of the request. Typically success for successful operations. |
data | object | Data object holding option greek information |
data.last_price | number | The last traded price of symbol |
data.instrument_token | string | Key of the instrument. For the regex pattern applicable to this field, see the Field Pattern Appendix. |
data.ltq | number | Last traded quantity |
data.volume | number | Volume traded today till current time |
data.cp | number | Previous day's closing price |
data.iv | number | Implied Volatility |
data.vega | number | Sensitivity of the option's price to changes in volatility. |
data.gamma | number | Rate of change of delta with respect to changes in the underlying asset's price. |
data.theta | number | Rate of decline in the option's value due to the passage of time. |
data.delta | number | Sensitivity of the option's price to changes in the underlying asset's price. |
data.oi | number | Open interest for the instrument. |
Error codesโ
Error code | Description |
---|---|
UDAPI1009 | instrument_key is required - The instrument_key parameter is missing. |
UDAPI1011 | instrument_key is of invalid format - The provided instrument_key does not conform to the accepted format. |
UDAPI1087 | Invalid Instrument key - The provided instrument_key is invalid. |
UDAPI100076 | Maximum instrument key limit exceeded - The request exceeds the maximum number of instrument keys allowed. |
Sample Codeโ
Get Option Greek fieldsโ
- Curl
- Python
- Node.js
- Java
- PHP
- Python SDK
- Node.js SDK
- Java SDK
curl --location 'https://api.upstox.com/v3/market-quote/option-greek?instrument_key=NSE_FO%7C43885' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'
import requests
url = 'https://api.upstox.com/v3/market-quote/option-greek?instrument_key=NSE_FO%7C43885'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
}
response = requests.get(url, headers=headers)
print(response.text)
const axios = require('axios');
const url = 'https://api.upstox.com/v3/market-quote/option-greek?instrument_key=NSE_FO%7C43885';
const headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
};
axios.get(url, { 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;
import java.net.http.HttpHeaders;
public class Main {
public static void main(String[] args) throws Exception {
String url = "https://api.upstox.com/v3/market-quote/option-greek?instrument_key=NSE_FO%7C43885";
String contentTypeHeader = "application/json";
String acceptHeader = "application/json";
String authorizationHeader = "Bearer {your_access_token}";
HttpClient httpClient = HttpClient.newHttpClient();
HttpRequest httpRequest = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", contentTypeHeader)
.header("Accept", acceptHeader)
.header("Authorization", authorizationHeader)
.build();
HttpResponse<String> response = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
int statusCode = response.statusCode();
HttpHeaders headers = response.headers();
String responseBody = response.body();
System.out.println("Status Code: " + statusCode);
System.out.println("Response Headers: " + headers);
System.out.println("Response Body: " + responseBody);
}
}
<?php
$url = 'https://api.upstox.com/v3/market-quote/option-greek?instrument_key=NSE_FO%7C43885';
$contentTypeHeader = 'application/json';
$acceptHeader = 'application/json';
$authorizationHeader = 'Bearer {your_access_token}';
$ch = curl_init($url);
// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: ' . $contentTypeHeader,
'Accept: ' . $acceptHeader,
'Authorization: ' . $authorizationHeader,
]);
// Execute cURL session and get the response
$response = curl_exec($ch);
// Check for cURL errors
if (curl_errno($ch)) {
echo 'Curl error: ' . curl_error($ch);
}
// Close cURL session
curl_close($ch);
// Output the response
echo $response;
?>
import upstox_client
from upstox_client.rest import ApiException
configuration = upstox_client.Configuration()
configuration.access_token = '{your_access_token}'
apiInstance = upstox_client.MarketQuoteV3Api(upstox_client.ApiClient(configuration))
try:
# For a single instrument
response = apiInstance.get_market_quote_option_greek(instrument_key="NSE_FO|43885")
print(response)
except ApiException as e:
print("Exception when calling MarketQuoteV3Api->get_market_quote_option_greek: %s\n" % e)
let UpstoxClient = require('upstox-js-sdk');
let defaultClient = UpstoxClient.ApiClient.instance;
var OAUTH2 = defaultClient.authentications['OAUTH2'];
OAUTH2.accessToken = "{your_access_token}";
let marketQuoteApiInstance = new UpstoxClient.MarketQuoteV3Api();
marketQuoteApiInstance.getMarketQuoteOptionGreek({instrumentKey: "NSE_FO|43885"}, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}
});
import com.upstox.ApiClient;
import com.upstox.ApiException;
import com.upstox.Configuration;
import com.upstox.api.MarketQuoteV3Api;
import com.upstox.model.GetMarketQuoteOptionGreekResponseV3;
import com.upstox.auth.*;
public class Main {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2");
OAUTH2.setAccessToken("{your_access_token}");
MarketQuoteV3Api marketQuoteV3Api = new MarketQuoteV3Api();
try {
GetMarketQuoteOptionGreekResponseV3 response = marketQuoteV3Api.getMarketQuoteOptionGreek("NSE_FO|43885");
System.out.println(response);
} catch (ApiException e) {
System.err.println("Exception when calling MarketQuoteV3Api#getMarketQuoteOptionGreek");
e.printStackTrace();
}
}
}
Get Option Greek fields for multiple instruments keysโ
- Curl
- Python
- Node.js
- Java
- PHP
- Python SDK
- Node.js SDK
- Java SDK
curl --location 'https://api.upstox.com/v3/market-quote/option-greek?instrument_key=NSE_FO%7C43885,NSE_FO|43886' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'
import requests
url = 'https://api.upstox.com/v3/market-quote/option-greek?instrument_key=NSE_FO%7C43885,NSE_FO|43886'
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
}
response = requests.get(url, headers=headers)
print(response.text)
const axios = require('axios');
const url = 'https://api.upstox.com/v3/market-quote/option-greek?instrument_key=NSE_FO%7C43885,NSE_FO|43886';
const headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
};
axios.get(url, { 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;
import java.net.http.HttpHeaders;
public class Main {
public static void main(String[] args) throws Exception {
String url = "https://api.upstox.com/v3/market-quote/option-greek?instrument_key=NSE_FO%7C43885,NSE_FO|43886";
String contentTypeHeader = "application/json";
String acceptHeader = "application/json";
String authorizationHeader = "Bearer {your_access_token}";
HttpClient httpClient = HttpClient.newHttpClient();
HttpRequest httpRequest = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", contentTypeHeader)
.header("Accept", acceptHeader)
.header("Authorization", authorizationHeader)
.build();
HttpResponse<String> response = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
int statusCode = response.statusCode();
HttpHeaders headers = response.headers();
String responseBody = response.body();
System.out.println("Status Code: " + statusCode);
System.out.println("Response Headers: " + headers);
System.out.println("Response Body: " + responseBody);
}
}
<?php
$url = 'https://api.upstox.com/v3/market-quote/option-greek?instrument_key=NSE_FO%7C43885,NSE_FO|43886';
$contentTypeHeader = 'application/json';
$acceptHeader = 'application/json';
$authorizationHeader = 'Bearer {your_access_token}';
$ch = curl_init($url);
// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: ' . $contentTypeHeader,
'Accept: ' . $acceptHeader,
'Authorization: ' . $authorizationHeader,
]);
// Execute cURL session and get the response
$response = curl_exec($ch);
// Check for cURL errors
if (curl_errno($ch)) {
echo 'Curl error: ' . curl_error($ch);
}
// Close cURL session
curl_close($ch);
// Output the response
echo $response;
?>
import upstox_client
from upstox_client.rest import ApiException
configuration = upstox_client.Configuration()
configuration.access_token = '{your_access_token}'
apiInstance = upstox_client.MarketQuoteV3Api(upstox_client.ApiClient(configuration))
try:
# For multiple instruments
response = apiInstance.get_market_quote_option_greek(instrument_key="NSE_FO|38604,NSE_FO|49210")
print(response)
except ApiException as e:
print("Exception when calling MarketQuoteV3Api->get_market_quote_option_greek: %s\n" % e)
let UpstoxClient = require('upstox-js-sdk');
let defaultClient = UpstoxClient.ApiClient.instance;
var OAUTH2 = defaultClient.authentications['OAUTH2'];
OAUTH2.accessToken = "{your_access_token}";
let marketQuoteApiInstance = new UpstoxClient.MarketQuoteV3Api();
marketQuoteApiInstance.getMarketQuoteOptionGreek({instrumentKey: "NSE_FO|38604,NSE_FO|49210"}, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}
});
import com.upstox.ApiClient;
import com.upstox.ApiException;
import com.upstox.Configuration;
import com.upstox.api.MarketQuoteV3Api;
import com.upstox.model.GetMarketQuoteOptionGreekResponseV3;
import com.upstox.auth.*;
public class Main {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2");
OAUTH2.setAccessToken("{your_access_token}");
MarketQuoteV3Api marketQuoteV3Api = new MarketQuoteV3Api();
try {
GetMarketQuoteOptionGreekResponseV3 response = marketQuoteV3Api.getMarketQuoteOptionGreek("NSE_FO|38604,NSE_FO|49210");
System.out.println(response);
} catch (ApiException e) {
System.err.println("Exception when calling MarketQuoteV3Api#getMarketQuoteOptionGreek");
e.printStackTrace();
}
}
}
Loading...