lib/finance/asset_returns.rb
##
# determine the values of multiple returns
# *purchase_price
# *sale_price
# *periods - number of returns over given period
determine the values of multiple returns
purchase_price
sale_price
periods - number of returns over given period
determine the values of multiple returns purchase_price sale_price periods - number of returns over given period
def multiple_returns(purchase_price,sale_price,periods)
			per_period_gain = (sale_price.to_d - purchase_price.to_d ) / periods.to_d
			returns = []
			periods.times do |i|
				returns << simple_return(purchase_price + i * per_period_gain, purchase_price + (i +1) * per_period_gain).to_f
			end	
			returns
		end
def multiple_returns ( purchase_price , sale_price , periods ) per_period_gain = ( sale_price . to_d - purchase_price . to_d ) / periods . to_d returns = [ ] periods . times do | i | returns << simple_return ( purchase_price + i * per_period_gain , purchase_price + ( i + 1 ) * per_period_gain ) . to_f end returns end
determine the values of multiple returns
purchase_price
sale_price
periods - number of returns over given period
determine the values of multiple returns purchase_price sale_price periods - number of returns over given period
purchase_price
sale_price
periods