python-CFA-計算現值的函數(1)

A financial contract offers to pay €1,200 per month for five years with the first payment made immediately. Assuming an annual discount rate of 6.5%, compounded monthly the present value of the contract is closest to:

 

def get_present_value(total_month,per_month_money,annual_discount_rate):
    '''類似於先付費用的年金的折現'''
    monthly_discount_rate=annual_discount_rate/12
    present_value=per_month_money
    for i in range(1,total_month):
        present_value+=per_month_money/(1+monthly_discount_rate)**i
        
    return present_value

get_present_value(60,1200,0.065)

61662.62191784636
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章