Fetch only FnO stocks list using api?

Hi @Hardik / Team,

Is there a way we can fetch only FnO stock list using api. Like the below url having all the data of these stocks?

Hello @shbtechno

No, this is not available as of now on API. You can look into the list of Underlying Instruments in OPTSTK product type in the Security ID List.

Hi @shbtechno , Try the below code and let me know if it works for you.

import pandas as pd
url = “https://dhan.co/nse-fno-lot-size/
tables = pd.read_html(url)
df = tables[0]
stocks = [stock[1:] for stock in df.iloc[:, 0].astype(str)]
print(“F&O Stocks List:”, stocks)
print(“Total Count:”, len(stocks))