kindly please let us know how to get option chain for Nifty/Bannifty using python api.
Hi @196779,
Welcome to the Upstox community!
The feature of option chain data via API is not available at the moment.
But we have noted down your suggestion and passed it on to the concerned team. Thanks!
Is this available now?
OK, Thanks for response, can you tell me tentative time to roll- out this feature . as i have seen many of broker already providing this, As we are upstox old customer of upstox we also need this feature in upstox ASAP. Delay may cause churn the customers.
Thank you, @Gaurav_Singh_Yadav for being a Upstox customer. We understand the significance of your requested feature and this is already on consideration for implementation. We will update you with a provisional timeline as soon as possible. Your patience is greatly appreciated.
OK Mr. Pradeep, Keep Posting us regarding updates, Thanksā¦
Is this available now???
This is picked up and currently in the development pipeline and will be available by mid-February 2024. We sincerely appreciate your patience.
Sir facility to fetch option chain in Excel or Google sheet is now available if yes then how to use it
The Option Chain API is scheduled for release and is currently in QA testing. It will be available soon, and the relevant documentation will be updated accordingly.
@Dewanshi_Ramani @Gaurav_Singh_Yadav Weāve launched our Option Chain APIās, which is comprised of two sections:
We welcome you to test them out and share your feedback.
There is a bug in the Put/Call Option Chain endpoint. In documentation the expected output is
{
"status": "success",
"data": [
{
"expiry": "2024-02-15",
"pcr": 1684.0638,
"strike_price": 19500,
"underlying_key": "NSE_INDEX|Nifty 50",
"underlying_spot_price": 22122.25,
"call_options": {
"instrument_key": "NSE_FO|37263",
"market_data": {
"ltp": 2291.8,
"close_price": 2259.9,
"volume": 1200,
"oi": 2350,
"bid_price": 2292.85,
"bid_qty": 50,
"ask_price": 2302.25,
"ask_qty": 800,
"prev_oi": 0
},
"option_greeks": {
"vega": 0,
"theta": 0,
"gamma": 0,
"delta": 1,
"iv": 0
}
},
"put_options": {
"instrument_key": "NSE_FO|37264",
"market_data": {
"ltp": 0.7,
"close_price": 1.5,
"volume": 12367100,
"oi": 3957550,
"bid_price": 0.65,
"bid_qty": 382600,
"ask_price": 0.7,
"ask_qty": 88300,
"prev_oi": 14400
},
"option_greeks": {
"vega": 0.2278,
"theta": -0.5966,
"gamma": 0,
"delta": -0.0026,
"iv": 31.43
}
}
}
]
}
where as the while using the endpoint I am getting the output of the smart contract endpoint.
{
"status": "success",
"data": [
{
"name": "NIFTY",
"segment": "NSE_FO",
"exchange": "NSE",
"expiry": "2024-02-22",
"weekly": true,
"instrument_key": "NSE_FO|35549",
"exchange_token": "35549",
"trading_symbol": "NIFTY 19800 PE 22 FEB 24",
"tick_size": 5.0,
"lot_size": 50,
"instrument_type": "PE",
"freeze_quantity": 1800.0,
"underlying_key": "NSE_INDEX|Nifty 50",
"underlying_type": "INDEX",
"underlying_symbol": "NIFTY",
"strike_price": 19800.0,
"minimum_lot": 50
},
{
"name": "NIFTY",
"segment": "NSE_FO",
"exchange": "NSE",
"expiry": "2024-02-22",
"weekly": true,
"instrument_key": "NSE_FO|35558",
"exchange_token": "35558",
"trading_symbol": "NIFTY 20050 CE 22 FEB 24",
"tick_size": 5.0,
"lot_size": 50,
"instrument_type": "CE",
"freeze_quantity": 1800.0,
"underlying_key": "NSE_INDEX|Nifty 50",
"underlying_type": "INDEX",
"underlying_symbol": "NIFTY",
"strike_price": 20050.0,
"minimum_lot": 50
},
{
"name": "NIFTY",
"segment": "NSE_FO",
"exchange": "NSE",
"expiry": "2024-02-22",
"weekly": true,
"instrument_key": "NSE_FO|35602",
"exchange_token": "35602",
"trading_symbol": "NIFTY 20500 CE 22 FEB 24",
"tick_size": 5.0,
"lot_size": 50,
"instrument_type": "CE",
"freeze_quantity": 1800.0,
"underlying_key": "NSE_INDEX|Nifty 50",
"underlying_type": "INDEX",
"underlying_symbol": "NIFTY",
"strike_price": 20500.0,
"minimum_lot": 50
},
{
"name": "NIFTY",
"segment": "NSE_FO",
"exchange": "NSE",
"expiry": "2024-02-22",
"weekly": true,
"instrument_key": "NSE_FO|35616",
"exchange_token": "35616",
"trading_symbol": "NIFTY 20800 CE 22 FEB 24",
"tick_size": 5.0,
"lot_size": 50,
"instrument_type": "CE",
"freeze_quantity": 1800.0,
"underlying_key": "NSE_INDEX|Nifty 50",
"underlying_type": "INDEX",
"underlying_symbol": "NIFTY",
"strike_price": 20800.0,
"minimum_lot": 50
},
{
"name": "NIFTY",
"segment": "NSE_FO",
"exchange": "NSE",
"expiry": "2024-02-22",
"weekly": true,
"instrument_key": "NSE_FO|35619",
"exchange_token": "35619",
"trading_symbol": "NIFTY 20850 PE 22 FEB 24",
"tick_size": 5.0,
"lot_size": 50,
"instrument_type": "PE",
"freeze_quantity": 1800.0,
"underlying_key": "NSE_INDEX|Nifty 50",
"underlying_type": "INDEX",
"underlying_symbol": "NIFTY",
"strike_price": 20850.0,
"minimum_lot": 50
},
]
Either the proper endpoint is missing in the documentation or there is some sort of bug.
I reffered below documentation
Put/Call Api
@rushi1192 The problem has been fixed and the document has been updated. Please try again and let me know if the issue persists.
Got it now. Thanks for the help.
why dont you guys make some videos about all the new option chain documents @Pradeep_Jaiswar
@Davinci_Code, we appreciate your input. Videos series are in the pipeline, and we will inform clients as soon as they begin to roll out.
url = āhttps://api.upstox.com/v2/option/chain/NSE_INDEX|Nifty 50/2024-02-29ā
headers = {āacceptā: āapplication/jsonā, āAuthorizationā: fāBearer {token}'}
{āstatusā: āerrorā, āerrorsā: [{āerrorCodeā: āUDAPI100060ā, āmessageā: āResource not Found.ā, āpropertyPathā: None, āinvalidValueā: None, āerror_codeā: āUDAPI100060ā, āproperty_pathā: None, āinvalid_valueā: None}]}
please helpā¦
**need help :::: **
how did you get the option chain . provide the template in python . it would be great help. thanks
import requests
url = āhttps://api.upstox.com/v2/option/chainā
payload={}
headers = {
āAcceptā: āapplication/jsonā
}
response = requests.request(āGETā, url, headers=headers, data=payload)
print(response.text)
With this request . I am not able to get any option chain data ,
I tried this :
import requests
url = āhttps://api.upstox.com/v2/option/contractā
payload= {
āinstrument_keyā: āNSE_FO|Nifty 50ā,
āexpiry_dateā: ā2024-02-29ā # format YYYY-MM-DD
}
headers = {
āContent-Typeā: āapplication/jsonā,
āAcceptā: āapplication/jsonā,
āAuthorizationā: fāBearer {access_token}ā
}
response = requests.request(āGETā, url, headers=headers, data=payload)
print(response.text)
But the output :
{āstatusā:āerrorā,āerrorsā:[{āerrorCodeā:āUDAPI100060ā,āmessageā:āResource not Found.ā,āpropertyPathā:null,āinvalidValueā:null,āerror_codeā:āUDAPI100060ā,āproperty_pathā:null,āinvalid_valueā:null}]}
why is that @Pradeep_Jaiswar