Not able to to get the historical option price open high close price for few strikes

Hi Team ,
I’m trying to get the option OHLC price details for few strikes . Its working fine when i tried to get it for single strike price , but its not when i pass list of values(security code).

Here is my code
for i,j in zip(bnk_ce_list,bnk_ce_list_symbol):
exchange=“NSE_FNO”
historical_data=dhan.intraday_minute_data(
security_id=str(i),
exchange_segment=exchange,
instrument_type=‘OPTIDX’)
mins_df=pd.DataFrame((historical_data[‘data’]))
mins_df[‘symbol’]=j
mins_1st_df=one_mins_df.iloc[0]
if(mins_1st_df[‘open’]==mins_1st_df[‘high’]):
mins_2nd_df=one_mins_df.iloc[2]
merged_df_ce=pd.merge(df_ce,df_ce_2nd,on=[“Symbol”])

Error I m getting ->ValueError: DataFrame constructor not properly called!
Please have a look into it and let me know do you need anything else from end
Thanks
print(merged_df_ce)

Hello @senthil_kumar

Welcome to Dhan Community!

Yes, so the API doesn’t accept list of security IDs. You will have to call the API separately for each security ID. You can read the documentation of the same here: Historical Data - DhanHQ Ver 1.0 / API Document

Thanks for the reply . I’m calling the API separately …by using the for loop

1 Like