I want live data for option chain in nifty 50,
lets say “nifty 22450 04 April 24”
what is the instrument key for that.
i’m unable to find that in Instruments | Upstox Developer API
@Praveen_Reddy The Instrument key for “Nifty 22450 4th April 24” option is NSE_FO|45781
.
This key is available in both CSV and JSON instrument file for NSE
.
{
"weekly": true,
"segment": "NSE_FO",
"name": "NIFTY",
"exchange": "NSE",
"expiry": 1712255399000,
"instrument_type": "CE",
"asset_symbol": "NIFTY",
"underlying_symbol": "NIFTY",
"instrument_key": "NSE_FO|45781",
"lot_size": 50,
"freeze_quantity": 1800,
"exchange_token": "45781",
"minimum_lot": 50,
"asset_key": "NSE_INDEX|Nifty 50",
"underlying_key": "NSE_INDEX|Nifty 50",
"tick_size": 5,
"asset_type": "INDEX",
"underlying_type": "INDEX",
"trading_symbol": "NIFTY 22450 CE 04 APR 24",
"strike_price": 22450
}
For further information on Put/Call option chains, please refer to the API documentation provided at the following link
You can retrieve the option chain for the underlying symbol Nifty 50 index with an expiry date of 2024-04-04 using the following cURL request:
curl -X 'GET' \
'https://api.upstox.com/v2/option/chain?instrument_key=NSE_INDEX%7CNifty%2050&expiry_date=2024-04-04' \
-H 'accept: application/json' \
-H 'Authorization: Bearer {access_token}'
Do let us know if this addresses your question
Thanks
thanks for your reply Anand , it was in complete.json i got that now,
and one more thing i cannot found the expired options ,
is it unavilable ?
let say i want NIFTY 20350 CE 15 FEB 24
i tried in my code but i did’t found that item in complete.json.
const completeData = require('./complete.json')
function getInstrumentKey(tradingSymbol, data) {
for (const item of data) {
if (item.trading_symbol === tradingSymbol) {
return item.instrument_key;
}
}
return null;
}
const tradingSymbolToFind = "NIFTY 20350 CE 15 FEB 24";
// Get instrument key
const instrumentKey = getInstrumentKey(tradingSymbolToFind, completeData);
if (instrumentKey) {
console.log("Instrument Key found:", instrumentKey);
} else {
console.log("Instrument Key not found for the provided trading symbol.");
}
@Praveen_Reddy Yes, at the moment, expired options are unavailable. Please inform us about your use-case, we will escalate it to the appropriate team for further consideration.
Thanks
use case is for backtesting my strategies ,
i wanna test my logic on the day of expire and day before of that.
thanks,
praveen