Skip to content

Commit

Permalink
update code
Browse files Browse the repository at this point in the history
  • Loading branch information
debpal committed Nov 26, 2024
1 parent 0111217 commit 68390f4
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
python-version: ["3.12", "3.11"]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/typing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
python-version: ["3.12", "3.11"]

steps:
- uses: actions/checkout@v4
Expand Down
1 change: 0 additions & 1 deletion BharatFinTrack/nse_tri.py
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,6 @@ def sip_growth_comparison_across_indices(

return aggregate_df

# not testes yet
def sip_xirr_comparison_across_indices(
self,
indices: list[str],
Expand Down
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# BharatFinTrack

| <big>Status</big> | <big>Description</big> |
| --- | --- |
| **PyPI**| ![PyPI - Version](https://img.shields.io/pypi/v/BharatFinTrack) ![PyPI - Status](https://img.shields.io/pypi/status/BharatFinTrack) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/BharatFinTrack) ![PyPI - Wheel](https://img.shields.io/pypi/wheel/BharatFinTrack) |
| **GitHub** | ![GitHub last commit](https://img.shields.io/github/last-commit/debpal/BharatFinTrack) [![flake8](https://github.com/debpal/BharatFinTrack/actions/workflows/linting.yml/badge.svg)](https://github.com/debpal/BharatFinTrack/actions/workflows/linting.yml) [![mypy](https://github.com/debpal/BharatFinTrack/actions/workflows/typing.yml/badge.svg)](https://github.com/debpal/BharatFinTrack/actions/workflows/typing.yml) [![pytest](https://github.com/debpal/BharatFinTrack/actions/workflows/testing.yml/badge.svg)](https://github.com/debpal/BharatFinTrack/actions/workflows/testing.yml) |
| **Codecov** | [![codecov](https://codecov.io/github/debpal/BharatFinTrack/graph/badge.svg?token=6DIYX8MUTM)](https://codecov.io/github/debpal/BharatFinTrack) |
| **Read** _the_ **Docs** | [![Documentation Status](https://readthedocs.org/projects/bharatfintrack/badge/?version=latest)](https://bharatfintrack.readthedocs.io/en/latest/?badge=latest) |
| **PePy** | ![Pepy Total Downloads](https://img.shields.io/pepy/dt/BharatFinTrack)|
| **License** | ![PyPI - License](https://img.shields.io/pypi/l/BharatFinTrack) |


`BharatFinTrack` is a Python package designed to simplify the process of downloading and analyzing financial data from India. Conceptualized on September 1, 2024, and launched on September 8, 2024, this package is tailored for long-term investors seeking to streamline their financial data workflows.

Expand Down Expand Up @@ -85,15 +94,3 @@ If this project has been helpful and you'd like to contribute to its development


[![Buy Me a Coffee](https://img.shields.io/badge/☕_Buy_me_a_coffee-FFDD00?style=for-the-badge)](https://www.buymeacoffee.com/debasish_pal)


## Toolkit

| <big>Status</big> | <big>Description</big> |
| --- | --- |
| **PyPI**| ![PyPI - Version](https://img.shields.io/pypi/v/BharatFinTrack) ![PyPI - Status](https://img.shields.io/pypi/status/BharatFinTrack) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/BharatFinTrack) ![PyPI - Wheel](https://img.shields.io/pypi/wheel/BharatFinTrack) |
| **GitHub** | ![GitHub last commit](https://img.shields.io/github/last-commit/debpal/BharatFinTrack) [![flake8](https://github.com/debpal/BharatFinTrack/actions/workflows/linting.yml/badge.svg)](https://github.com/debpal/BharatFinTrack/actions/workflows/linting.yml) [![mypy](https://github.com/debpal/BharatFinTrack/actions/workflows/typing.yml/badge.svg)](https://github.com/debpal/BharatFinTrack/actions/workflows/typing.yml) [![pytest](https://github.com/debpal/BharatFinTrack/actions/workflows/testing.yml/badge.svg)](https://github.com/debpal/BharatFinTrack/actions/workflows/testing.yml) |
| **Codecov** | [![codecov](https://codecov.io/github/debpal/BharatFinTrack/graph/badge.svg?token=6DIYX8MUTM)](https://codecov.io/github/debpal/BharatFinTrack) |
| **Read** _the_ **Docs** | [![Documentation Status](https://readthedocs.org/projects/bharatfintrack/badge/?version=latest)](https://bharatfintrack.readthedocs.io/en/latest/?badge=latest) |
| **PePy** | ![Pepy Total Downloads](https://img.shields.io/pepy/dt/BharatFinTrack)|
| **License** | ![PyPI - License](https://img.shields.io/pypi/l/BharatFinTrack) |
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies = [
"pyxirr"
]
readme = "README.md"
requires-python = ">=3.11"
requires-python = ">=3.10, <3.13"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3.12",
Expand Down
33 changes: 29 additions & 4 deletions tests/test_bharatfintrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,12 +507,20 @@ def test_sip(
start_date='15-Oct-2022',
end_date='15-Oct-2024'
)
merged_df = nse_tri.sip_growth_comparison_across_indices(
# SIP growth comparison
aggregate_df = nse_tri.sip_growth_comparison_across_indices(
indices=[index, index_1],
folder_path=tmp_dir,
excel_file=os.path.join(tmp_dir, 'sip_invest_growth_across_indices.xlsx')
excel_file=os.path.join(tmp_dir, 'compare_sip_growth_across_indices.xlsx')
)
assert len(merged_df.columns) == 5
assert len(aggregate_df.columns) == 2
# SIP XIRR comparison
aggregate_df = nse_tri.sip_xirr_comparison_across_indices(
indices=[index, index_1],
folder_path=tmp_dir,
excel_file=os.path.join(tmp_dir, 'compare_sip_xirr_across_indices.xlsx')
)
assert len(aggregate_df.columns) == 2
# error test for unequal end date of two indices
nse_tri.download_historical_daily_data(
index='NIFTY ALPHA 50',
Expand All @@ -527,11 +535,20 @@ def test_sip(
figure_file=figure_file
)
assert exc_info.value.args[0] == 'Last date must be equal across all indices in the Excel files.'
# SIP growth comparison
with pytest.raises(Exception) as exc_info:
nse_tri.sip_growth_comparison_across_indices(
indices=['NIFTY 50', 'NIFTY ALPHA 50'],
folder_path=tmp_dir,
excel_file=os.path.join(tmp_dir, 'sip_invest_growth_across_indices.xlsx')
excel_file=os.path.join(tmp_dir, 'comare_sip_growth_across_indices.xlsx')
)
assert exc_info.value.args[0] == 'Last date must be equal across all indices in the Excel files.'
# SIP XIRR comparison
with pytest.raises(Exception) as exc_info:
nse_tri.sip_xirr_comparison_across_indices(
indices=['NIFTY 50', 'NIFTY ALPHA 50'],
folder_path=tmp_dir,
excel_file=os.path.join(tmp_dir, 'compare_sip_xirr_across_indices.xlsx')
)
assert exc_info.value.args[0] == 'Last date must be equal across all indices in the Excel files.'
# error test for invalid input of year and month
Expand Down Expand Up @@ -637,6 +654,14 @@ def test_error_excel(
)
assert exc_info.value.args[0] == message['error_excel']

with pytest.raises(Exception) as exc_info:
nse_tri.sip_xirr_comparison_across_indices(
indices=['NIFTY 50'],
folder_path=r"C:\Users\Username\Folder",
excel_file='output.xl'
)
assert exc_info.value.args[0] == message['error_excel']


def test_error_figure(
visual,
Expand Down

0 comments on commit 68390f4

Please sign in to comment.