import numpy_financial as npf
# 通过净现金流和利率,求净现值
def cash_flow_npv(i, cash_list):
npv = npf.npv(i, cash_list)
npv = round(npv, 2)
print(npv)
return npv
# 通过净现金流/时间和利率,求终值
def cash_flow_ffv(i, y, cash_list):
npv = cash_flow_npv(i, cash_list)
ffv = npf.fv(i, y, 0, npv)
# print("终值:")
# print(round(ffv, 2))
ffv = round(ffv, 2)
return ffv
# 通过现金流计算静态投资回收期
def static_cycle(out_list, in_list):
# out_list = [1000, 800, 0, 0, 0, 0] # 支出
# in_list = [0, 0, 500, 500, 500, 1200] # 收入
out_len = len(out_list)
in_len = len(in_list)
net_cash_flow = []
cumulative_cash_flow = []
positive_time = 0
if out_len == in_len and in_len != 0:
for n in range(0, out_len):
net_cash_flow.append(in_list[n]-out_list[n]) # 净现金流量
for j in range(0, out_len):
if j == 0:
cumulative
python计算投资回收期
于 2024-01-14 20:22:27 首次发布