Convert between APR (simple annual rate) and APY (effective annual yield including compounding). MIT.
Project description
calcfi-apr-apy
Convert between APR (simple annual rate) and APY (effective annual yield including compounding). MIT.
CalcFi APR vs APY Conversion — a single-purpose, MIT-licensed helper for Convert APR to APY and vice versa for any compounding frequency. APY = (1 + APR/n)^n − 1. Continuous compounding via e^APR − 1.
What this does
Convert APR to APY and vice versa for any compounding frequency. APY = (1 + APR/n)^n − 1. Continuous compounding via e^APR − 1.
Formula — APY conversion:
APY = (1 + APR/n)^n − 1 | APR = n × [(1 + APY)^(1/n) − 1]
Primary source: Truth in Lending Act / Regulation Z (12 CFR Part 1026)
Install
pip install calcfi-apr-apy
Usage
from calcfi_apr_apy import apr_to_apy, apy_to_apr
# 6% APR with monthly compounding
apr_to_apy(0.06, 12) # 0.0617 (6.17% APY)
Live calculator
Try the interactive web calculator with full UI at https://calcfi.app/calculators/apr-vs-apy — no signup required.
Why this package exists
Most personal-finance calculators are buried in advertising-heavy lead-generation sites. The math is freely published by federal agencies and textbooks, but the implementations are wrapped in proprietary opaque code. CalcFi publishes these utility libraries to make every formula:
- Reproducible — show the math
- Cited — link to primary sources
- Free — MIT license, no paid tier
- Auditable — every line of code is open source
The math here is undergraduate-level. The contribution is the citation discipline and the open distribution.
Part of the CalcFi ecosystem
This package is one of 8 single-purpose helper utilities. Cross-mesh:
Sibling Python packages
- calcfi-mortgage-payment — Standard amortizing-loan monthly payment formula. Free, cited, MIT.
- calcfi-compound-interest — Compound interest with periodic contributions. Future value, present value, time-to-target. Free, MIT.
- calcfi-rule-of-72 — Rule of 72 — approximate years to double an investment at a given rate. Plus exact ln(2) version. MIT.
- calcfi-real-return — Inflation-adjusted (real) return from nominal return. Formula: real = (1+nominal)/(1+inflation) − 1. MIT.
- calcfi-amortization — Generate a full amortization schedule for a fixed-rate loan: payment, principal, interest, balance per period. MIT.
- calcfi-tax-bracket — US federal income tax bracket math — marginal rate, effective rate, total tax owed. 2024-2026 brackets per IRS Rev. Proc. MIT.
- calcfi-debt-payoff — Snowball vs avalanche debt payoff strategies. Compute months and total interest. MIT.
Sibling npm packages
- calcfi-mortgage-payment — Standard amortizing-loan monthly payment formula. Free, cited, MIT.
- calcfi-compound-interest — Compound interest with periodic contributions. Future value, present value, time-to-target. Free, MIT.
- calcfi-rule-of-72 — Rule of 72 — approximate years to double an investment at a given rate. Plus exact ln(2) version. MIT.
- calcfi-real-return — Inflation-adjusted (real) return from nominal return. Formula: real = (1+nominal)/(1+inflation) − 1. MIT.
- calcfi-amortization — Generate a full amortization schedule for a fixed-rate loan: payment, principal, interest, balance per period. MIT.
- calcfi-tax-bracket — US federal income tax bracket math — marginal rate, effective rate, total tax owed. 2024-2026 brackets per IRS Rev. Proc. MIT.
- calcfi-debt-payoff — Snowball vs avalanche debt payoff strategies. Compute months and total interest. MIT.
Companion data
The mortgage rate, inflation, Treasury yield, and macro data used to validate these calculators are published as CalcFi Open Data — 34 free CC BY 4.0 time series, 117,956 observations, 5 permanent DOIs.
- CalcFi Open Data on Hugging Face
- Python
calcfidataSDK - npm
calcfidataSDK - Live SQL endpoint (Datasette)
- DOI 10.6084/m9.figshare.32332290
Calculators on CalcFi (free, no signup)
Every formula in these packages has a live web calculator at calcfi.app:
- Mortgage Payment
- Compound Interest
- Tax Bracket
- Amortization Schedule
- APR vs APY
- Rule of 72
- Inflation-Adjusted Return
- Debt Payoff
License
MIT. Author: Jere Salmisto (ORCID 0009-0000-0916-8684), founder of CalcFi. Based in Helsinki, Finland.
Citation
If you cite this package in research:
Salmisto, J. (2026). calcfi-apr-apy: CalcFi APR vs APY Conversion.
DOI: 10.6084/m9.figshare.32332290 (parent CalcFi Open Data dataset).
Available: https://calcfi.app/calculators/apr-vs-apy
Or use the CITATION.cff on the parent dataset for the BibTeX entry.
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 calcfi_apr_apy-0.1.0.tar.gz.
File metadata
- Download URL: calcfi_apr_apy-0.1.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb8a485d8c86933e52fe5034fd124a208e0fb46c5766dc04a64dca7379f4bbb9
|
|
| MD5 |
bb253d211ebe64d7e7022c11a7543ad5
|
|
| BLAKE2b-256 |
04eeeffc507e67c458df9a78d6a649c5d2a2d0fd871e19417223643203c8451d
|
File details
Details for the file calcfi_apr_apy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: calcfi_apr_apy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
177c48e5f3a8fd029058600be1862d719aac58782167d63706afc999e142bfb4
|
|
| MD5 |
8960e3e2a6659f74a3e14dd7edb6abbf
|
|
| BLAKE2b-256 |
db6fb88a8b5c9b4e40576646437448a7ed81da229e12b2aa4aff8146ae360a07
|