Skip to content

Commit 7b81335

Browse files
Code refactoring
1 parent f62af7f commit 7b81335

File tree

99 files changed

+199
-36596
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+199
-36596
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ __pycache__/
55
.pytest_cache/
66
build/
77
dist/
8+
site/
89
wheels/
910
*.egg-info
1011

CHANGELOG.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
1-
# History
1+
## [1.0.0-rc1] - 2026-01-09
22

3-
## 0.1.0 (2025-12-22)
3+
Initial release candidate of Curo Python, providing instalment credit calculations aligned with Curo Dart (`2.4.3`) core functionality.
44

5-
* First release on PyPI.
5+
### Added
6+
- `Calculator` class for solving cash flow values and rates using Brent's method.
7+
- Daycount conventions: `US30360`, `Actual360`, `EU200848EC`, and others.
8+
- Series classes: `SeriesAdvance`, `SeriesPayment`, `SeriesCharge`.
9+
- Enums: `Mode`, `Frequency`, `DayCountTimePeriod`.
10+
- Exceptions: `UnsolvableError`, `ValidationError`.
11+
- MkDocs documentation with `doctest`-verified examples.
12+
13+
### Notes
14+
- Feedback welcome on [GitHub](https://github.com/andrewmurphy353/curo_python) for `1.0.0`.
15+
- Targeting feature parity with Curo Dart `2.4.3`.
16+
17+
Install with `pip install curo==1.0.0-rc1`.

MANIFEST.in

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ include CHANGELOG.md
22
include LICENSE
33
include README.md
44

5-
recursive-include assets/images *
6-
recursive-include examples *.py
5+
recursive-include docs *.md *.py *.png *.pdf
76
recursive-include tests *
87
recursive-exclude * __pycache__
98
recursive-exclude * *.py[co]
10-
11-
recursive-include docs *.md Makefile *.jpg *.png *.gif

Makefile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
# Configuration
1414
PYTHON := python3.11
15-
DOCTEST_FILES := $(wildcard curo/daycount/*.py curo/calculator.py)
15+
#DOCTEST_FILES := $(wildcard curo/daycount/*.py docs/examples/*.md curo/calculator.py)
16+
DOCTEST_FILES := $(wildcard docs/tests/example_01.py)
1617
VENV_DIR := .venv
1718
UV := uv
1819

@@ -128,7 +129,7 @@ clean-venv:
128129
# Clean build artifacts
129130
.PHONY: clean-build
130131
clean-build:
131-
rm -rf dist/ build/ coverage_html/
132+
rm -rf build/ coverage_html/ dist/ site/
132133

133134
# Rebuild virtual environment
134135
.PHONY: rebuild-venv
@@ -137,11 +138,11 @@ rebuild-venv: clean
137138
$(UV) pip install ".[dev]" -e .
138139
$(UV) lock
139140

140-
.PHONY: serve-docs
141-
serve-docs:
141+
.PHONY: mkdocs-serve
142+
mkdocs-serve:
142143
$(UV) run mkdocs serve
143144

144145
# Deploy docs to GitHub pages
145-
.PHONY: deploy-docs
146-
deploy-docs:
146+
.PHONY: mkdocs-deploy
147+
mkdocs-deploy:
147148
$(UV) run mkdocs gh-deploy

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Curo Python is designed for developers and financial professionals who need robu
1717
- Support for multiple day count conventions, including EU and US regulatory standards.
1818
- Flexible handling of cash flow series for loans, leases, and investment scenarios.
1919

20-
Check out the [examples folder](https://github.com/andrewmurphy353/curo_python/tree/main/examples) for practical use cases and accompanying cash flow diagrams that visualize inflows and outflows.
20+
Check out the [examples folder](https://github.com/andrewmurphy353/curo_python/tree/main/examples) for practical use cases and accompanying cash flow diagrams that visualise inflows and outflows.
2121

2222
## Getting Started
2323

curo/__init__.py

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,52 @@
11
"""
2-
Curo - a feature-rich library for performing simple to advanced
3-
instalment credit financial calculations.
2+
Curo Python is a powerful, open-source library for performing instalment credit
3+
financial calculations, from simple loans to complex leasing and hire purchase
4+
agreements. Built from the ground up in Python, it leverages pandas DataFrames
5+
for cash flow management and SciPy for efficient solving of unknown values or
6+
rates using Brent's method.
47
"""
58

69
__author__ = "Andrew Murphy"
710
__email__ = "curocalculator@gmail.com"
11+
import importlib.metadata
12+
__version__ = importlib.metadata.version("curo")
813

9-
# Declare top-level shortcuts
10-
# from calculator import Calculator
11-
# from daycount.us_30_360 import US30360
12-
# from daycount.us_30u_360 import US30U360
13-
# from daycount.us_appendix_j import USAppendixJ
14-
# from series import SeriesAdvance, SeriesPayment, SeriesCharge
14+
# Expose public API classes and enums
15+
from .calculator import Calculator
16+
from .daycount.actual_360 import Actual360
17+
from .daycount.actual_365 import Actual365
18+
from .daycount.actual_isda import ActualISDA
19+
from .daycount.day_count_factor import DayCountFactor
20+
from .daycount.eu_30_360 import EU30360
21+
from .daycount.eu_2008_48 import EU200848EC
22+
from .daycount.uk_conc_app import UKConcApp
23+
from .daycount.us_30_360 import US30360
24+
from .daycount.us_30u_360 import US30U360
25+
from .daycount.us_appendix_j import USAppendixJ
26+
from .enums import DayCountTimePeriod, Frequency, Mode
27+
from .exceptions import UnsolvableError, ValidationError
28+
from .series import SeriesAdvance, SeriesPayment, SeriesCharge
1529

16-
# __all__ = [
17-
# "Calculator",
18-
# "US30360",
19-
# "US30U360",
20-
# "USAppendixJ",
21-
# "SeriesAdvance",
22-
# "SeriesPayment",
23-
# "SeriesCharge",
24-
# ]
30+
# Define what gets exported with `from curo import *`
31+
__all__ = [
32+
"Calculator",
33+
"Actual360",
34+
"Actual365",
35+
"ActualISDA",
36+
"DayCountFactor",
37+
"EU30360",
38+
"EU200848EC",
39+
"UKConcApp",
40+
"US30360",
41+
"US30U360",
42+
"USAppendixJ",
43+
"DayCountTimePeriod",
44+
"Frequency",
45+
"Mode",
46+
"UnsolvableError",
47+
"ValidationError",
48+
"SeriesAdvance",
49+
"SeriesPayment",
50+
"SeriesCharge",
51+
"__version__",
52+
]

curo/calculator.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
calculator.py
33
44
This module provides the Calculator class for performing financial calculations on cash flow series,
5-
including solving for effective interest rates and unknown cash flow amounts. It supports various day
6-
count conventions (e.g., US30360, USAppendixJ) and aligns with the Dart library for accuracy in loan
7-
amortization and APR calculations.
5+
including solving for effective interest rates and unknown cash flow amounts. It supports various
6+
day count conventions (e.g., US30360, USAppendixJ) and aligns with the Dart library for accuracy
7+
in loan amortization and APR calculations.
88
99
Key Features:
1010
- Solves for interest rates (`solve_rate`) to achieve a net future value (NFV) of zero.
11-
- Solves for one or more unknown payment or advance amounts (`solve_value`) with weighted adjustments.
11+
- Solves for one or more unknown payment or advance amounts (`solve_value`)
12+
with weighted adjustments.
1213
- Supports bespoke cash flow profiles (DataFrame) or series-based profiles (Series objects).
1314
- Handles USAppendixJ periodic rate conversions and interest amortization.
1415
- Provides precise, unrounded calculations with optional rounding to specified precision.

curo/enums.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ def periods_in_year(self) -> int:
9292

9393
class DayCountOrigin(Enum):
9494
"""
95-
Enum specifying the start date for calculating day counts in financial time periods.
95+
Enum used internally to define the start date for calculating day counts
96+
in financial time periods.
9697
9798
Attributes:
9899
DRAWDOWN: The initial drawdown post date, used in APR and XIRR calculations.

curo/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""
2-
Utility functions for date manipulation and numerical rounding in financial calculations.
2+
Utility functions used internally for date manipulation and numerical
3+
rounding in financial calculations.
34
"""
45

56
from typing import Union, Optional

0 commit comments

Comments
 (0)