Skip to content

Instantly share code, notes, and snippets.

@mattgbrady
mattgbrady / fvschedule.rb
Created March 13, 2014 20:44
Excel fvschedule function in Ruby
def fvschedule(principal=1.0, schedule)
total_return = principal
schedule.each{|x| total_return*=(1+x)}
return total_return
end
def annualized_return(period, schedule)
ann_return = 0
schedule_length = schedule.length
if schedule_length/Float(period) > 1