Skip to main content

A feature-rich library for performing simple to advanced instalment credit financial calculations.

Project description

Curo Python

Build Status codecov GitHub 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.

from curo import Calculator, Mode, SeriesAdvance, SeriesPayment, US30360

# Step 1: Create a calculator instance
calculator = Calculator()

# Step 2: Define cash flow series
calculator.add(
    SeriesAdvance(label="Loan", amount=10000.0)
)
calculator.add(
    SeriesPayment(
        number_of=6,
        label="Instalment",
        amount=None,  # Set to None for unknown value
        mode=Mode.ARREAR
    )
)

# Step 3: Solve for the instalment amount
result = 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.

from curo import Calculator, EU200848EC, Mode, SeriesAdvance, SeriesPayment, US30360

# Step 1: Create a calculator instance
calculator = Calculator()

# Step 2: Define cash flow series
calculator.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 APR
irr = 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:

Convention Description
Actual ISDA Uses actual days, accounting for leap and non-leap year portions.
Actual/360 Counts actual days, assuming a 360-day year.
Actual/365 Counts actual days, assuming a 365-day year.
EU 30/360 Assumes 30-day months and a 360-day year, per EU standards.
EU 2023/2225 Compliant with EU Directive 2023/2225 for APR calculations in consumer credit.
UK CONC App Supports UK APRC calculations for consumer credit, secured or unsecured.
US 30/360 Default for many US calculations, using 30-day months and a 360-day year.
US 30U/360 Like US 30/360, but treats February days uniformly as 30 days.
US Appendix J Implements 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

curo-1.0.0.tar.gz (372.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

curo-1.0.0-py3-none-any.whl (41.9 kB view details)

Uploaded Python 3

File details

Details for the file curo-1.0.0.tar.gz.

File metadata

  • Download URL: curo-1.0.0.tar.gz
  • Upload date:
  • Size: 372.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for curo-1.0.0.tar.gz
Algorithm Hash digest
SHA256 02eca8a8b6fa053693f761181d5d5d5249483f2b8c8d1d9e00cb834f65eca8b7
MD5 24189324bf4c358b2efa1970b1701ddb
BLAKE2b-256 0c0a3859160aa54acc1995ee364dff9db142851e97557b327f784d3e4d99beb7

See more details on using hashes here.

File details

Details for the file curo-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: curo-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 41.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for curo-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ba9357cccb3c7385a1a6b2be85063d655806c31b4d4d13d69dfc2df172fe6aa
MD5 83bb47b0048032f44c5be2e6f21f6ed4
BLAKE2b-256 163b4040d954e2caac0e3374e6e97a87837c5c1b3c7e203aee143c778c6261f7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page