From 33f07e61c37b682059dad2f7c974a16df99a1f59 Mon Sep 17 00:00:00 2001 From: Debasish Pal <48341250+debpal@users.noreply.github.com> Date: Mon, 9 Sep 2024 18:48:31 +0300 Subject: [PATCH] updates --- BharatFinTrack/nse_track.py | 8 ++++---- README.md | 25 +++++++------------------ docs/BharatFinTrack.rst | 18 ++---------------- docs/changelog.rst | 12 ++++++++++++ docs/conf.py | 3 ++- docs/index.rst | 7 ++++--- docs/modules.rst | 9 +++++---- docs/submodules.rst | 9 +++++++++ pyproject.toml | 2 +- tests/test_nse_track.py | 17 +++++++++++------ 10 files changed, 57 insertions(+), 53 deletions(-) create mode 100644 docs/changelog.rst create mode 100644 docs/submodules.rst diff --git a/BharatFinTrack/nse_track.py b/BharatFinTrack/nse_track.py index df5f70c..367e358 100644 --- a/BharatFinTrack/nse_track.py +++ b/BharatFinTrack/nse_track.py @@ -86,10 +86,10 @@ def downloadable_indices(self): return output - def is_valid_index(self, index): + def is_downloadable_index(self, index): ''' - Checks whether a specified NSE index name is valid. + Checks whether a specified NSE index name is downloadable. Parameters ---------- @@ -152,7 +152,7 @@ def get_index_base_date(self, index): The base date of the index in 'DD-MMM-YYYY' format. ''' - if self.is_valid_index(index): + if self.is_downloadable_index(index): pass else: raise Exception(f'Invalid index: {index}') @@ -176,7 +176,7 @@ def get_index_base_value(self, index): The base value of the index. ''' - if self.is_valid_index(index): + if self.is_downloadable_index(index): pass else: raise Exception(f'Invalid index: {index}') diff --git a/README.md b/README.md index d59fdf1..2579fa7 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,10 @@ # BharatFinTrack -## Analysis Toolkit - -| Feature | Badge| -| --- | --- | -| Documemt | [![Documentation Status](https://readthedocs.org/projects/bharatfintrack/badge/?version=latest)](https://bharatfintrack.readthedocs.io/en/latest/?badge=latest) | -| Version |![PyPI - Version](https://img.shields.io/pypi/v/BharatFinTrack) | - - ## What is BharatFinTrack? BharatFinTrack is a Python package designed to simplify the process of downloading and analyzing financial data from India, that is Bharat. The current features of the package include: - **NSE Indices** - Access to characteristics of indices. - - Download of historical daily Total Return Index (TRI) values. ## Easy Installation @@ -50,16 +41,14 @@ A brief example of how to start: ...} ``` - ## Documentation For detailed information, see the [documentation](https://bharatfintrack.readthedocs.io/en/latest/). +## Toolkit -## Development status - -The project is in the conceptualization and planning phases. - - -## License - -The package is released under the MIT License. \ No newline at end of file +| Feature | Badge| +| --- | --- | +| Version | ![PyPI - Version](https://img.shields.io/pypi/v/BharatFinTrack) | +| Staus | ![PyPI - Status](https://img.shields.io/pypi/status/BharatFinTrack) | +| License | ![PyPI - License](https://img.shields.io/pypi/l/BharatFinTrack) | +| Documemt | [![Documentation Status](https://readthedocs.org/projects/bharatfintrack/badge/?version=latest)](https://bharatfintrack.readthedocs.io/en/latest/?badge=latest) | diff --git a/docs/BharatFinTrack.rst b/docs/BharatFinTrack.rst index 8d05c5e..a44b22f 100644 --- a/docs/BharatFinTrack.rst +++ b/docs/BharatFinTrack.rst @@ -1,19 +1,5 @@ -BharatFinTrack package -====================== - -Submodules ----------- - -BharatFinTrack.nse\_track module --------------------------------- - -.. automodule:: BharatFinTrack.nse_track - :members: - :undoc-members: - :show-inheritance: - -Module contents ---------------- +BharatFinTrack Module +--------------------- .. automodule:: BharatFinTrack :members: diff --git a/docs/changelog.rst b/docs/changelog.rst new file mode 100644 index 0000000..303c260 --- /dev/null +++ b/docs/changelog.rst @@ -0,0 +1,12 @@ +============= +Release Notes +============= + +Version 0.0.1 +------------- + +* **Date:** 08-Sep-2024. +* **Features:** Access to characteristics of NSE Indices via the :class:`BharatFinTrack.NSETrack` class. +* **Development status:** Planning. +* **Roadmap:** Ongoing addition of new features. +* **Birth of** :mod:`BharatFinTrack`: 01-Sep-2024. \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 44a5c48..b2ba7d8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -33,7 +33,8 @@ # ones. extensions = [ 'sphinx.ext.autodoc', - 'sphinx.ext.napoleon' + 'sphinx.ext.napoleon', + 'sphinx.ext.viewcode' ] # Add any paths that contain templates here, relative to this directory. diff --git a/docs/index.rst b/docs/index.rst index 73aae26..b8c177f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -8,14 +8,15 @@ Welcome to BharatFinTrack's documentation! BharatFinTrack is a Python package designed to simplify the process of downloading and analyzing financial data, including indices, stocks, and mutual funds, -from India, that is, Bharat. +from India, that is Bharat. .. toctree:: - :maxdepth: 2 + :maxdepth: 1 :caption: Contents: Installation - modules + API Reference + Release Notes diff --git a/docs/modules.rst b/docs/modules.rst index e9159c3..befe653 100644 --- a/docs/modules.rst +++ b/docs/modules.rst @@ -1,7 +1,8 @@ -BharatFinTrack -============== +API Reference +============= .. toctree:: - :maxdepth: 4 + :maxdepth: 1 - BharatFinTrack + Submodules + BharatFinTrack Module diff --git a/docs/submodules.rst b/docs/submodules.rst new file mode 100644 index 0000000..d04f7de --- /dev/null +++ b/docs/submodules.rst @@ -0,0 +1,9 @@ +BharatFinTrack.nse\_track module +-------------------------------- + +.. automodule:: BharatFinTrack.nse_track + :members: + :undoc-members: + :show-inheritance: + + diff --git a/pyproject.toml b/pyproject.toml index f652ce8..c0978d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "BharatFinTrack" -description = "Downloading and analyzing financial data, including indices, stocks, and mutual funds, from India, that is, Bharat." +description = "Downloading and analyzing financial data, including indices, stocks, and mutual funds, from India, that is Bharat." authors = [ { name="Debasish Pal", email="bestdebasish@gmail.com" }, ] diff --git a/tests/test_nse_track.py b/tests/test_nse_track.py index 13e96a3..5d9f817 100644 --- a/tests/test_nse_track.py +++ b/tests/test_nse_track.py @@ -1,6 +1,5 @@ -import BharatFinTrack import pytest - +import BharatFinTrack @pytest.fixture(scope='module') def class_instance(): @@ -20,10 +19,10 @@ def test_get_indices_by_category(class_instance): assert exc_info.value.args[0] == 'Invadid category: non-existence' -def test_is_valid_index(class_instance): +def test_is_downloadable_index(class_instance): - assert class_instance.is_valid_index('NIFTY 50') == True - assert class_instance.is_valid_index('NIFTY ITI') == False + assert class_instance.is_downloadable_index('NIFTY 50') == True + assert class_instance.is_downloadable_index('non-existence') == False def test_get_index_base_date(class_instance): @@ -39,4 +38,10 @@ def test_get_index_base_date(class_instance): def test_get_index_base_value(class_instance): assert class_instance.get_index_base_value('NIFTY 50') == 1000.0 - assert class_instance.get_index_base_value('NIFTY IT') == 100.0 \ No newline at end of file + assert class_instance.get_index_base_value('NIFTY IT') == 100.0 + + # error test + with pytest.raises(Exception) as exc_info: + class_instance.get_index_base_value('non-existence') + assert exc_info.value.args[0] == 'Invalid index: non-existence' + \ No newline at end of file