Jugaad Data

jugaad-data is a python library to download historical as well as live stock, index as well as economic data from NSE and RBI website. This library will be a cruicial part of your analysis, backtesting and automation workflow for trading and investing.

This library fetches data from new website of NSE and hence jugaad-data is future-proof. Many other libraries still rely on old website and may eventually stop working.

Functionalities

In pipeline

In case you find other information available in NSE’s website as JSON api, please raise a feature here

Installation

pip install jugaad-data

You can optionally install pandas library in case you are interested in fetching data directly into ‘pandas’ dataframes, in which case you can run-

pip install jugaad-data pandas

Quick start

Download bhavcopies and historical stock/index/derivatives data

from datetime import date
from jugaad_data.nse import bhavcopy_save, bhavcopy_fo_save

# Download bhavcopy
bhavcopy_save(date(2020,1,1), "/path/to/directory")

# Download bhavcopy for futures and options
bhavcopy_fo_save(date(2020,1,1), "/path/to/directory")

# Download stock data to pandas dataframe
from jugaad_data.nse import stock_df
df = stock_df(symbol="SBIN", from_date=date(2020,1,1),
            to_date=date(2020,1,30), series="EQ")

Fetch live quotes

from jugaad_data.nse import NSELive
n = NSELive()
q = n.stock_quote("HDFC")
print(q['priceInfo'])
{'lastPrice': 2589.95, 'change': -73.05000000000018, 'pChange': -2.7431468268869765, 'previousClose': 2663, 'open': 2669, 'close': 2589.45, 'vwap': 2623.6, 'lowerCP': '2396.70', 'upperCP': '2929.30', 'pPriceBand': 'No Band', 'basePrice': 2663, 'intraDayHighLow': {'min': 2583.05, 'max': 2678.75, 'value': 2589.95}, 'weekHighLow': {'min': 1473.45, 'minDate': '24-Mar-2020', 'max': 2777.15, 'maxDate': '13-Jan-2021', 'value': 2589.95}}

Command line interface for bhavcopies and historical data

Overall CLI functionality-

$ jdata --help
Usage: jdata [OPTIONS] COMMAND [ARGS]...

  This is a command line tool to download stock market data to csv files.

Options:
  --help  Show this message and exit.

Commands:
  bhavcopy     Downloads bhavcopy from NSE's website Download today's...
  derivatives  Sample usage- Download stock futures- jdata derivatives -s...
  index        Download historical index data $jdata index --symbol "NIFTY...
  stock        Download historical stock data $jdata stock --symbol STOCK1...

Download stock data-

$ jdata stock -s SBIN -f 2020-01-01 -t 2020-01-31 -o SBIN-Jan.csv

Detailed documentation

1. Download historical data

1.1 Command line interface

2. Fetch live data

3. Fetch RBI data

Jugaad Data - Download historical stock market data

Download historical stock market data using python

2021-01-08

Jugaad Data - Fetch Economic Data from RBI

Fetch economic data such as policy rates, deposit rates, T-Bill rates etc. from RBI website using python

2021-01-08

Jugaad Data - Fetch live stock market data

Fetch live stock market data data using python

2021-01-08