Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
debpal committed Sep 9, 2024
1 parent 56c4c7b commit 33f07e6
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 53 deletions.
8 changes: 4 additions & 4 deletions BharatFinTrack/nse_track.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand Down Expand Up @@ -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}')
Expand All @@ -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}')
Expand Down
25 changes: 7 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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.
| 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) |
18 changes: 2 additions & 16 deletions docs/BharatFinTrack.rst
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
12 changes: 12 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 4 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <installation>
modules
API Reference <modules>
Release Notes <changelog>



Expand Down
9 changes: 5 additions & 4 deletions docs/modules.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
BharatFinTrack
==============
API Reference
=============

.. toctree::
:maxdepth: 4
:maxdepth: 1

BharatFinTrack
Submodules <submodules>
BharatFinTrack Module <BharatFinTrack>
9 changes: 9 additions & 0 deletions docs/submodules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
BharatFinTrack.nse\_track module
--------------------------------

.. automodule:: BharatFinTrack.nse_track
:members:
:undoc-members:
:show-inheritance:


2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
]
Expand Down
17 changes: 11 additions & 6 deletions tests/test_nse_track.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import BharatFinTrack
import pytest

import BharatFinTrack

@pytest.fixture(scope='module')
def class_instance():
Expand All @@ -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):
Expand All @@ -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
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'

0 comments on commit 33f07e6

Please sign in to comment.