jugaad-data
jugaad-data copied to clipboard
Option chain data downloading issue
Issue description
Can't download option chain data. Screenshot attached.

Example Code
from jugaad_data.nse import derivatives_csv, derivatives_df
df = derivatives_df(symbol="SBIN", from_date=date(2022,1,1), to_date=date(2022,2,24),
expiry_date=date(2022,3,31), instrument_type="OPTSTK", option_type="CE", strike_price=500)
print(df.head())
Error snippet
JSONDecodeError Traceback (most recent call last)
[<ipython-input-42-2a115219c3d7>](https://eei938yvh5k-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20220328-060046-RC02_437851183#) in <module>()
1 from jugaad_data.nse import derivatives_csv, derivatives_df
2 df = derivatives_df(symbol="SBIN", from_date=date(2022,1,1), to_date=date(2022,2,24),
----> 3 expiry_date=date(2022,3,31), instrument_type="OPTSTK", option_type="CE", strike_price=500)
4 print(df.head())
11 frames
[/usr/lib/python3.7/json/decoder.py](https://eei938yvh5k-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20220328-060046-RC02_437851183#) in raw_decode(self, s, idx)
353 obj, end = self.scan_once(s, idx)
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
As I tried to run the same code, I could fetch the data
please do check and let us know.
This looks an issue with NSE website, if you make a lot of requests in short time, NSE will respond with error, which might not be json.. which might result in the error you saw.
There isnt anything we can do I believe, only thing we can do is try to play nice with NSEpy and throttle requests