Welcome
NSEPython is a Python library to get publicly available data on NSE website ie. stock quotes, historical data, live indices, etc. Thanks for using NSEPython . Let’s get you up and running.
Installation
pip install nsepython
- If You’ve other doubts, Ask at NSEPython Doubts and Discussions
- If You’ve feature requests, Ask at NSEPython Discussion and Feature Request
Upgrade –
In case, Some command is not working, Make sure You’re in the latest version always. We constantly update the API with lots of custom function time to time. To upgrade the program to its latest version, run the following command:
pip install --upgrade nsepython
Getting Started
To Initialize, You need to do from nsepython import *
. Then here is the way to fetch the Indices of NSE –
Input
from nsepython import *
print(indices)
Output
['NIFTY', 'FINNIFTY', 'BANKNIFTY']
Unofficed Session Tutorials
If You have never used Python, Jupyter and are beginner stumbling into this project, Go through this link Basics of NSEPython Using Python and Jupyter.
Google Cloud, AWS, Servers
This current version of scrapper does not work with AWS, Google Cloud and web servers. It is not a problem of Python Request. Nse’s robots.txt has blocked all webservers all together. See here NSE Robots Txt
You can use the curl method and initiate shell commands using Python if you want to do it.
I do not plan to add Curl Method in the library unless I see some other library doing it because – That will increase the load in NSE servers and they will guard up their firewalls causing lots of problems for general scavengers like us like they did with their old website.
User-agent: *
Disallow: /static/htmls/
Disallow: /static/src/
Disallow: /server/
Disallow: /api/
Sitemap: https://www.nseindia.com/sitemap.xml
Sitemap: https://www.nseindia.com/sitemap-stocks.xml
WARNING
- If I make NSEPython compatible for servers, it will not work in windows laptops.
- If I make NSEPython compatible for laptops, it will not work in the server.