I am using below code to pull live Nifty quote from NSEpy module but getting error.
Code:
from nsepy import get_quote
nifty = get_quote('NIFTY', series='EQ', instrument='FUTIDX', expiry='26SEP2019')
print(nifty)
Error:
nifty = get_quote('NIFTY', series='EQ', instrument='FUTIDX', expiry='26SEP2019')
File "C:\ProgramData\Anaconda3\lib\site-packages\nsepy\live.py", line 26, in get_quote
expiry_str = "%02d%s%d"%(expiry.day, months[expiry.month][0:3].upper(), expiry.year)
AttributeError: 'str' object has no attribute 'day'
I could to make this working :
Output:
The documentation seems to be incorrect in the NSEpy library, which says
expiryshould be in (ddMMMyyyy) format andstrike(strike_price) is a mandatory argument.https://nsepy.readthedocs.io/en/latest/#quick-hand-on