I am still getting NULL dataframe

symbol = “NIFTY”

start_date = “24-04-2023”

end_date = “10-05-2023”

instrument_type = “options”

expiry_date = “04-May-2023”

strike_price = 17900.00

option_type = “CE”

derivative_data = derivative_history(symbol, start_date, end_date, instrument_type,expiry_date,strike_price, option_type)

I am still getting NULL dataframe.

Works fine.

Correct code

symbol = "NIFTY"
start_date = "24-04-2023"
end_date = "10-05-2023"
instrument_type = "options"
expiry_date = "04-May-2023"
strike_price = 17900
option_type = "CE"
derivative_data = derivative_history(symbol, start_date, end_date, instrument_type,
                                      expiry_date, strike_price, option_type)

print(derivative_data)

Write 17900 instead of 17900.00

Sir
I am still getting NULL Dataframe. Could you please check?
I can get the data for stock options but problem is with index options

Then it has to be system specific right? If the same code that runs on my server does not runs in yours. How I can debug bro?

thats a good observation, but how come I am getting data for equity thats a wonder for me then :slight_smile:

Sometimes NSE gives null dataframe in response for some scrips and some periods.

You try again and it will work.

It happens in main website too. It just means you are cursed.

Hi Dexter, You are right about the fact some users are cursed. I am one among the them. I wish you break it.

It is occurring to most of the users I believe seeing the comments.

Could you please check this and Praty has said something about using requests.session(), but even that didn’t work for me.

Is it possible for a retry mechanism till a valid response is received. I am not great at programming. Just a novice.

I am also receiving the same error.

Req :
symbol = “SBIN”
series = “EQ”
start_date = “08-06-2022”
end_date =“14-04-2023”
print(equity_history(symbol,series,start_date,end_date))

Response:
Traceback (most recent call last):
File “C:\Software\NSE_Analytics\Nsepython_new\venvCH\lib\site-packages\requests\models.py”, line 971, in json
return complexjson.loads(self.text, **kwargs)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json_init_.py”, line 346, in loads
return _default_decoder.decode(s)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\decoder.py”, line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\decoder.py”, line 355, in raw_decode
raise JSONDecodeError(“Expecting value”, s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\Software\NSE_Analytics\Nsepython_new\runner1.py”, line 10, in
print(equity_history(symbol,series,start_date,end_date))
File “C:\Software\NSE_Analytics\Nsepython_new\venvCH\lib\site-packages\nsepython\rahu.py”, line 551, in equity_history
total = pd.concat([total, equity_history_virgin(symbol, series, start_date, temp_date)])
File “C:\Software\NSE_Analytics\Nsepython_new\venvCH\lib\site-packages\nsepython\rahu.py”, line 519, in equity_history_virgin
payload = nsefetch(url)
File “C:\Software\NSE_Analytics\Nsepython_new\venvCH\lib\site-packages\nsepython\rahu.py”, line 20, in nsefetch
output = s.get(payload,headers=headers).json()
File “C:\Software\NSE_Analytics\Nsepython_new\venvCH\lib\site-packages\requests\models.py”, line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I have provided the solution in the following post. I used to get the NULL value too.
Solution: equity_history() function doesn’t work - Programming / NSE Python API - Unofficed

Additionally, I also observed that the date-range is too long. Try to keep it in between 2 months or so.
You can verify the max date range from the NSE link: SBI Life Insurance Company Limited Share Price Today, Stock Price, Live NSE News, Quotes, Tips – NSE India
Even if you select 6 months date range, the result is limited to roughly 2 and half months.

Hope this helps.