I want to know if Upstox is providing API for Lot prices and Lot size for option contracts a prompt response here would be appreciated many thanks.
@naman_sawhney Yes, kindly review the API details here.
For example codes, visit Option Contracts | Upstox Developer API
Example response
{
"status": "success",
"data": [
{
"name": "NIFTY",
"segment": "NSE_FO",
"exchange": "NSE",
"expiry": "2024-09-05",
"weekly": true,
"instrument_key": "NSE_FO|38501",
"exchange_token": "38501",
"trading_symbol": "NIFTY 22500 CE 05 SEP 24",
"tick_size": 5,
"lot_size": 25,
"instrument_type": "CE",
"freeze_quantity": 1800,
"underlying_key": "NSE_INDEX|Nifty 50",
"underlying_type": "INDEX",
"underlying_symbol": "NIFTY",
"strike_price": 22500,
"minimum_lot": 25
}
]
}
Thanks!
hi @Anand_Sajankar thanks for the prompt response here however I still have one major issue which are the lot prices I am able to successfully fetch everything and I am sharing the part response with you to double check from your end as well. Again your help would be highly appreciated and i genuinely appreciate you taking your time to address my concerns promptly.
2024-09-23 11:17:26,731 - INFO - Found 65 option contracts for SBIN
2024-09-23 11:17:26,731 - DEBUG - First contract: {‘name’: ‘STATE BANK OF INDIA’, ‘segment’: ‘NSE_FO’, ‘exchange’: ‘NSE’, ‘expiry’: ‘2024-09-26’, ‘weekly’: False, ‘instrument_key’: ‘NSE_FO|98826’, ‘exchange_token’: ‘98826’, ‘trading_symbol’: ‘SBIN 690 CE 26 SEP 24’, ‘tick_size’: 5.0, ‘lot_size’: 750, ‘instrument_type’: ‘CE’, ‘freeze_quantity’: 30000.0, ‘underlying_key’: ‘NSE_EQ|INE062A01020’, ‘underlying_type’: ‘EQUITY’, ‘underlying_symbol’: ‘SBIN’, ‘strike_price’: 690.0, ‘minimum_lot’: 750}
2024-09-23 11:17:26,731 - DEBUG - First few instrument keys: [‘NSE_FO|98826’, ‘NSE_FO|98851’, ‘NSE_FO|98825’, ‘NSE_FO|98827’, ‘NSE_FO|98828’]
2024-09-23 11:17:26,731 - DEBUG - Starting new HTTPS connection (1): api.upstox.com:443
2024-09-23 11:17:27,303 - DEBUG - https://api.upstox.com:443 “GET /v2/market-quote/quotes?instrument_key=NSE_FO%7C98826%2CNSE_FO%7C98851%2CNSE_FO%7C98825%2CNSE_FO%7C98827%2CNSE_FO%7C98828%2CNSE_FO%7C98829%2CNSE_FO%7C98831%2CNSE_FO%7C98833%2CNSE_FO%7C98834%2CNSE_FO%7C98839%2CNSE_FO%7C98841%2CNSE_FO%7C98844%2CNSE_FO%7C98846%2CNSE_FO%7C98848%2CNSE_FO%7C98852%2CNSE_FO%7C98853%2CNSE_FO%7C98855%2CNSE_FO%7C98856%2CNSE_FO%7C98857%2CNSE_FO%7C98858%2CNSE_FO%7C98830%2CNSE_FO%7C98838%2CNSE_FO%7C98840%2CNSE_FO%7C98843%2CNSE_FO%7C98845%2CNSE_FO%7C98847%2CNSE_FO%7C98849%2CNSE_FO%7C98824%2CNSE_FO%7C98842%2CNSE_FO%7C152257%2CNSE_FO%7C152258%2CNSE_FO%7C152259%2CNSE_FO%7C152265%2CNSE_FO%7C152267%2CNSE_FO%7C152269%2CNSE_FO%7C152270%2CNSE_FO%7C152272%2CNSE_FO%7C152273%2CNSE_FO%7C152275%2CNSE_FO%7C152276%2CNSE_FO%7C152278%2CNSE_FO%7C152279%2CNSE_FO%7C152281%2CNSE_FO%7C152282%2CNSE_FO%7C152287%2CNSE_FO%7C152289%2CNSE_FO%7C152293%2CNSE_FO%7C152260%2CNSE_FO%7C152261%2CNSE_FO%7C152262%2CNSE_FO%7C152263%2CNSE_FO%7C152264%2CNSE_FO%7C152266%2CNSE_FO%7C152268%2CNSE_FO%7C152271%2CNSE_FO%7C152274%2CNSE_FO%7C152277%2CNSE_FO%7C152280%2CNSE_FO%7C152283%2CNSE_FO%7C152284%2CNSE_FO%7C152285%2CNSE_FO%7C152286%2CNSE_FO%7C152288%2CNSE_FO%7C152291%2CNSE_FO%7C152294 HTTP/1.1” 200 None
2024-09-23 11:17:27,310 - DEBUG - Option chain API response: {‘status’: ‘success’, ‘data’: {‘NSE_FO:SBIN24SEP950CE’: {‘ohlc’: {‘open’: 0.3, ‘high’: 0.3, ‘low’: 0.1, ‘close’: 0.15}, ‘depth’: {‘buy’: [{‘quantity’: 88500, ‘price’: 0.1, ‘orders’: 15}, {‘quantity’: 105750, ‘price’: 0.05, ‘orders’: 19}, {‘quantity’: 0, ‘price’: 0.0, ‘orders’: 0}, {‘quantity’: 0, ‘price’: 0.0, ‘orders’: 0}, {‘quantity’: 0, ‘price’: 0.0, ‘orders’: 0}], ‘sell’: [{‘quantity’: 5250, ‘price’: 0.15, ‘orders’: 2}, {‘quantity’: 41250, ‘price’: 0.2, ‘orders’: 6}, {‘quantity’: 9750, ‘price’: 0.25, ‘orders’: 3}, {‘quantity’: 34500, ‘price’: 0.3, ‘orders’: 4}, {‘quantity’: 2250, ‘price’: 0.35, ‘orders’: 2}]}, ‘timestamp’: ‘2024-09-23T11:17:16.923+05:30’, ‘instrument_token’: ‘NSE_FO|98857’, ‘symbol’: ‘SBIN24SEP950CE’, ‘last_price’: 0.15, ‘volume’: 65250, ‘average_price’: 0.13, ‘oi’: 232500.0, ‘net_change’: -0.1, ‘total_buy_quantity’: 194250.0, ‘total_sell_quantity’: 189750.0, ‘lower_circuit_limit’: 0.05, ‘upper_circuit_limit’: 20.25, ‘last_trade_time’: ‘1727070424766’, ‘oi_day_high’: 251250.0, ‘oi_day_low’: 232500.0}, ‘NSE_FO:SBIN24SEP720CE’: {‘ohlc’: {‘open’: 84.9, ‘high’: 85.0, ‘low’: 84.9, ‘close’: 85.0}, ‘depth’: {‘buy’: [{‘quantity’: 750, ‘price’: 84.05, ‘orders’: 1}, {‘quantity’: 750, ‘price’: 83.75, ‘orders’: 1}, {‘quantity’: 12000, ‘price’: 82.3, ‘orders’: 16}, {‘quantity’: 2250, ‘price’: 82.25, ‘orders’: 1}, {‘quantity’: 1500, ‘price’: 82.2, ‘orders’: 2}], ‘sell’: [{‘quantity’: 750, ‘price’: 85.25, ‘orders’: 1}, {‘quantity’: 2250, ‘price’: 85.4, ‘orders’: 1}, {‘quantity’: 5250, ‘price’: 88.25, ‘orders’: 3}, {‘quantity’: 2250, ‘price’: 88.45, ‘orders’: 1}, {‘quantity’: 5250, ‘price’: 89.25, ‘orders’: 1}]}, ‘timestamp’: ‘2024-09-23T11:17:16.923+05:30’, ‘instrument_token’: ‘NSE_FO|152265’, ‘symbol’: ‘SBIN24SEP720CE’, ‘last_price’: 85.0, ‘volume’: 1500, ‘average_price’: 84.95, ‘oi’: 93750.0, ‘net_change’: 24.6, ‘total_buy_quantity’: 76500.0, ‘total_sell_quantity’: 54000.0, ‘lower_circuit_limit’: 21.75, ‘upper_circuit_limit’: 129.6, ‘last_trade_time’: ‘1727070164953’, ‘oi_day_high’: 93750.0, ‘oi_day_low’: 93750.0}, ‘NSE_FO:SBIN24SEP860PE’: {‘ohlc’: {‘open’: 69.7, ‘high’: 69.7, ‘low’: 55.1, ‘close’: 55.65}, ‘depth’: {‘buy’: [{‘quantity’: 1500, ‘price’: 55.9, ‘orders’: 1}, {‘quantity’: 1500, ‘price’: 55.75, ‘orders’: 1}, {‘quantity’: 1500, ‘price’: 55.6, ‘orders’: 1}, {‘quantity’: 1500, ‘price’: 55.55, ‘orders’: 2}, {‘quantity’: 750, ‘price’: 55.1, ‘orders’: 1}], ‘sell’: [{‘quantity’: 750, ‘price’: 56.3, ‘orders’: 1}, {‘quantity’: 1500, ‘price’: 56.35, ‘orders’: 2}, {‘quantity’: 3000, ‘price’: 56.45, ‘orders’: 3}, {‘quantity’: 750, ‘price’: 56.5, ‘orders’: 1}, {‘quantity’: 1500, ‘price’: 56.6, ‘orders’: 1}]}, ‘timestamp’: ‘2024-09-23T11:17:16.923+05:30’, ‘instrument_token’: ‘NSE_FO|152280’, ‘symbol’: ‘SBIN24SEP860PE’, ‘last_price’: 55.65, ‘volume’: 141750, ‘average_price’: 61.22, ‘oi’: 435000.0, ‘net_change’: -21.85, ‘total_buy_quantity’: 78750.0, ‘total_sell_quantity’: 81000.0, ‘lower_circuit_limit’: 9.25, ‘upper_circuit_limit’: 118.85, ‘last_trade_time’: ‘1727070403149’, ‘oi_day_high’: 530250.0, ‘oi_day_low’: 435000.0}, ‘NSE_FO:SBIN24SEP910CE’: {‘ohlc’: {‘open’: 0.15, ‘high’: 0.2, ‘low’: 0.1, ‘close’: 0.15}, ‘depth’: {‘buy’: [{‘quantity’: 3000, ‘price’: 0.15, ‘orders’: 3}, {‘quantity’: 56250, ‘price’: 0.1, ‘orders’: 7}, {‘quantity’: 186000, ‘price’: 0.05, ‘orders’: 15}, {‘quantity’: 0, ‘price’: 0.0, ‘orders’: 0}, {‘quantity’: 0, ‘price’: 0.0, ‘orders’: 0}], ‘sell’: [{‘quantity’: 31500, ‘price’: 0.2, ‘orders’: 7}, {‘quantity’: 41250, ‘price’: 0.25, ‘orders’: 4}, {‘quantity’: 2250, ‘price’: 0.3, ‘orders’: 3}, {‘quantity’: 2250, ‘price’: 0.35, ‘orders’: 2}, {‘quantity’: 2250, ‘price’: 0.4, ‘orders’: 2}]}, ‘timestamp’: ‘2024-09-23T11:17:16.923+05:30’, ‘instrument_token’: ‘NSE_FO|98853’, ‘symbol’: ‘SBIN24SEP910CE’, ‘last_price’: 0.15, ‘volume’: 21000, ‘average_price’: 0.15, ‘oi’: 294000.0, ‘net_change’: -0.05, ‘total_buy_quantity’: 245250.0, ‘total_sell_quantity’: 110250.0, ‘lower_circuit_limit’: 0.05, ‘upper_circuit_limit’: 20.2, ‘last_trade_time’: ‘1727070111790’, ‘oi_day_high’: 299250.0, ‘oi_day_low’: 294000.0}, ‘NSE_FO:SBIN24SEP660CE’: {‘ohlc’: {‘open’: 0.0, ‘high’: 0.0, ‘low’: 0.0, ‘close’: 0.0}, ‘depth’: {‘buy’: [{‘quantity’: 2250, ‘price’: 138.4, ‘orders’: 1}, {‘quantity’: 2250, ‘price’: 138.35, ‘orders’: 1}, {‘quantity’: 2250, ‘price’: 136.75, ‘orders’: 1}, {‘quantity’: 5250, ‘price’: 135.05, ‘orders’: 1}, {‘quantity’: 5250, ‘price’: 133.3, ‘orders’: 1}], ‘sell’: [{‘quantity’: 2250, ‘price’: 147.1, ‘orders’: 1}, {‘quantity’: 2250, ‘price’: 147.15, ‘orders’: 1}, {‘quantity’: 5250, ‘price’: 147.9, ‘orders’: 1}, {‘quantity’: 2250, ‘price’: 148.05, ‘orders’: 1}, {‘quantity’: 5250, ‘price’: 150.0, ‘orders’: 1}]}, ‘timestamp’: ‘2024-09-23T11:17:16.923+05:30’, ‘instrument_token’: ‘NSE_FO|152259’, ‘symbol’: ‘SBIN24SEP660CE’, ‘last_price’: 0.0, ‘volume’: 0, ‘average_price’: 0.0, ‘oi’: 0.0, ‘net_change’: -200.2, ‘total_buy_quantity’: 47250.0, ‘total_sell_quantity’: 47250.0, ‘lower_circuit_limit’: 81.0, ‘upper_circuit_limit’: 190.4, ‘last_trade_time’: ‘315513000000’, ‘oi_day_high’: 0.0, ‘oi_day_low’: 0.0}, ‘NSE_FO:SBIN24SEP820PE’: {‘ohlc’: {‘open’: 35.0, ‘high’: 35.0, ‘low’: 17.9, ‘close’: 18.75}, ‘depth’: {‘buy’: [{‘quantity’: 3750, ‘price’: 18.75, ‘orders’: 4}, {‘quantity’: 3750, ‘price’: 18.7, ‘orders’: 4}, {‘quantity’: 6000, ‘price’: 18.65, ‘orders’: 4}, {‘quantity’: 3000, ‘price’: 18.6, ‘orders’: 3}, {‘quantity’: 4500, ‘price’: 18.55, ‘orders’: 4}], ‘sell’: [{‘quantity’: 1500, ‘price’: 18.9, ‘orders’: 2}, {‘quantity’: 3000, ‘price’: 18.95, ‘orders’: 4}, {‘quantity’: 11250, ‘price’: 19.0, ‘orders’: 7}, {‘quantity’: 3000, ‘price’: 19.05, ‘orders’: 3}, {‘quantity’: 3000, ‘price’: 19.1, ‘orders’: 3}]}, ‘timestamp’: ‘2024-09-23T11:17:16.923+05:30’, ‘instrument_token’: ‘NSE_FO|152276’, ‘symbol’: ‘SBIN24SEP820PE’, ‘last_price’: 18.75, ‘volume’: 801000, ‘average_price’: 24.38, ‘oi’: 2066250.0, ‘net_change’: -21.1, ‘total_buy_quantity’: 165750.0, ‘total_sell_quantity’: 130500.0, ‘lower_circuit_limit’: 0.05, ‘upper_circuit_limit’: 77.45, ‘last_trade_time’: ‘1727070431224’, ‘oi_day_high’: 2249250.0, ‘oi_day_low’: 2046000.0}, ‘NSE_FO:SBIN24SEP850CE’: {‘ohlc’: {‘open’: 0.45, ‘high’: 0.9, ‘low’: 0.35, ‘close’: 0.8}, ‘depth’: {‘buy’: [{‘quantity’: 80250, ‘price’: 0.75, ‘orders’: 16}, {‘quantity’: 55500, ‘price’: 0.7, ‘orders’: 15}, {‘quantity’: 53250, ‘price’: 0.65, ‘orders’: 15}, {‘quantity’: 51000, ‘price’: 0.6, ‘orders’: 12}, {‘quantity’: 54750, ‘price’: 0.55, ‘orders’: 14}], ‘sell’: [{‘quantity’: 45750, ‘price’: 0.8, ‘orders’: 13}, {‘quantity’: 132000, ‘price’: 0.85, ‘orders’: 27}, {‘quantity’: 94500, ‘price’: 0.9, ‘orders’: 20}, {‘quantity’: 42000, ‘price’: 0.95, ‘orders’: 12}, {‘quantity’: 77250, ‘price’: 1.0, ‘orders’: 20}]}, ‘timestamp’: ‘2024-09-23T11:17:16.923+05:30’, ‘instrument_token’: ‘NSE_FO|98846’, ‘symbol’: ‘SBIN24SEP850CE’, ‘last_price’: 0.8, ‘volume’: 3460500, ‘average_price’: 0.54, ‘oi’: 4420500.0, ‘net_change’: 0.3, ‘total_buy_quantity’: 2972250.0, ‘total_sell_quantity’: 681750.0, ‘lower_circuit_limit’: 0.05, ‘upper_circuit_limit’: 20.5, ‘last_trade_time’: ‘1727070422813’, ‘oi_day_high’: 5583000.0, ‘oi_day_low’: 4399500.0}, ‘NSE_FO:SBIN24SEP890CE’: {‘ohlc’: {‘open’: 0.25, ‘high’: 0.25, ‘low’: 0.15, ‘close’: 0.25}, ‘depth’: {‘buy’: [{‘quantity’: 15000, ‘price’: 0.2, ‘orders’: 6}, {‘quantity’: 106500, ‘price’: 0.15, ‘orders’: 9}, {‘quantity’: 102000, ‘price’: 0.1, ‘orders’: 12}, {‘quantity’: 139500, ‘price’: 0.05, ‘orders’: 10}, {‘quantity’: 0, ‘price’: 0.0, ‘orders’: 0}], ‘sell’: [{‘quantity’: 22500, ‘price’: 0.3, ‘orders’: 8}, {‘quantity’: 3750, ‘price’: 0.35, ‘orders’: 3}, {‘quantity’: 2250, ‘price’: 0.4, ‘orders’: 1}, {‘quantity’: 6750, ‘price’: 0.55, ‘orders’: 3}, {‘quantity’: 2250, ‘price’: 0.6, ‘orders’: 2}]}, ‘timestamp’: ‘2024-09-23T11:17:16.923+05:30’, ‘instrument_token’: ‘NSE_FO|98851’, ‘symbol’: ‘SBIN24SEP890CE’, ‘last_price’: 0.25, ‘volume’: 75750, ‘average_price’: 0.19, ‘oi’: 319500.0, ‘net_change’: 0.0, ‘total_buy_quantity’: 363000.0, ‘total_sell_quantity’: 112500.0, ‘lower_circuit_limit’: 0.05, ‘upper_circuit_limit’: 20.25, ‘last_trade_time’: ‘1727070421987’, ‘oi_day_high’: 339000.0, ‘oi_day_low’: 319500.0}, ‘NSE_FO:SBIN24SEP950PE’: {‘ohlc’: {‘open’: 162.0, ‘high’: 162.0, ‘low’: 153.7, ‘close’: 153.7}, ‘depth’: {‘buy’: [{‘quantity’: 1500, ‘price’: 144.45, ‘orders’: 2}, {‘quantity’: 750, ‘price’: 144.4, ‘orders’: 1}, {‘quantity’: 2250, ‘price’: 144.2, ‘orders’: 1}, {‘quantity’: 750, ‘price’: 143.75, ‘orders’: 1}, {‘quantity’: 2250, ‘price’: 142.8, ‘orders’: 1}], ‘sell’: [{‘quantity’: 2250, ‘price’: 146.45, ‘orders’: 1}, {‘quantity’: 1500, ‘price’: 151.35, ‘orders’: 2}, {‘quantity’: 2250, ‘price’: 151.4, ‘orders’: 1}, {‘quantity’: 2250, ‘price’: 152.15, ‘orders’: 1}, {‘quantity’: 5250, ‘price’: 153.85, ‘orders’: 1}]}, ‘timestamp’: ‘2024-09-23T11:17:16.923+05:30’, ‘instrument_token’: ‘NSE_FO|98858’, ‘symbol’: ‘SBIN24SEP950PE’, ‘last_price’: 153.7, ‘volume’: 21000, ‘average_price’: 157.79, ‘oi’: 74250.0, ‘net_change’: -17.3, ‘total_buy_quantity’: 55500.0, ‘total_sell_quantity’: 54000.0, ‘lower_circuit_limit’: 104.45, ‘upper_circuit_limit’: 212.55, ‘last_trade_time’: ‘1727068223029’, ‘oi_day_high’: 93000.0, ‘oi_day_low’: 74250.0}, ‘NSE_FO:SBIN24SEP720PE’: {‘ohlc’: {‘open’: 0.25, ‘high’: 0.25, ‘low’: 0.15, ‘close’: 0.2}, ‘depth’: {‘buy’: [{‘quantity’: 13500, ‘price’: 0.15, ‘orders’: 4}, {‘quantity’: 209250, ‘price’: 0.1, ‘orders’: 21}, {‘quantity’: 232500, ‘price’: 0.05, ‘orders’: 17}, {‘quantity’: 0, ‘price’: 0.0, ‘orders’: 0}, {‘quantity’: 0, ‘price’: 0.0, ‘orders’: 0}], ‘sell’: [{‘quantity’: 12000, ‘price’: 0.2, ‘orders’: 6}, {‘quantity’: 24750, ‘price’: 0.25, ‘orders’: 8}, {‘quantity’: 3000, ‘price’: 0.3, ‘orders’: 3}, {‘quantity’: 3000, ‘price’: 0.35, ‘orders’: 3}, {‘quantity’: 3750, ‘price’: 0.4, ‘orders’: 4}]}, ‘timestamp’: ‘2024-09-23T11:17:16.923+05:30’, ‘instrument_token’: ‘NSE_FO|152266’, ‘symbol’: ‘SBIN24SEP720PE’, ‘last_price’: 0.2, ‘volume’: 202500, ‘average_price’: 0.19, ‘oi’: 912750.0, ‘net_change’: -0.1, ‘total_buy_quantity’: 455250.0, ‘total_sell_quantity’: 288000.0, ‘lower_circuit_limit’: 0.05, ‘upper_circuit_limit’: 20.3, ‘last_trade_time’: ‘1727070294995’, ‘oi_day_high’: 1038750.0, ‘oi_day_low’: 912750.0}, ‘NSE_FO:SBIN24SEP820CE’: {‘ohlc’: {‘open’: 1.05, ‘high’: 3.4, ‘low’: 0.95, ‘close’: 3.0}
As you can see the Lot size issue has been resolved with volume orders placed etc. However the exact Lot price is missing does Upstox API exactly provides the Lot prices if you can confirm that would help me immensely many thanks.
@naman_sawhney You can utilise the Margin API to retrieve the required margin for an instrument.
Thanks!