diff -r 03530cb87cd0 -r b37052895281 marking1/drumb_test3.scala --- a/marking1/drumb_test3.scala Tue Jan 16 10:47:29 2018 +0000 +++ b/marking1/drumb_test3.scala Fri Jan 19 14:09:08 2018 +0000 @@ -1,20 +1,20 @@ +val urban_prices1 = CW6c.get_prices(List("BIDU"), 2004 to 2008) +val urban_prices2 = CW6c.get_prices(List("GOOG", "AAPL"), 2010 to 2012) +val urban_prices3 = CW6c.get_prices(List("GOOG", "AAPL", "BIDU"), 2010 to 2012) -val urban_prices = List(List(Some(311.349976), Some(27.505054)), - List(Some(300.222351), Some(42.357094)), - List(Some(330.555054), Some(52.852215))) - - -assert(CW6c.yearly_yield(CW6c.get_deltas(urban_prices), 100, 0) == 125) - +val urban_deltas1 = CW6c.get_deltas(urban_prices1) +val urban_deltas2 = CW6c.get_deltas(urban_prices2) +val urban_deltas3 = CW6c.get_deltas(urban_prices3) -val urban_blchip_portfolio = List("GOOG", "AAPL", "MSFT", "IBM", "FB", "AMZN", "BIDU") -val urban_rstate_portfolio = List("PLD", "PSA", "AMT", "AIV", "AVB", "BXP", "CCI", - "DLR", "EQIX", "EQR", "ESS", "EXR", "FRT", "GGP", "HCP") +assert(CW6c.yearly_yield(urban_deltas1, 100, 0) == 100) +assert(CW6c.yearly_yield(urban_deltas1, 100, 2) == 192) +assert(CW6c.yearly_yield(urban_deltas2, 100, 0) == 125) +assert(CW6c.yearly_yield(urban_deltas3, 100, 0) == 164) +assert(CW6c.yearly_yield(urban_deltas3, 100, 1) == 119) -val urban_rstate_res = CW6c.investment(urban_rstate_portfolio, 1978 to 2017, 100) -val urban_blchip_res = CW6c.investment(urban_blchip_portfolio, 1978 to 2017, 100) +val urban_inv1 = CW6c.investment(List("IBM", "BIDU"), 2004 to 2008, 100) +val urban_inv2 = CW6c.investment(List("GOOG", "AAPL", "BIDU"), 2010 to 2012, 100) -// the rstate value is 30895 because of a faulty ESS.cvs file +assert(urban_inv1 >= 295 && urban_inv1 <= 301) +assert(urban_inv2 >= 194 && urban_inv2 <= 198) -assert(urban_rstate_res > 30885 && urban_rstate_res < 30905) -assert(urban_blchip_res > 349587 && urban_blchip_res < 349607)