Python中的 numpy.irr()
numpy.irr(values) :此财务函数可帮助用户计算 IRR 值,即内部收益率,即。 “平均”周期性复合回报率。
Parameters :
values : [array-like] Input cash flows per time period. net “deposits” are negative and net “withdrawals” are positive
Return : Internal Rate of Return for periodic input values.
代码:
Python3
# Python program explaining
# irr() function
import numpy as np
'''
Question :
Investment = 500
Withdrawls at regular interval : 50, 31, 3, 11
'''
Solution = np.irr([-500, 50, 31, 3, 11])
print("Solution - Internal Rate of Return : ", Solution)
输出:
Solution - Internal Rate of Return : -0.5296447721512683