[Resolved] Option chain is not fetching

Hello @Tradehull_Imran sir,

I getting error in below code, firstly i am using “Name: Dhan_Tradehull Version: 3.0.5” at that time below code is working after getting upgrade to “Name: Dhan_Tradehull Version: 3.0.6” now i am uanble to fetch option chain data.

Please help me to fix this error.

code

while True:
atm_Strike, option_chain = tsl.get_option_chain(Underlying= “NIFTY”, exchange= “INDEX”, expiry= 0, num_strikes=10)
sheet.range(‘A1’).value = option_chain
time.sleep (10)

error

reading existing file all_instrument 2025-03-14.csv
Got the instrument file
Getting Error at Option Chain as ‘NIFTY’
Traceback (most recent call last):
File “e:/siddesh/Trading/Sublime/code/Test/EMA/mm.py”, line 93, in
atm_Strike, option_chain = tsl.get_option_chain(Underlying= “NIFTY”, exchange= “INDEX”, expiry= 0)
TypeError: cannot unpack non-iterable NoneType object
PS E:\siddesh\Trading\Sublime\code\Test\EMA>

Continuing the discussion from Option chain is not fetching:

Hello @Tradehull_Imran sir,

I am getting an error in the code below. When I run it with a single or individual stock code, it works correctly. However, when I run the code with a watchlist, it gives me an error for every second name.

Please help me to fix this error.

Code:

import pdb
from Dhan_Tradehull import Tradehull
import pandas as pd

client_code = “-”
token_id = “-”
tsl = Tradehull(client_code,token_id)

watchlist = [‘UNIONBANK’, ‘VEDL’, ‘WIPRO’]

for names in watchlist:
atm, optchain = tsl.get_option_chain(Underlying=names, exchange=“NFO”, expiry=0, num_strikes=10)
print(f"\n{names}\n next\n")

Error Message:
PS E:\API_APP> & C:/Users/prite/AppData/Local/Programs/Python/Python38/python.exe “e:/API_APP/striks finding.py”
Codebase Version 3
-----Logged into Dhan-----
reading existing file all_instrument 2025-04-07.csv
Got the instrument file

WIPRO
next

PS E:\API_APP> & C:/Users/prite/AppData/Local/Programs/Python/Python38/python.exe “e:/API_APP/striks finding.py”
Codebase Version 3
-----Logged into Dhan-----
reading existing file all_instrument 2025-04-07.csv
Got the instrument file

WIPRO
next

Getting Error at Option Chain as {‘status’: ‘failure’, ‘remarks’: {‘error_code’: None, ‘error_type’: None, ‘error_message’: None}, ‘data’: {‘data’: {‘805’: ‘Too many requests. Further requests may result in the user being blocked.’}, ‘status’: ‘failed’}}
Traceback (most recent call last):
File “e:/API_APP/striks finding.py”, line 20, in
atm, optchain = tsl.get_option_chain(Underlying=names, exchange=“NFO”, expiry=0, num_strikes=10)
TypeError: cannot unpack non-iterable NoneType object
PS E:\API_APP> & C:/Users/prite/AppData/Local/Programs/Python/Python38/python.exe “e:/API_APP/striks finding.py”
Codebase Version 3
-----Logged into Dhan-----
reading existing file all_instrument 2025-04-07.csv
Got the instrument file

VEDL
next

PS E:\API_APP> & C:/Users/prite/AppData/Local/Programs/Python/Python38/python.exe “e:/API_APP/striks finding.py”
Codebase Version 3
-----Logged into Dhan-----
reading existing file all_instrument 2025-04-07.csv
Got the instrument file

VEDL
next

Getting Error at Option Chain as {‘status’: ‘failure’, ‘remarks’: {‘error_code’: None, ‘error_type’: None, ‘error_message’: None}, ‘data’: {‘data’: {‘805’: ‘Too many requests. Further requests may result in the user being blocked.’}, ‘status’: ‘failed’}}
Traceback (most recent call last):
File “e:/API_APP/striks finding.py”, line 20, in
atm, optchain = tsl.get_option_chain(Underlying=names, exchange=“NFO”, expiry=0, num_strikes=10)
TypeError: cannot unpack non-iterable NoneType object
PS E:\API_APP> & C:/Users/prite/AppData/Local/Programs/Python/Python38/python.exe “e:/API_APP/striks finding.py”
Codebase Version 3
-----Logged into Dhan-----
reading existing file all_instrument 2025-04-07.csv
Got the instrument file

UNIONBANK
next

PS E:\API_APP> & C:/Users/prite/AppData/Local/Programs/Python/Python38/python.exe “e:/API_APP/striks finding.py”
Codebase Version 3
-----Logged into Dhan-----
reading existing file all_instrument 2025-04-07.csv
Got the instrument file

UNIONBANK
next

Getting Error at Option Chain as {‘status’: ‘failure’, ‘remarks’: {‘error_code’: None, ‘error_type’: None, ‘error_message’: None}, ‘data’: {‘data’: {‘805’: ‘Too many requests. Further requests may result in the user being blocked.’}, ‘status’: ‘failed’}}
Traceback (most recent call last):
File “e:/API_APP/striks finding.py”, line 14, in
atm, optchain = tsl.get_option_chain(Underlying=names, exchange=“NFO”, expiry=0, num_strikes=10)
TypeError: cannot unpack non-iterable NoneType objectPreformatted text

Hi @Siddesh ,

The code seems to be working fine :

Hi @A_Pritesh_Pathak ,

The option chain is a high API call and can be fetched once in a while. Try to minimize the number of calls for option chain.

your system response within 3 seconds
which is totally unacceptable.

it should be on tick on in second or minuts
upstocks provides min 4-8 ticks in 1 second
why don’t you???
response should be based on tick
like in your website optionchain live broadcasts tick by tick
we do want same as here

Hi @Yash_Tamer ,

Tagging @Dhan for the same.

Hello @Yash_Tamer

Welcome to MadeForTrade community!

Right now, the option chain calculation is primarily dependent on OI data itself, which updates once every 2-3 seconds depending on exchange updating this data. A tick based update does not make much sense in this case.