Skip to content

Repository files navigation

Curo Python

Build StatuscodecovGitHub License

Curo Python is a powerful, open-source library for performing instalment credit financial calculations, from simple loans to complex leasing and hire purchase agreements. Built from the ground up in Python, it leverages pandas DataFrames for cash flow management and SciPy for efficient solving of unknown values or rates using Brent's method.

Explore the documentation, or try it in action with the Curo Calculator, a Flutter app showcasing similar functionality.

Why Curo Python?

Curo Python is designed for developers and financial professionals who need robust tools for fixed-term credit calculations. It goes beyond basic financial algebra, offering features typically found in commercial software, such as:

  • Solving for unknown cash flow values (e.g., instalment amounts).
  • Calculating implicit interest rates (e.g., IRR or APR).
  • Support for multiple day count conventions, including EU and US regulatory standards.
  • Flexible handling of cash flow series for loans, leases, and investment scenarios.

Check out the examples folder for practical use cases and accompanying cash flow diagrams that visualise inflows and outflows.

Getting Started

Installation

Install Curo Python using your preferred package manager:

With pip:

$ pip install --user curo

With uv:

$ uv add curo

Basic Usage

Curo Python makes financial calculations intuitive. Below are two examples demonstrating how to solve for an unknown cash flow value and an implicit interest rate.

Example 1: Solving for an Unknown Cash Flow Value

Calculate the monthly instalment for a $10,000 loan over 6 months at an 8.25% annual interest rate.

fromcuroimportCalculator, Mode, SeriesAdvance, SeriesPayment, US30360# Step 1: Create a calculator instancecalculator=Calculator()
# Step 2: Define cash flow seriescalculator.add(
SeriesAdvance(label="Loan", amount=10000.0)
)
calculator.add(
SeriesPayment(
number_of=6,
label="Instalment",
amount=None, # Set to None for unknown valuemode=Mode.ARREAR
)
)
# Step 3: Solve for the instalment amountresult=calculator.solve_value(
convention=US30360(),
interest_rate=0.0825
)
print(f"Monthly instalment: ${result:.2f}") # Output: $1707.00

Example 2: Solving for the Implicit Interest Rate

Find the internal rate of return (IRR) for a €10,000 loan repaid in 6 monthly instalments of €1,707.

fromcuroimportCalculator, EU200848EC, Mode, SeriesAdvance, SeriesPayment, US30360# Step 1: Create a calculator instancecalculator=Calculator()
# Step 2: Define cash flow seriescalculator.add(
SeriesAdvance(label="Loan", amount=10000.0)
)
calculator.add(
SeriesPayment(
number_of=6,
label="Instalment",
amount=1707.00,
mode=Mode.ARREAR
)
)
# Step 3: Calculate the IRR and APRirr=calculator.solve_rate(convention=US30360())
apr=calculator.solve_rate(convention=EU200848EC())
print(f"IRR: {irr*100:.6f}") # Output: 8.250040%print(f"APR: {apr*100:.6f}") # Output: 8.569257%

Key Features

Day Count Conventions

Day count conventions determine how time intervals between cash flows are measured. Curo Python supports a wide range of conventions to meet global financial standards:

ConventionDescription
Actual ISDAUses actual days, accounting for leap and non-leap year portions.
Actual/360Counts actual days, assuming a 360-day year.
Actual/365Counts actual days, assuming a 365-day year.
EU 30/360Assumes 30-day months and a 360-day year, per EU standards.
EU 2023/2225Compliant with EU Directive 2023/2225 for APR calculations in consumer credit.
UK CONC AppSupports UK APRC calculations for consumer credit, secured or unsecured.
US 30/360Default for many US calculations, using 30-day months and a 360-day year.
US 30U/360Like US 30/360, but treats February days uniformly as 30 days.
US Appendix JImplements US Regulation Z, Appendix J for APR in closed-end credit.

For XIRR-style calculations (referencing the first drawdown date), pass use_xirr_method=True to the convention constructor. When used with Actual/365, this matches Microsoft Excel’s XIRR function.

Cash Flow Diagrams

Cash flow diagrams visually represent the timing and direction of financial transactions. For example, a €10,000 loan repaid in 6 monthly instalments would look like this:

Cash Flow Diagram

  • Down arrows: Money received (e.g., loan advance).
  • Up arrows: Money paid (e.g., instalments).
  • Time line: Represents the contract term, divided into compounding periods.

License

Copyright © 2026, Andrew Murphy. Released under the MIT License.

Learn More

  • Examples: Dive into practical use cases in the examples folder.
  • Documentation: Refer to the code documentation for detailed class and method descriptions.
  • Issues & Contributions: Report bugs or contribute on GitHub.

About

Robust Python library for advanced instalment credit and financial calculations—perfect for loans, amortisation, and precise interest modeling.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages