Unable to fetch the option chain data

@Tradehull_Imran Unable to fetch the market data. Showing this error since morning. Everything was working fine since yesterday. Today its showing this error.

[2026-03-17 09:43:48.958859] INFO: :white_check_mark: Login Successful — bot auto-logged in, no manual to
ken needed!
[2026-03-17 09:43:48.959476] INFO: No DHAN_STATIC_IP configured. Skipping static IP setup. (Required for order placement as per SEBI rules)
got exception in pnl as ‘Tradehull’ object has no attribute ‘instrument_df’
exception got in ce_pe_option_df ‘Tradehull’ object has no attribute ‘instrument_df’
Exception in Getting OHLC data as ‘Tradehull’ object has no attribute ‘instrument_df’
[2026-03-17 09:43:48.964998] ERROR [MarketData]: Failed to fetch market data or empty dataframe returned.
[2026-03-17 09:43:48.966823] ERROR [Strategy]: Failed to map Option Chain strikes. Retrying…
got exception in pnl as ‘Tradehull’ object has no attribute ‘instrument_df’
exception got in ce_pe_option_df ‘Tradehull’ object has no attribute ‘instrument_df’
Exception in Getting OHLC data as ‘Tradehull’ object has no attribute ‘instrument_df’
[2026-03-17 09:43:53.972913] ERROR [MarketData]: Failed to fetch market data or empty dataframe returned.
[2026-03-17 09:43:53.973682] ERROR [Strategy]: Failed to map Option Chain strikes. Retrying…
got exception in pnl as ‘Tradehull’ object has no attribute ‘instrument_df’
exception got in ce_pe_option_df ‘Tradehull’ object has no attribute ‘instrument_df’
Exception in Getting OHLC data as ‘Tradehull’ object has no attribute ‘instrument_df’
[2026-03-17 09:43:58.979268] ERROR [MarketData]: Failed to fetch market data or empty dataframe returned.
[2026-03-17 09:43:58.979760] ERROR [Strategy]: Failed to map Option Chain strikes. Retrying…
got exception in pnl as ‘Tradehull’ object has no attribute ‘instrument_df’
exception got in ce_pe_option_df ‘Tradehull’ object has no attribute ‘instrument_df’
Exception in Getting OHLC data as ‘Tradehull’ object has no attribute ‘instrument_df’
[2026-03-17 09:44:03.985248] ERROR [MarketData]: Failed to fetch market data or empty dataframe returned.
[2026-03-17 09:44:03.985798] ERROR [Strategy]: Failed to map Option Chain strikes. Retrying…
got exception in pnl as ‘Tradehull’ object has no attribute ‘instrument_df’
exception got in ce_pe_option_df ‘Tradehull’ object has no attribute ‘instrument_df’
Exception in Getting OHLC data as ‘Tradehull’ object has no attribute ‘instrument_df’
[2026-03-17 09:44:08.993569] ERROR [MarketData]: Failed to fetch market data or empty dataframe returned.
[2026-03-17 09:44:08.995123] ERROR [Strategy]: Failed to map Option Chain strikes. Retrying…
got exception in pnl as ‘Tradehull’ object has no attribute ‘instrument_df’
exception got in ce_pe_option_df ‘Tradehull’ object has no attribute ‘instrument_df’
Exception in Getting OHLC data as ‘Tradehull’ object has no attribute ‘instrument_df’
[2026-03-17 09:44:14.004198] ERROR [MarketData]: Failed to fetch market data or empty dataframe returned.
[2026-03-17 09:44:14.006081] ERROR [Strategy]: Failed to map Option Chain strikes. Retrying…
got exception in pnl as ‘Tradehull’ object has no attribute ‘instrument_df’
exception got in ce_pe_option_df ‘Tradehull’ object has no attribute ‘instrument_df’
Exception in Getting OHLC data as ‘Tradehull’ object has no attribute ‘instrument_df’
[2026-03-17 09:44:19.014410] ERROR [MarketData]: Failed to fetch market data or empty dataframe returned.
[2026-03-17 09:44:19.015776] ERROR [Strategy]: Failed to map Option Chain strikes. Retrying…
got exception in pnl as ‘Tradehull’ object has no attribute ‘instrument_df’
exception got in ce_pe_option_df ‘Tradehull’ object has no attribute ‘instrument_df’
Exception in Getting OHLC data as ‘Tradehull’ object has no attribute ‘instrument_df’
[2026-03-17 09:44:24.023137] ERROR [MarketData]: Failed to fetch market data or empty dataframe returned.
[2026-03-17 09:44:24.024838] ERROR [Strategy]: Failed to map Option Chain strikes. Retrying…
got exception in pnl as ‘Tradehull’ object has no attribute ‘instrument_df’
exception got in ce_pe_option_df ‘Tradehull’ object has no attribute ‘instrument_df’
Exception in Getting OHLC data as ‘Tradehull’ object has no attribute ‘instrument_df’
[2026-03-17 09:44:29.030336] ERROR [MarketData]: Failed to fetch market data or empty dataframe returned.
[2026-03-17 09:44:29.030825] ERROR [Strategy]: Failed to map Option Chain strikes. Retrying…
got exception in pnl as ‘Tradehull’ object has no attribute ‘instrument_df’
exception got in ce_pe_option_df ‘Tradehull’ object has no attribute ‘instrument_df’
Exception in Getting OHLC data as ‘Tradehull’ object has no attribute ‘instrument_df’
[2026-03-17 09:44:34.036455] ERROR [MarketData]: Failed to fetch market data or empty dataframe returned.
[2026-03-17 09:44:34.037021] ERROR [Strategy]: Failed to map Option Chain strikes. Retrying…
got exception in pnl as ‘Tradehull’ object has no attribute ‘instrument_df’
exception got in ce_pe_option_df ‘Tradehull’ object has no attribute ‘instrument_df’
Exception in Getting OHLC data as ‘Tradehull’ object has no attribute ‘instrument_df’
[2026-03-17 09:44:39.043354] ERROR [MarketData]: Failed to fetch market data or empty dataframe returned.
[2026-03-17 09:44:39.043862] ERROR [Strategy]: Failed to map Option Chain strikes. Retrying…
got exception in pnl as ‘Tradehull’ object has no attribute ‘instrument_df’
exception got in ce_pe_option_df ‘Tradehull’ object has no attribute ‘instrument_df’
Exception in Getting OHLC data as ‘Tradehull’ object has no attribute ‘instrument_df’
[2026-03-17 09:44:44.051937] ERROR [MarketData]: Failed to fetch market data or empty dataframe returned.
[2026-03-17 09:44:44.053376] ERROR [Strategy]: Failed to map Option Chain strikes. Retrying…

