【numpy-financial】金融计算模块
source link: https://www.guofei.site/2023/10/01/numpy_financial.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
【numpy-financial】金融计算模块
文章归类: 0xb0_Python语法 文章编号: 1269
版权声明:本文作者是郭飞。转载随意,但需要标明原文链接,并通知本人
✉
原文链接:https://www.guofei.site/2023/10/01/numpy_financial.html
需要 pip install numpy_financial
https://github.com/numpy/numpy-financial
- rate: rate of interest per period,0.1 代表 10% 利率
- nper:几期
- pmt: Payment
- pv:present value
- fv: future value
- when: begin/end
import numpy_financial as npf
npf.fv(rate=0.1, nper=10, pmt=500, pv=300, when='end')
npf.pv(rate=0.05, nper=24, pmt=1000, when='end')
npf.rate(nper=10, pmt=100, pv=20, fv=-1500, when='end')
npf.nper(rate=0.05, pmt=3000, pv=5000, fv=-50000, when='end')
npf.pmt(rate=0.05, nper=30, pv=-5000, fv=0, when='end')
# npf.ipmt(...) # interest payment,付款中的利息部分
# npf.ppmt(...) # Principal Payment,付款中的本金部分
多期现金流相关计算:
npf.irr(values=[-100, 39, 59, 55, 20]) # Internal Rate of Return,现金流对应的收益率
# Modified internal rate of return,考虑现金流再投资的 IRR
npf.mirr(values=[-100, 39, 59, 55, 20],
finance_rate=0.1, reinvest_rate=0.5)
npf.npv(rate=0.1, values=[1, 3, 3]) # Net Present Value,现金流的 PV
您的支持将鼓励我继续创作!
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK