Created
April 13, 2016 09:08
-
-
Save amolpujari/15ebc07f3a69c19930f40319008bb992 to your computer and use it in GitHub Desktop.
annualized_return
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if investment and investment.deal and investment.deal.annual_return.present? | |
return investment.deal.annual_return.to_i | |
end | |
return 0 if projected_earnings.blank? | |
return 0 if percent_profit.blank? | |
return 0 if percent_profit.to_f < 1 | |
year_diff = projected_earnings.last.distribution_date.d_date.year.to_i - DateTime.now.year.to_i | |
year_diff = 1 if year_diff < 1 | |
(( (projected_earnings_amount.dollars.to_f / committed_capital.dollars.to_f ).to_f ** ( 1/(year_diff) ) - 1 )*100 ).to_i | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment