更多財務函式

使用 Python 進行債券評價與分析

Joshua Mayhew

Options Trader

nper() 函式

  • 告訴你把 PV 成長到 FV 所需的期數
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
使用 Python 進行債券評價與分析

nper() 函式

  • 以年利率 5%(按月複利)每月投資 USD 270,要多久才能存到 USD 7,000?
import numpy_financial as npf
npf.nper(rate=0.05/12, pmt=-270, pv=0, fv=7000)
24.67
使用 Python 進行債券評價與分析

pmt() 函式

  • 告訴你把 PV 成長到 FV 所需的付款金額
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.
使用 Python 進行債券評價與分析

pmt() 函式

  • 以年利率 3.5%(按月複利)貸款 USD 275,000
  • 要在 10 年內還清房貸,每月該繳多少?
import numpy_financial as npf
npf.pmt(rate=0.035/12, nper=10*12, pv=275000, fv=0)
-2719.36
使用 Python 進行債券評價與分析

rate() 函式

  • 告訴你把 PV 成長到 FV 所需的利率
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
使用 Python 進行債券評價與分析

rate() 函式

  • 為了 30 年後退休,需要多少報酬率?
  • 你每月儲蓄 USD 1,500,目標是 USD 1,000,000。
  • 假設投資為按月複利。
import numpy_financial as npf
12 * npf.rate(nper=30*12, pmt=-1500, pv=0, fv=1000000)
0.0377
使用 Python 進行債券評價與分析

一起來練習吧!

使用 Python 進行債券評價與分析

Preparing Video For Download...