MoneyWarp – Bend time. Model cash.
Project description
MoneyWarp
Bend time. Model cash.
Development Stage Notice -- MoneyWarp is in active development (alpha). Core classes are stable and covered by 1200+ tests, but the API may evolve.
MoneyWarp is a Python library for working with the time value of money. It treats loans, annuities, and investments as cash flows through time -- and gives you the tools to warp them back and forth between present, future, and everything in between.
Features
- Time Machine (Warp) -- travel to any date and see loan state as of that moment
- PMT, NPV, IRR, MIRR -- core finance functions powered by scipy
- Loan tracking -- payments, fines, mora interest, grace periods
- High-precision Money -- Decimal arithmetic, never floats
- Amortization schedules -- French (Price) and SAC (Inverted Price)
- Flexible dates -- irregular due dates, smart month-end handling
- Type-safe interest rates -- explicit percentage handling, frequency conversions
- Installments and Settlements -- first-class repayment plan and payment allocation
- Tax module -- Brazilian IOF, grossup, pluggable tax strategy
- Timezone-aware -- UTC by default, configurable globally
- Marshmallow extension -- custom fields for serialization
- SQLAlchemy extension -- column types + loan/settlement bridge with SQL-queryable balance
Installation
pip install money-warp
With optional extensions:
pip install money-warp[marshmallow] # Marshmallow fields
pip install money-warp[sa] # SQLAlchemy types + bridge
Quick Start
from datetime import datetime, timezone
from money_warp import Money, InterestRate, Loan, generate_monthly_dates
from money_warp.tz import to_date
principal = Money("10000.00")
rate = InterestRate("5% a") # 5% annually
start_date = datetime(2024, 1, 15, tzinfo=timezone.utc)
due_dates = [to_date(d) for d in generate_monthly_dates(start_date, 12)]
loan = Loan(principal, rate, due_dates)
schedule = loan.get_amortization_schedule()
print(f"Monthly payment: {schedule[0].payment_amount}")
print(f"Total interest: {schedule.total_interest}")
loan.record_payment(Money("856.07"), datetime(2024, 2, 1, tzinfo=timezone.utc))
print(f"Remaining balance: {loan.current_balance}")
Time Machine
Travel to any date and see the loan exactly as it was -- payments, interest, fines, everything filtered to that moment:
from money_warp import Warp, Loan, Money, InterestRate
from datetime import date, datetime
loan = Loan(Money("10000"), InterestRate("5% a"), [date(2024, 1, 15)])
loan.record_payment(Money("500"), datetime(2024, 1, 10))
loan.record_payment(Money("600"), datetime(2024, 2, 10))
loan.record_payment(Money("700"), datetime(2024, 3, 10))
# Warp to the past -- only payments made by that date are visible
with Warp(loan, datetime(2024, 1, 20)) as past_loan:
print(f"Balance on Jan 20: {past_loan.current_balance}")
# Warp to the future
with Warp(loan, datetime(2025, 1, 1)) as future_loan:
print(f"Balance in 2025: {future_loan.current_balance}")
# Original loan is unchanged
print(f"Present balance: {loan.current_balance}")
Documentation
Full guides, examples, and API reference at tomascorrea.github.io/money-warp.
- Quick Start
- Money and Precision
- Interest Rates
- Cash Flow Analysis
- Date Generation
- Time Machine
- Present Value and IRR
- Fines and Mora Interest
- Tax and IOF
- Timezone Handling
- Marshmallow Extension
- SQLAlchemy Extension
- API Reference
Contributing
Contributions are welcome! See the Contributing Guide for details.
License
MIT -- see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file money_warp-0.27.0.tar.gz.
File metadata
- Download URL: money_warp-0.27.0.tar.gz
- Upload date:
- Size: 78.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9445578f2407929ee4f9c098ae50b9052aad011bad8a06159de0cec8da1a9ebc
|
|
| MD5 |
231647c328166ffebdc1413cfc108ce1
|
|
| BLAKE2b-256 |
4808e0fc8a222d42a06c7f5fc175a06b2849adfd8feb6e9cd6ed1a9dcce6a69c
|
Provenance
The following attestation bundles were made for money_warp-0.27.0.tar.gz:
Publisher:
on-release-pypi.yml on tomascorrea/money-warp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
money_warp-0.27.0.tar.gz -
Subject digest:
9445578f2407929ee4f9c098ae50b9052aad011bad8a06159de0cec8da1a9ebc - Sigstore transparency entry: 1463614837
- Sigstore integration time:
-
Permalink:
tomascorrea/money-warp@ad52040bb5d3c7550bce924930be4073354d9115 -
Branch / Tag:
refs/tags/v0.27.0 - Owner: https://github.com/tomascorrea
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
on-release-pypi.yml@ad52040bb5d3c7550bce924930be4073354d9115 -
Trigger Event:
release
-
Statement type:
File details
Details for the file money_warp-0.27.0-py3-none-any.whl.
File metadata
- Download URL: money_warp-0.27.0-py3-none-any.whl
- Upload date:
- Size: 102.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4115400853be8b1bbdf6e60375bb3e18c67acb7062e4ce26e545d4e21c20c4d6
|
|
| MD5 |
5e1a5b9cc61a59d3928cf44eb080bd0b
|
|
| BLAKE2b-256 |
b4e0ee764c2d6e7b60ed077771e9b4abe6a0c342924f93b14bb0f5fa1a1ed16b
|
Provenance
The following attestation bundles were made for money_warp-0.27.0-py3-none-any.whl:
Publisher:
on-release-pypi.yml on tomascorrea/money-warp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
money_warp-0.27.0-py3-none-any.whl -
Subject digest:
4115400853be8b1bbdf6e60375bb3e18c67acb7062e4ce26e545d4e21c20c4d6 - Sigstore transparency entry: 1463614846
- Sigstore integration time:
-
Permalink:
tomascorrea/money-warp@ad52040bb5d3c7550bce924930be4073354d9115 -
Branch / Tag:
refs/tags/v0.27.0 - Owner: https://github.com/tomascorrea
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
on-release-pypi.yml@ad52040bb5d3c7550bce924930be4073354d9115 -
Trigger Event:
release
-
Statement type: