# BseIndiaApi
An Unofficial Python Api for BSE India stock exchange.
Python version: >= 3.10
## 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": "",
"name": "bse",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "bse,bse-stock-data,stock-market-api,stock-news-api",
"author": "Benny Thadikaran",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/d7/67/489a86f20dd66e254968db50ebc70be399f049818145ceb3a0cdf8d017b5/bse-2.0.0.tar.gz",
"platform": null,
"description": "# BseIndiaApi\n\nAn Unofficial Python Api for BSE India stock exchange.\n\nPython version: >= 3.10\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": "",
"summary": "Unofficial Python Api for BSE India stock exchange",
"version": "2.0.0",
"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": "",
"digests": {
"blake2b_256": "084ec86a9e0ee46b6e646d946d616564401f70ae182d5853667db5ae922a2644",
"md5": "f57cdda7089960f9fe2e5198532c8786",
"sha256": "204bd90ef740db8e6e5c249043c0f276129231ba70ff275a1cbec3107ab93f7c"
},
"downloads": -1,
"filename": "bse-2.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f57cdda7089960f9fe2e5198532c8786",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 24957,
"upload_time": "2023-11-03T05:48:11",
"upload_time_iso_8601": "2023-11-03T05:48:11.767537Z",
"url": "https://files.pythonhosted.org/packages/08/4e/c86a9e0ee46b6e646d946d616564401f70ae182d5853667db5ae922a2644/bse-2.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d767489a86f20dd66e254968db50ebc70be399f049818145ceb3a0cdf8d017b5",
"md5": "a9d0ef05df728e73bb780b147fe69d5e",
"sha256": "170d910da922c9c88fe29f98cf8c87a23683a1de7ab537a6dff988edc262f937"
},
"downloads": -1,
"filename": "bse-2.0.0.tar.gz",
"has_sig": false,
"md5_digest": "a9d0ef05df728e73bb780b147fe69d5e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 32783,
"upload_time": "2023-11-03T05:48:13",
"upload_time_iso_8601": "2023-11-03T05:48:13.164189Z",
"url": "https://files.pythonhosted.org/packages/d7/67/489a86f20dd66e254968db50ebc70be399f049818145ceb3a0cdf8d017b5/bse-2.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-03 05:48:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "BennyThadikaran",
"github_project": "BseIndiaApi",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "bse"
}