All URIs are relative to https://api-v2.upstox.com
Method | HTTP request | Description |
---|---|---|
getOptionContracts | GET /v2/option/contract | Get option contracts |
getPutCallOptionChain | GET /v2/option/chain | Get option chain |
GetOptionContractResponse getOptionContracts(instrumentKey, expiryDate)
Get option contracts
This API provides the functionality to retrieve the option contracts
// Import classes:
//import com.upstox.ApiClient;
//import com.upstox.ApiException;
//import com.upstox.Configuration;
//import com.upstox.auth.*;
//import io.swagger.client.api.OptionsApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure OAuth2 access token for authorization: OAUTH2
OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2");
OAUTH2.setAccessToken("YOUR ACCESS TOKEN");
OptionsApi apiInstance = new OptionsApi();
String instrumentKey = "instrumentKey_example"; // String | Instrument key for an underlying symbol
String expiryDate = "expiryDate_example"; // String | Expiry date in format: YYYY-mm-dd
try {
GetOptionContractResponse result = apiInstance.getOptionContracts(instrumentKey, expiryDate);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling OptionsApi#getOptionContracts");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
instrumentKey | String | Instrument key for an underlying symbol | |
expiryDate | String | Expiry date in format: YYYY-mm-dd | [optional] |
GetOptionChainResponse getPutCallOptionChain(instrumentKey, expiryDate)
Get option chain
This API provides the functionality to retrieve the option chain
// Import classes:
//import com.upstox.ApiClient;
//import com.upstox.ApiException;
//import com.upstox.Configuration;
//import com.upstox.auth.*;
//import io.swagger.client.api.OptionsApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure OAuth2 access token for authorization: OAUTH2
OAuth OAUTH2 = (OAuth) defaultClient.getAuthentication("OAUTH2");
OAUTH2.setAccessToken("YOUR ACCESS TOKEN");
OptionsApi apiInstance = new OptionsApi();
String instrumentKey = "instrumentKey_example"; // String | Instrument key for an underlying symbol
String expiryDate = "expiryDate_example"; // String | Expiry date in format: YYYY-mm-dd
try {
GetOptionChainResponse result = apiInstance.getPutCallOptionChain(instrumentKey, expiryDate);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling OptionsApi#getPutCallOptionChain");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
instrumentKey | String | Instrument key for an underlying symbol | |
expiryDate | String | Expiry date in format: YYYY-mm-dd |