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.
There are two versions of NSEPython depending on the execution environment. While it’s technically feasible to combine these versions into a single program, doing so could introduce latency. Given the financial nature of this program, time is of the essence.
Access NSEPython for laptops, specifically tailored for Windows 9 and Windows 10 compatibility. To use it, open up your terminal in the desired directory and run the following command:
pip install nsepython
Leverage NSEPython designed for server environments, seamlessly functioning on AWS, Google Colab, and DigitalOcean. To use it, open up your terminal in the desired directory and run the following command:
pip install nsepythonserver
Support and Beta Functions
pip install --upgrade nsepython
In case of Server Edition, The command will be –
pip install --upgrade nsepythonserver
To Initialize, You need to do
from nsepython import *
Note that – If You have installed
nsepythonserver, You need to write
nsepythonserver instead of
nsepython. The tutorials and documentaions will use the notion of
nsepython for simplicity.
Then here is the way to fetch the Indices of NSE –
from nsepython import *
['NIFTY', 'FINNIFTY', 'BANKNIFTY']
Unofficed Session Tutorials
Google Cloud, AWS, Servers
This local version of NSEPython 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
The server edition use the curl method and initiate shell commands using Python. The curl method does not run on local computers.
The server edition is also firewalled heavily by NSE. Like if You must use Indian Servers to access the API. It completely blocks some countries!
If you are facing problem in running with the basic functions, visit the NSEPython Discussions forum and state your configuration for further evaluation.
Exercise caution to prevent inadvertently coding endless loops into your scripts. Such loops can lead to increased server loads on NSE’s end, potentially prompting them to reinforce their firewalls. This could create numerous issues for enthusiasts like us, similar to what happened with their previous website.