Learn Algo Trading with Python | Codes | Youtube Series

Hi @Raju2 ,

In our latest codebase, the num_strikes parameter is not available for use.
You can retrieve the option chain using the following code:

option_chain = tsl.get_option_chain(Underlying=“NIFTY”, exchange=“INDEX”, expiry=0)
We will be adding num_strikes in further versions. You can use the below code if you wish to do it manually:


num_strikes = 10
strike_step = 50
CE_symbol_name, PE_symbol_name, atm_strike = tsl.ATM_Strike_Selection(Underlying='NIFTY', Expiry=0)
oc_df = tsl.get_option_chain(Underlying="NIFTY", exchange="INDEX", expiry=0)
df = oc_df[(oc_df['Strike Price'] >= str(atm_strike - num_strikes * strike_step)) & (oc_df['Strike Price'] <= atm_strike + num_strikes * strike_step)].sort_values(by='Strike Price').reset_index(drop=True)