lib/finance/asset_returns.rb
def simple_return(purchase_price, sale_price, dividend = 0)
			if dividend > 0
				capital = (sale_price.to_d - purchase_price.to_d) / purchase_price.to_d
				dividend_yield = dividend.to_d/purchase_price.to_d
				capital + dividend_yield
			else
				(sale_price.to_d / purchase_price.to_d) - 1
			end
		end
##
# determine the rate of return of an asset 
# over a given time period
# *purchase_price
# *sale_price
# *dividend paid for period
determine the rate of return of an asset
over a given time period
purchase_price
sale_price
dividend paid for period
determine the rate of return of an asset over a given time period purchase_price sale_price dividend paid for period
def simple_return(purchase_price, sale_price, dividend = 0)
			if dividend > 0
				capital = (sale_price.to_d - purchase_price.to_d) / purchase_price.to_d
				dividend_yield = dividend.to_d/purchase_price.to_d
				capital + dividend_yield
			else
				(sale_price.to_d / purchase_price.to_d) - 1
			end
		end
def simple_return ( purchase_price , sale_price , dividend = 0 ) if dividend > 0 capital = ( sale_price . to_d - purchase_price . to_d ) / purchase_price . to_d dividend_yield = dividend . to_d / purchase_price . to_d capital + dividend_yield else ( sale_price . to_d / purchase_price . to_d ) - 1 end end
determine the rate of return of an asset
over a given time period
purchase_price
sale_price
dividend paid for period
determine the rate of return of an asset over a given time period purchase_price sale_price dividend paid for period
purchase_price
sale_price
dividend