Bond Valuation and Analysis in Python
Joshua Mayhew
Options Trader
import numpy_financial as npf
?npf.nper
Signature: npf.nper(rate, pmt, pv, fv=0) Compute the number of periodic payments.
Parameters rate : Rate of interest (per period)
pmt : Payment
pv : Present value
fv : (optional) Future value
import numpy_financial as npf
npf.nper(rate=0.05/12, pmt=-270, pv=0, fv=7000)
24.67
import numpy_financial as npf
?npf.pmt
Signature: npf.pmt(rate, nper, pv, fv=0) Compute the payment against loan principal plus interest.
Given: * an interest `rate` compounded once per period, of which there are
* `nper` total
* a present value, `pv` (e.g., an amount borrowed)
* a future value, `fv` (e.g., 0)
Return: the (fixed) periodic payment.
import numpy_financial as npf
npf.pmt(rate=0.035/12, nper=10*12, pv=275000, fv=0)
-2719.36
import numpy_financial as npf
?npf.rate
Signature: npf.rate(nper, pmt, pv, fv) Compute the rate of interest per period.
Parameters nper : Number of compounding periods
pmt : Payment
pv : Present value
fv : Future value
import numpy_financial as npf
12 * npf.rate(nper=30*12, pmt=-1500, pv=0, fv=1000000)
0.0377
Bond Valuation and Analysis in Python