Below code was working earlier like few months back. But on new AWS machine its giving error as below. Kindly assist.
if instrumentsList is None: instrumentsList = kite.instruments('NFO')
lst_b = [num for num in instrumentsList if num['expiry'] == expiry and num['strike'] == strike and num['instrument_type'] == ins_type and num['name'] == name] return lst_b[0]['tradingsymbol']
symbol_ce = get_symbols(nte, 'BANKNIFTY', atm_strike, 'CE') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\tRADING\Python\ExpiryStraddle.py", line 122, in get_symbols return lst_b[0]['tradingsymbol'] ~~~~~^^^ IndexError: list index out of range
lst_b = [num for num in instrumentsList if num['expiry'] == expiry and num['strike'] == strike and num['instrument_type'] == ins_type and num['name'] == name] return lst_b[0]['tradingsymbol']
get_symbols(nte, 'BANKNIFTY', atm_strike, 'CE')
Your above get_symbols method is returning no matching instrument. You need to debug on that.
get_symbols
method is returning no matching instrument. You need to debug on that.