light: A short numerical method; a hosted run may take up to 10 seconds.
Formula
Where
Present value present_value
Future value future_value
The payment each period payment
Interest rate per period rate
Number of periods periods
Growth rate of the payment per period growth
1 when each payment falls at the start of its period (an annuity due), 0 at the end due
Present value of a perpetuity present_value
Net present value npv
The cash flow at period t; negative when paid out cash_flows
Internal rate of return: the rate at which the net present value is zero irr
Net present value of dated cash flows xnpv
The i-th dated cash flow cash_flows
The date of cash flow i; d_0 is the first date dates
Internal rate of return of dated cash flows, per year xirr
Principal of the loan principal
Balance left after payment k balance
The annuity factor: the present value of 1 a period for n periods
Each symbol's field is named beside it; the inputs and outputs, with their units and bounds, are under Variables, and the citations give each formula's source.
Variables
Rates, returns and yields are decimals: 0.05 is five percent. Bounds in brackets include their end; in parentheses they exclude it.
Inputs
Discount a sum and a stream of payments (present_value): 7 inputs
Inputs of the calculation present_value
Name
Unit
Bounds
Description
Calculationcalculationtext
text
Discount a sum and a stream of payments
Rateraterate · [-0.99, 1]
rate
[-0.99, 1]
Discount rate per period
Periodsperiodsperiods · [0, 1200]
periods
[0, 1200]
Number of periods; omitted (null) for a perpetuity
Paymentpaymentmoney · [-1e+12, 1e+12]
money
[-1e+12, 1e+12]
First payment of the stream (0 for none)
Growthgrowthrate · [-0.99, 1]
rate
[-0.99, 1]
Growth of each payment over the last, per period
Future valuefuture_valuemoney · [-1e+12, 1e+12]
money
[-1e+12, 1e+12]
Single sum at the end of the last period (0 for none)
Duedueflag
flag
Payments at the start of each period (an annuity due)
Compound a sum and a stream of payments (future_value): 7 inputs
Inputs of the calculation future_value
Name
Unit
Bounds
Description
Calculationcalculationtext
text
Compound a sum and a stream of payments
Rateraterate · [-0.99, 1]
rate
[-0.99, 1]
Interest rate per period
Periodsperiodsperiods · [0, 1200]
periods
[0, 1200]
Number of periods
Paymentpaymentmoney · [-1e+12, 1e+12]
money
[-1e+12, 1e+12]
First payment of the stream (0 for none)
Growthgrowthrate · [-0.99, 1]
rate
[-0.99, 1]
Growth of each payment over the last, per period
Present valuepresent_valuemoney · [-1e+12, 1e+12]
money
[-1e+12, 1e+12]
Single sum invested now (0 for none)
Duedueflag
flag
Payments at the start of each period (an annuity due)
Solve the time-value equation for the omitted term (solve): 7 inputs
Inputs of the calculation solve
Name
Unit
Bounds
Description
Calculationcalculationtext
text
Solve the time-value equation for the omitted term
Periodsperiodsperiods · [0, 1200]
periods
[0, 1200]
Number of periods (N)
Rateraterate · [-0.99, 1]
rate
[-0.99, 1]
Interest rate per period (I/Y)
Present valuepresent_valuemoney · [-1e+12, 1e+12]
money
[-1e+12, 1e+12]
Cash flow now (PV); negative when paid out
Paymentpaymentmoney · [-1e+12, 1e+12]
money
[-1e+12, 1e+12]
Level cash flow each period (PMT); negative when paid out
Future valuefuture_valuemoney · [-1e+12, 1e+12]
money
[-1e+12, 1e+12]
Cash flow at the end (FV); negative when paid out
Duedueflag
flag
Payments at the start of each period
Net present value (npv): 3 inputs
Inputs of the calculation npv
Name
Unit
Bounds
Description
Calculationcalculationtext
text
Net present value
Rateraterate · [-0.99, 1]
rate
[-0.99, 1]
Discount rate per period
Cash flowscash_flowsmoney (array) · length min 1, max 1201; each [-1e+12, 1e+12]
money (array)
length min 1, max 1201; each [-1e+12, 1e+12]
Cash flows at times 0, 1, 2, ... periods; the first is not discounted
Internal rate of return (irr): 2 inputs
Inputs of the calculation irr
Name
Unit
Bounds
Description
Calculationcalculationtext
text
Internal rate of return
Cash flowscash_flowsmoney (array) · length min 1, max 1201; each [-1e+12, 1e+12]
money (array)
length min 1, max 1201; each [-1e+12, 1e+12]
Cash flows at times 0, 1, 2, ... periods
Net present value of dated cash flows (xnpv): 4 inputs
Inputs of the calculation xnpv
Name
Unit
Bounds
Description
Cash flowscash_flowsmoney (array) · length min 1, max 1000; each [-1e+12, 1e+12]
money (array)
length min 1, max 1000; each [-1e+12, 1e+12]
Cash flows, one per date
Datesdatesdate (array) · length min 1, max 1000
date (array)
length min 1, max 1000
The date of each cash flow; the first is the base date
Calculationcalculationtext
text
Net present value of dated cash flows
Rateraterate · [-0.99, 10]
rate
[-0.99, 10]
Annual discount rate
Internal rate of return of dated cash flows (xirr): 3 inputs
Inputs of the calculation xirr
Name
Unit
Bounds
Description
Cash flowscash_flowsmoney (array) · length min 1, max 1000; each [-1e+12, 1e+12]
money (array)
length min 1, max 1000; each [-1e+12, 1e+12]
Cash flows, one per date
Datesdatesdate (array) · length min 1, max 1000
date (array)
length min 1, max 1000
The date of each cash flow; the first is the base date
Total interesttotal_interestmoney · [-2e+12, 2.4e+15]
money
[-2e+12, 2.4e+15]
Interest paid over the loan
Periodperiodcount (array) · length max 1200; each [1, 1200]
count (array)
length max 1200; each [1, 1200]
Payment numbers, 1 to n
Paymentpaymentmoney (array) · length max 1200; each [-1e+15, 1e+15]
money (array)
length max 1200; each [-1e+15, 1e+15]
Payment in each period
Interestinterestmoney (array) · length max 1200; each [-1e+15, 1e+15]
money (array)
length max 1200; each [-1e+15, 1e+15]
Interest part of each payment
Principalprincipalmoney (array) · length max 1200; each [-1e+15, 1e+15]
money (array)
length max 1200; each [-1e+15, 1e+15]
Principal part of each payment
Balancebalancemoney (array) · length max 1200; each [-1e+15, 1e+15]
money (array)
length max 1200; each [-1e+15, 1e+15]
Balance after each payment
Calculator
Run the model on your own inputs, starting from its example. Rates are decimals: 0.05 is five percent. The run goes to the pyeconomics API on this site: your values travel only in the request, and nothing is stored.
The rate is constant and compounds once per period; payments fall at the end of each period, or at its start when due is true (d = 1).
A growing payment grows by the same rate each period, starting from the payment given for the first period.
solve follows the cash-flow sign convention: money paid out is negative, and the equation balances to zero.
npv and irr place the first cash flow at time 0, undiscounted; xnpv and xirr count years of 365 days from the first date (ACT/365 Fixed).
An IRR is the smallest root in its bracket (ADR-0008 decision 11); the scan steps by 0.01, so two roots closer than that can be seen as none.
Limitations
A result outside its output's bounds (for example a sum compounded at 100% a period for a thousand periods) raises DomainError.
A perpetuity needs a rate above its growth rate and no final sum, or DomainError is raised.
solve raises DomainError when no value of the omitted term balances the cash flows (no rate in [-0.99, 1] per period, no non-negative number of periods, or a payment over zero periods).
An IRR or XIRR is null with a warning when the cash flows never change sign or no root lies in [-0.99, 10].
Taxes, fees, inflation and day-count conventions other than ACT/365 Fixed are out of scope.
Evidence
Status: standard. Textbook consensus, such as bond duration or the CAPM formula.
Every model declares one status: standard (textbook consensus), practitioner (a widely used convention), contested (under active debate), rejected (failed out of sample) or historical (a superseded methodology).
Syllabus
The 2027 CFA® Program's topic areas this model relates to, as factual tags. Each links to CFA Institute's page for its level; pyeconomics holds none of the curriculum's text.
Kellison, S. G. (2009). The Theory of Interest, 3rd ed. McGraw-Hill/Irwin. https://openlibrary.org/isbn/9780073382449 (Chapters 3-5 (annuities, varying annuities, amortization schedules)). ISBN 9780073382449