marking1/drumb_test3.scala
author Christian Urban <urbanc@in.tum.de>
Thu, 15 Nov 2018 14:23:55 +0000
changeset 203 eb188f9ac038
parent 169 b37052895281
child 210 63a1376cbebd
permissions -rw-r--r--
updated

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_deltas1 = CW6c.get_deltas(urban_prices1)
val urban_deltas2 = CW6c.get_deltas(urban_prices2)
val urban_deltas3 = CW6c.get_deltas(urban_prices3)

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_inv1 = CW6c.investment(List("IBM", "BIDU"), 2004 to 2008, 100)
val urban_inv2 = CW6c.investment(List("GOOG", "AAPL", "BIDU"), 2010 to 2012, 100)

assert(urban_inv1 >= 295 && urban_inv1 <= 301)
assert(urban_inv2 >= 194 && urban_inv2 <= 198)