(Resolved) Python code for option chain extraction

Hi All,
Anyone has python code to fetch live option chain data using Dhan Api. I am facing problem in getting stock options data for my studies, please help in getting option chain data. I took help from my friends and not able to write codes, Even I am not much familiar with coding.

1 Like

Hey @hanumesh_biliyappa ,

To fetch option chain data via Python code, please refer to the example below. We have created a working code for Reliance options; you may change the Security ID according to your requirement.

dhan.option_chain(
under_security_id=2885, # Nifty
under_exchange_segment=“NSE_FNO”,
expiry=“2025-09-30”
)

You may also find additional Python sample codes here: https://github.com/dhan-oss/DhanHQ-py

2 Likes

I really like the idea of having the team at Dhan take charge of resolving the long‑pending confusion around Python integration.

Complex tasks like coding and system integration are always better handled in‑house—your own people know the architecture, they understand the vision, and they’re committed to the journey.

Depending on third parties who may not show up when needed often leads to delays and even creates bad will.

https://private-poc.madefortrade.in/t/stuck-at-version-1-0-how-other-stock-brokers-are-failing-clients-with-outdated-tools/54948/