# BseIndiaApi
An Unofficial Python Api for BSE India stock exchange.
Python version: >= 3.8
## Install with PIP
```
pip install -U bse
```
## Documentation
[https://bennythadikaran.github.io/BseIndiaApi/](https://bennythadikaran.github.io/BseIndiaApi/)
You might like [stock-news](https://github.com/BennyThadikaran/stock-news) built using `BseIndiaApi`. It helps to keep track of corporate announcements and actions on your portfolio.
## Usage
Using with statement
```python
from bse import BSE
with BSE(download_folder='./') as bse:
scripCode = bse.getScripCode('tcs') # 532540 bse scrip code
data = bse.actions(scripcode=scripCode)
ohlc = bse.quote(scripCode) # Open, High, Low, LTP
```
or
```python
from bse import BSE
from bse.constants import INDEX
bse = BSE(download_folder='./')
code = bse.getScripCode('tcs') # 532540 bse scrip code
gainers = bse.gainers(by='index', name=INDEX.BSE500)
bse.exit() # close the request session
```
## Sample Responses
`src/samples` contain the sample responses from the various methods in JSON format.
The files are named after the corresponding method in `src/BSE.py`. Use it to understand the API response structure.
## Example Folder
`src/examples` contains scripts that use the `BSE.py`.
To use the scripts download or clone the repo.
- [get_all_announcements.py](https://github.com/BennyThadikaran/BseIndiaApi/blob/main/src/examples/get_all_announcements.py): This file demonstrates how to paginate and get all announcements using `BSE.announcements`. It has step by step explanation of code.
- [actions.py](https://github.com/BennyThadikaran/BseIndiaApi/blob/main/src/examples/actions.py): `py actions.py infy` to print the recent corporate actions. Nothing more.
- [advances.py](https://github.com/BennyThadikaran/BseIndiaApi/blob/main/src/examples/advances.py): `py advances.py` to print the advance decline ratios for various bse Indexes.
You may also like my other repo: [Stock-News](https://github.com/BennyThadikaran/stock-news) - It uses BseIndiaApi and displays stock announcements, dividend, bonus/splits and upcoming results etc for your portfolio or watchlist stocks.
Raw data
{
"_id": null,
"home_page": null,
"name": "bse",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "bse, bse-stock-data, stock-market-api, stock-news-api",
"author": "Benny Thadikaran",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/87/8f/2d17350737573bbbba604a152d46032ee23de0755793cac3463a794a05ce/bse-3.0.2.tar.gz",
"platform": null,
"description": "# BseIndiaApi\n\nAn Unofficial Python Api for BSE India stock exchange.\n\nPython version: >= 3.8\n\n## Install with PIP\n\n```\npip install -U bse\n```\n\n## Documentation\n\n[https://bennythadikaran.github.io/BseIndiaApi/](https://bennythadikaran.github.io/BseIndiaApi/)\n\nYou might like [stock-news](https://github.com/BennyThadikaran/stock-news) built using `BseIndiaApi`. It helps to keep track of corporate announcements and actions on your portfolio.\n\n## Usage\n\nUsing with statement\n\n```python\nfrom bse import BSE\n\nwith BSE(download_folder='./') as bse:\n scripCode = bse.getScripCode('tcs') # 532540 bse scrip code\n\n data = bse.actions(scripcode=scripCode)\n\n ohlc = bse.quote(scripCode) # Open, High, Low, LTP\n```\n\nor\n\n```python\nfrom bse import BSE\nfrom bse.constants import INDEX\n\nbse = BSE(download_folder='./')\n\ncode = bse.getScripCode('tcs') # 532540 bse scrip code\n\ngainers = bse.gainers(by='index', name=INDEX.BSE500)\n\nbse.exit() # close the request session\n```\n\n## Sample Responses\n\n`src/samples` contain the sample responses from the various methods in JSON format.\n\nThe files are named after the corresponding method in `src/BSE.py`. Use it to understand the API response structure.\n\n## Example Folder\n\n`src/examples` contains scripts that use the `BSE.py`.\n\nTo use the scripts download or clone the repo.\n\n- [get_all_announcements.py](https://github.com/BennyThadikaran/BseIndiaApi/blob/main/src/examples/get_all_announcements.py): This file demonstrates how to paginate and get all announcements using `BSE.announcements`. It has step by step explanation of code.\n- [actions.py](https://github.com/BennyThadikaran/BseIndiaApi/blob/main/src/examples/actions.py): `py actions.py infy` to print the recent corporate actions. Nothing more.\n- [advances.py](https://github.com/BennyThadikaran/BseIndiaApi/blob/main/src/examples/advances.py): `py advances.py` to print the advance decline ratios for various bse Indexes.\n\nYou may also like my other repo: [Stock-News](https://github.com/BennyThadikaran/stock-news) - It uses BseIndiaApi and displays stock announcements, dividend, bonus/splits and upcoming results etc for your portfolio or watchlist stocks.\n",
"bugtrack_url": null,
"license": null,
"summary": "Unofficial Python Api for BSE India stock exchange",
"version": "3.0.2",
"project_urls": {
"Bug Tracker": "https://github.com/BennyThadikaran/BseIndiaApi/issues",
"Homepage": "https://github.com/BennyThadikaran/BseIndiaApi"
},
"split_keywords": [
"bse",
" bse-stock-data",
" stock-market-api",
" stock-news-api"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "fdff0a0c2d09fc93ff896d41a0f3de39ec598d0978f6c9118272ac6fa15ed37d",
"md5": "29ca8284f80dc61411fe6538c27a4b36",
"sha256": "9f9e560ed09e942c01046ba83559fd35bea613eea9e1fcd034ca174b3be9e407"
},
"downloads": -1,
"filename": "bse-3.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "29ca8284f80dc61411fe6538c27a4b36",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 26597,
"upload_time": "2025-07-16T09:16:16",
"upload_time_iso_8601": "2025-07-16T09:16:16.548954Z",
"url": "https://files.pythonhosted.org/packages/fd/ff/0a0c2d09fc93ff896d41a0f3de39ec598d0978f6c9118272ac6fa15ed37d/bse-3.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "878f2d17350737573bbbba604a152d46032ee23de0755793cac3463a794a05ce",
"md5": "4c683c02297b5e87e776242fa4aca3a6",
"sha256": "73ce35ee7641af4f1ab6ba6c12e8e7fd056ae1cf15071a84c45064f954c5f727"
},
"downloads": -1,
"filename": "bse-3.0.2.tar.gz",
"has_sig": false,
"md5_digest": "4c683c02297b5e87e776242fa4aca3a6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 27350,
"upload_time": "2025-07-16T09:16:17",
"upload_time_iso_8601": "2025-07-16T09:16:17.954619Z",
"url": "https://files.pythonhosted.org/packages/87/8f/2d17350737573bbbba604a152d46032ee23de0755793cac3463a794a05ce/bse-3.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-16 09:16:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "BennyThadikaran",
"github_project": "BseIndiaApi",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "bse"
}