# Documentation
https://marketsetup.in/documentation/jugaad-data/
# Introduction
`jugaad-data` is a python library to download historical/live stock, index as well as economic data from NSE and RBI website using.
![Build Badge](https://github.com/jugaad-py/jugaad-data/actions/workflows/run-tests.yml/badge.svg)
# Features
* Supports [new NSE website](https://www.nseindia.com/), (All libraries based on old NSE website might stop working)
* Powerful CLI (Command line interface), Even non-coders can use it easily
* Built-in caching mechanism to play nice with NSE. Avoid making un-necessary requests to NSE's website and getting blocked
* Optional `pandas` support
**Road map**
| Website | Segment | Supported? |
|----------|------------|------------|
| NSE | Stocks | Yes |
| NSE | Stocks F&O | Yes |
| NSE | Index | Yes |
| NSE | Index F&O | Yes |
| RBI | Current Rates| Yes |
# Installation
`pip install jugaad-data`
# Getting started
## Python inteface
### Historical data
```python
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")
```
### Live data
```python
from jugaad_data.nse import NSELive
n = NSELive()
q = n.stock_quote("HDFC")
print(q['priceInfo'])
```
```
{'lastPrice': 2635,
'change': -49.05000000000018,
'pChange': -1.8274622305843848,
'previousClose': 2684.05,
'open': 2661,
'close': 2632.75,
'vwap': 2645.57,
'lowerCP': '2415.65',
'upperCP': '2952.45',
'pPriceBand': 'No Band',
'basePrice': 2684.05,
'intraDayHighLow': {'min': 2615.6, 'max': 2688.45, 'value': 2635},
'weekHighLow': {'min': 1473.45,
'minDate': '24-Mar-2020',
'max': 2777.15,
'maxDate': '13-Jan-2021',
'value': 2635}}
```
## Command line interface
```
$ jdata stock --help
Usage: jdata stock [OPTIONS]
Download historical stock data
$jdata stock --symbol STOCK1 -f yyyy-mm-dd -t yyyy-mm-dd --o file_name.csv
Options:
-s, --symbol TEXT [required]
-f, --from TEXT [required]
-t, --to TEXT [required]
-S, --series TEXT [default: EQ]
-o, --output TEXT
--help Show this message and exit.
```
```
$ jdata stock -s SBIN -f 2020-01-01 -t 2020-01-31 -o SBIN-Jan.csv
SBIN [####################################] 100%
Saved file to : SBIN-Jan.csv
```
## Download historical derivatives (F&O) data
```
$ jdata deriviatives --help
Usage: cli.py derivatives [OPTIONS]
Sample usage-
Download stock futures-
jdata derivatives -s SBIN -f 2020-01-01 -t 2020-01-30 -e 2020-01-30 -i FUTSTK -o file_name.csv
Download index futures-
jdata derivatives -s NIFTY -f 2020-01-01 -t 2020-01-30 -e 2020-01-30 -i FUTIDX -o file_name.csv
Download stock options-
jdata derivatives -s SBIN -f 2020-01-01 -t 2020-01-30 -e 2020-01-30 -i OPTSTK -p 330 --ce -o file_name.csv
Download index options-
jdata derivatives -s NIFTY -f 2020-01-01 -t 2020-01-30 -e 2020-01-23 -i OPTIDX -p 11000 --pe -o file_name.csv
Options:
-s, --symbol TEXT Stock/Index symbol [required]
-f, --from TEXT From date - yyyy-mm-dd [required]
-t, --to TEXT To date - yyyy-mm-dd [required]
-e, --expiry TEXT Expiry date - yyyy-mm-dd [required]
-i, --instru TEXT FUTSTK - Stock futures, FUTIDX - Index Futures, OPTSTK -
Stock Options, OPTIDX - Index Options [required]
-p, --price TEXT Strike price (Only for OPTSTK and OPTIDX)
--ce / --pe --ce for call and --pe for put (Only for OPTSTK and
OPTIDX)
-o, --output TEXT Full path of output file
--help Show this message and exit.
```
## Buy me a coffee
If my work has helped you in anyway, you can buy me a coffee
[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/Jugaader)
Raw data
{
"_id": null,
"home_page": "",
"name": "jugaad-data",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "NSE,Live,Bhavcopy,History,Futures,Options,Stock Data",
"author": "",
"author_email": "jugaad-coder <abc@xyz.com>",
"download_url": "https://files.pythonhosted.org/packages/69/2b/be9d1c28cc83d42e68a6b14748a60d46b8eb8e95ca77c51cd9bec5fd47d1/jugaad-data-0.26.tar.gz",
"platform": null,
"description": "# Documentation\n\nhttps://marketsetup.in/documentation/jugaad-data/\n\n# Introduction\n\n`jugaad-data` is a python library to download historical/live stock, index as well as economic data from NSE and RBI website using.\n\n![Build Badge](https://github.com/jugaad-py/jugaad-data/actions/workflows/run-tests.yml/badge.svg)\n\n\n# Features\n\n* Supports [new NSE website](https://www.nseindia.com/), (All libraries based on old NSE website might stop working)\n* Powerful CLI (Command line interface), Even non-coders can use it easily\n* Built-in caching mechanism to play nice with NSE. Avoid making un-necessary requests to NSE's website and getting blocked\n* Optional `pandas` support \n\n**Road map**\n\n| Website | Segment | Supported? |\n|----------|------------|------------|\n| NSE | Stocks | Yes |\n| NSE | Stocks F&O | Yes |\n| NSE | Index | Yes |\n| NSE | Index F&O | Yes |\n| RBI\t | Current Rates| Yes |\n\n# Installation\n\n`pip install jugaad-data` \n\n# Getting started\n\n## Python inteface\n\n### Historical data\n\n```python\nfrom datetime import date\nfrom jugaad_data.nse import bhavcopy_save, bhavcopy_fo_save\n\n# Download bhavcopy\nbhavcopy_save(date(2020,1,1), \"/path/to/directory\")\n\n# Download bhavcopy for futures and options\nbhavcopy_fo_save(date(2020,1,1), \"/path/to/directory\")\n\n# Download stock data to pandas dataframe\nfrom jugaad_data.nse import stock_df\ndf = stock_df(symbol=\"SBIN\", from_date=date(2020,1,1),\n to_date=date(2020,1,30), series=\"EQ\")\n```\n### Live data\n\n```python\nfrom jugaad_data.nse import NSELive\nn = NSELive()\nq = n.stock_quote(\"HDFC\")\nprint(q['priceInfo'])\n```\n\n```\n{'lastPrice': 2635,\n 'change': -49.05000000000018,\n 'pChange': -1.8274622305843848,\n 'previousClose': 2684.05,\n 'open': 2661,\n 'close': 2632.75,\n 'vwap': 2645.57,\n 'lowerCP': '2415.65',\n 'upperCP': '2952.45',\n 'pPriceBand': 'No Band',\n 'basePrice': 2684.05,\n 'intraDayHighLow': {'min': 2615.6, 'max': 2688.45, 'value': 2635},\n 'weekHighLow': {'min': 1473.45,\n 'minDate': '24-Mar-2020',\n 'max': 2777.15,\n 'maxDate': '13-Jan-2021',\n 'value': 2635}}\n```\n\n## Command line interface\n\n```\n$ jdata stock --help\n\nUsage: jdata stock [OPTIONS]\n\n Download historical stock data\n\n $jdata stock --symbol STOCK1 -f yyyy-mm-dd -t yyyy-mm-dd --o file_name.csv\n\nOptions:\n -s, --symbol TEXT [required]\n -f, --from TEXT [required]\n -t, --to TEXT [required]\n -S, --series TEXT [default: EQ]\n -o, --output TEXT\n --help Show this message and exit.\n```\n\n```\n$ jdata stock -s SBIN -f 2020-01-01 -t 2020-01-31 -o SBIN-Jan.csv\nSBIN [####################################] 100%\n\nSaved file to : SBIN-Jan.csv\n```\n\n## Download historical derivatives (F&O) data\n\n```\n$ jdata deriviatives --help\nUsage: cli.py derivatives [OPTIONS]\n\n Sample usage-\n\n Download stock futures-\n\n jdata derivatives -s SBIN -f 2020-01-01 -t 2020-01-30 -e 2020-01-30 -i FUTSTK -o file_name.csv\n\n Download index futures-\n\n jdata derivatives -s NIFTY -f 2020-01-01 -t 2020-01-30 -e 2020-01-30 -i FUTIDX -o file_name.csv\n\n Download stock options-\n\n jdata derivatives -s SBIN -f 2020-01-01 -t 2020-01-30 -e 2020-01-30 -i OPTSTK -p 330 --ce -o file_name.csv\n\n Download index options-\n\n jdata derivatives -s NIFTY -f 2020-01-01 -t 2020-01-30 -e 2020-01-23 -i OPTIDX -p 11000 --pe -o file_name.csv\n\nOptions:\n -s, --symbol TEXT Stock/Index symbol [required]\n -f, --from TEXT From date - yyyy-mm-dd [required]\n -t, --to TEXT To date - yyyy-mm-dd [required]\n -e, --expiry TEXT Expiry date - yyyy-mm-dd [required]\n -i, --instru TEXT FUTSTK - Stock futures, FUTIDX - Index Futures, OPTSTK -\n Stock Options, OPTIDX - Index Options [required]\n\n -p, --price TEXT Strike price (Only for OPTSTK and OPTIDX)\n --ce / --pe --ce for call and --pe for put (Only for OPTSTK and\n OPTIDX)\n\n -o, --output TEXT Full path of output file\n --help Show this message and exit.\n```\n\n## Buy me a coffee\n\nIf my work has helped you in anyway, you can buy me a coffee \n\n[![\"Buy Me A Coffee\"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/Jugaader)\n",
"bugtrack_url": null,
"license": "YOLO LICENSE Version 2, July 29 2016 THIS SOFTWARE LICENSE IS PROVIDED \"ALL CAPS\" SO THAT YOU KNOW IT IS SUPER SERIOUS AND YOU DON'T MESS AROUND WITH COPYRIGHT LAW BECAUSE YOU WILL GET IN TROUBLE HERE ARE SOME OTHER BUZZWORDS COMMONLY IN THESE THINGS WARRANTIES LIABILITY CONTRACT TORT LIABLE CLAIMS RESTRICTION MERCHANTABILITY. NOW HERE'S THE REAL LICENSE: 0. jugaad-data is in public domain. 1. Do whatever you want with it. 2. Stop emailing me about it!",
"summary": "Free Zerodha API python library",
"version": "0.26",
"project_urls": {
"Documentation": "https://marketsetup.in/documentation/jugaad-data/",
"Homepage": "https://marketsetup.in/documentation/jugaad-data/",
"Issues": "https://github.com/jugaad-py/jugaad-data/issues",
"Repository": "https://github.com/jugaad-py/jugaad-data"
},
"split_keywords": [
"nse",
"live",
"bhavcopy",
"history",
"futures",
"options",
"stock data"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "dff7750e8a299e5f236e4723d24f62667497c75b7fddc36f52ad9a46de59f89f",
"md5": "28f8f71753d49473f2b579ba9553a28e",
"sha256": "6e29374804f52e5545649b5fa3e466f0698471ab3b6d4f0d7c985d06eff1037e"
},
"downloads": -1,
"filename": "jugaad_data-0.26-py3-none-any.whl",
"has_sig": false,
"md5_digest": "28f8f71753d49473f2b579ba9553a28e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 17748,
"upload_time": "2023-12-23T19:28:02",
"upload_time_iso_8601": "2023-12-23T19:28:02.055033Z",
"url": "https://files.pythonhosted.org/packages/df/f7/750e8a299e5f236e4723d24f62667497c75b7fddc36f52ad9a46de59f89f/jugaad_data-0.26-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "692bbe9d1c28cc83d42e68a6b14748a60d46b8eb8e95ca77c51cd9bec5fd47d1",
"md5": "0479c7b114411baaac654324ef04ab58",
"sha256": "298a234c4ffc9695d955ff6444c67f2b8034ee61374920e2fe7264d8d29db779"
},
"downloads": -1,
"filename": "jugaad-data-0.26.tar.gz",
"has_sig": false,
"md5_digest": "0479c7b114411baaac654324ef04ab58",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 21650,
"upload_time": "2023-12-23T19:28:04",
"upload_time_iso_8601": "2023-12-23T19:28:04.079554Z",
"url": "https://files.pythonhosted.org/packages/69/2b/be9d1c28cc83d42e68a6b14748a60d46b8eb8e95ca77c51cd9bec5fd47d1/jugaad-data-0.26.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-23 19:28:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jugaad-py",
"github_project": "jugaad-data",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "jugaad-data"
}