/core:time-value-of-moneyfrom core
Calculates PV, FV, NPV, IRR, loan payments, and amortization schedules across all compounding conventions. Activates on requests about discounting cash flows, annuities, perpetuities, mortgage tables, project valuation, or rate-of-return problems.
Ships in core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
The value of a present sum after earning interest for n periods at rate r per period.
$$FV = PV \times (1 + r)^n$$
Future value grows exponentially with time, which is the mathematical basis of compound interest.
The current worth of a future sum, discounted back at rate r for n periods. This is the inverse of future value.
$$PV = \frac{FV}{(1 + r)^n}$$
Present value is the cornerstone of all valuation: a dollar today is worth more than a dollar tomorrow because of the opportunity cost of capital.
Interest can compound at different frequencies. The nominal annual rate r_nom compounded m times per year produces different effective yields.
Discrete compounding (m times per year):
$$FV = PV \times \left(1 + \frac{r_{nom}}{m}\right)^{m \times t}$$
Continuous compounding:
$$FV = PV \times e^{r \times t}$$
Effective Annual Rate (EAR):
$$EAR = \left(1 + \frac{r_{nom}}{m}\right)^m - 1$$
For continuous compounding: EAR = e^(r_nom) - 1
Common frequencies:
| Frequency | m |
|---|---|
| Annual | 1 |
| Semi-annual | 2 |
| Quarterly | 4 |
| Monthly | 12 |
| Daily | 365 |
| Continuous | infinity |
A series of equal payments made at the end of each period for n periods.
Present Value:
$$PV = PMT \times \frac{1 - (1 + r)^{-n}}{r}$$
Future Value:
$$FV = PMT \times \frac{(1 + r)^n - 1}{r}$$
A series of equal payments made at the beginning of each period. Each cash flow is one period closer than in an ordinary annuity, so values are scaled by (1 + r).
Present Value:
$$PV = PMT \times \frac{1 - (1 + r)^{-n}}{r} \times (1 + r)$$
Future Value:
$$FV = PMT \times \frac{(1 + r)^n - 1}{r} \times (1 + r)$$
A finite series of payments that grow at a constant rate g per period, where g != r.
Present Value:
$$PV = \frac{PMT}{r - g} \times \left[1 - \left(\frac{1 + g}{1 + r}\right)^n\right]$$
This is widely used in equity valuation (e.g., multi-stage dividend discount models) and salary/pension projections.
An infinite stream of equal payments.
$$PV = \frac{PMT}{r}$$
An infinite stream of payments growing at constant rate g, where g < r for convergence.
$$PV = \frac{PMT}{r - g}$$
This is the Gordon Growth Model when applied to dividends.
The sum of all discounted cash flows, including the initial investment. A positive NPV indicates value creation.
$$NPV = \sum_{t=0}^{T} \frac{CF_t}{(1 + r)^t}$$
Typically, CF_0 is a negative outflow (initial investment), and subsequent CF_t are inflows.
The discount rate r that makes the NPV of all cash flows exactly zero.
$$0 = \sum_{t=0}^{T} \frac{CF_t}{(1 + r)^t}$$
IRR is solved numerically (Newton-Raphson or bisection) since there is no closed-form solution for general cash flow streams. For conventional cash flows (one sign change), a unique IRR exists.
Each payment on an amortizing loan is split into an interest component and a principal component:
Interest_t = Balance_{t-1} * rPrincipal_t = PMT - Interest_tBalance_t = Balance_{t-1} - Principal_tOver time, the interest portion decreases and the principal portion increases.
| Formula | Expression | Use Case |
|---|---|---|
| Future Value | FV = PV * (1 + r)^n | Compound a lump sum forward |
| Present Value | PV = FV / (1 + r)^n | Discount a future lump sum |
| EAR | (1 + r_nom/m)^m - 1 | Compare rates across compounding frequencies |
| Continuous FV | FV = PV * e^(r*t) | Continuous compounding |
| Ordinary Annuity PV | PMT * [1 - (1+r)^(-n)] / r | Loan payments, lease valuation |
| Annuity Due PV | PMT * [1 - (1+r)^(-n)] / r * (1+r) | Rent, insurance (paid in advance) |
| Growing Annuity PV | PMT/(r-g) * [1 - ((1+g)/(1+r))^n] | Salary streams, growing dividends |
| Perpetuity PV | PMT / r | Preferred stock, consol bonds |
| Growing Perpetuity PV | PMT / (r - g) | Gordon Growth Model |
| NPV | sum(CF_t / (1+r)^t) | Project/investment evaluation |
| IRR | solve: sum(CF_t / (1+r)^t) = 0 | Return metric for uneven cash flows |
Given: A $300,000 mortgage at a 6.5% annual interest rate, fixed for 30 years, with monthly payments (ordinary annuity).
Calculate: The monthly payment amount.
Solution:
First, convert the annual rate to a monthly rate and years to months:
r_monthly = 0.065 / 12 = 0.00541667
n = 30 * 12 = 360 months
Using the ordinary annuity present value formula, solve for PMT:
PV = PMT * [1 - (1 + r)^(-n)] / r
300,000 = PMT * [1 - (1.00541667)^(-360)] / 0.00541667
Compute the annuity factor:
(1.00541667)^360 = 6.99179
(1.00541667)^(-360) = 0.143010
1 - 0.143010 = 0.856990
0.856990 / 0.00541667 = 158.2108
Solve for PMT:
PMT = 300,000 / 158.2108 = $1,896.20
The monthly mortgage payment is $1,896.20.
Over 30 years, total payments = 360 * $1,896.20 = $682,632, meaning total interest paid is $682,632 - $300,000 = $382,632.
Given: A project requires an initial investment of $50,000 and produces the following cash flows:
The required rate of return (discount rate) is 10%.
Calculate: The NPV and whether the project should be accepted.
Solution:
Discount each cash flow to present value:
PV(CF_0) = -50,000 / (1.10)^0 = -50,000.00
PV(CF_1) = 12,000 / (1.10)^1 = 10,909.09
PV(CF_2) = 15,000 / (1.10)^2 = 12,396.69
PV(CF_3) = 18,000 / (1.10)^3 = 13,523.67
PV(CF_4) = 22,000 / (1.10)^4 = 15,026.30
PV(CF_5) = 25,000 / (1.10)^5 = 15,523.03
Sum all present values:
NPV = -50,000.00 + 10,909.09 + 12,396.69 + 13,523.67 + 15,026.30 + 15,523.03
NPV = +$17,378.78
Since NPV is positive ($17,378.78), the project creates value and should be accepted. It earns more than the 10% required rate of return.
To find the IRR, we would solve for the rate where NPV = 0. Numerically, the IRR for this cash flow stream is approximately 21.2% (21.18%), well above the 10% hurdle rate.
(1 + annual rate) unless converting from EAR.(1 + r) adjustment factor will undervalue annuity-due streams.scripts/time_value_of_money.py implements every formula above as static methods on a TimeValueOfMoney class (present_value, future_value, npv, irr, annuity_pv, annuity_fv, growing_annuity_pv, perpetuity_pv, fisher_rate, continuous_compounding) plus an AmortizationSchedule class.
uv run scripts/time_value_of_money.py (PEP 723 inline metadata; stdlib-only, no third-party dependencies), or simply python3 scripts/time_value_of_money.py.--verify) prints a demo of all methods and asserts the worked-example values above (Example 1 mortgage payment = $1,896.20; Example 2 NPV = $17,378.78 and IRR = 21.18%), exiting nonzero on any mismatch.--help lists the available methods and import usage.from time_value_of_money import TimeValueOfMoney, AmortizationSchedule, then call e.g. TimeValueOfMoney.npv(...).What SKILL.md sets; muted values are Claude Code's defaults
3 skills in this plugin
/return-calculationsCompute and compare investment return metrics including TWR, MWR (dollar-weighted IRR on portfolio cash flows), CAGR, and annualized returns. Use when the user asks about portfolio performance calculation, comparing manager returns, linking sub-period returns, understanding why different return methods give different numbers, converting returns across time periods, or computing the IRR of an investor's own contributions and withdrawals. Also trigger when users mention 'how much did I make', 'annual return', 'compound growth', 'dollar-weighted vs time-weighted', 'what was my rate of return', 'geometric vs arithmetic mean', 'log returns', or ask about the effect of cash flows on reported returns. For project or loan IRR, NPV, and generic 'solve for the rate' problems, use time-value-of-money instead./statistics-fundamentalsApply statistical methods to financial data including descriptive statistics, covariance estimation, regression, hypothesis testing, and resampling. Use when the user asks about return distributions, correlation between assets, building a covariance matrix, running a CAPM regression, testing whether alpha is significant, checking if returns are normal, or estimating confidence intervals. Also trigger when users mention 'volatility', 'how correlated are these', 'fat tails', 'skewness', 'R-squared', 'beta of a fund', 'bootstrap a Sharpe ratio', 'shrinkage estimator', 'Ledoit-Wolf', or ask why their optimizer produces unstable weights.npx claudepluginhub joellewis/finance_skills --plugin coreOther plugins' skills for the same job