@Mahikbs Try official Python package code here.

Hi @Mahikbs ,

Itseems the login was not successful because of which instrument file was not downloaded, do retry to re run the program. If you still face issues send the screenshot of the cmd terminal with the codebase version.

D:\Data_for_trader\new idea>py dhan_option_chain.py
Codebase Version 3.1.2
Traceback (most recent call last):
File “D:\Data_for_trader\new idea\dhan_option_chain.py”, line 18, in
tsl = Tradehull(client_code, token_id, mode=“access_token”)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Tradehull.init() got an unexpected keyword argument ‘mode’

D:\Data_for_trader\new idea>py dhan_option_chain.py
Codebase Version 3.1.2
-----Logged into Dhan-----
reading existing file all_instrument 2026-03-17.csv
Got the instrument file

d:\data_for_trader\new idea\dhan_option_chain.py(28)()
→ def get_chain():
(Pdb) atm, df = tsl.get_option_chain(Underlying=SYMBOL,exchange=“INDEX”,expiry=0,num_strikes=20)
Exception at getting Expiry list as {‘status’: ‘failure’, ‘remarks’: {‘error_code’: None, ‘error_type’: None, ‘error_message’: None}, ‘data’: ‘’}
Unable to find the correct Expiry for SENSEX
*** TypeError: cannot unpack non-iterable NoneType object

1 Like

Hi @ram_partap ,

Do update the codebase to latest version, follow the below thread’s steps-