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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
169
b37052895281 updated
Christian Urban <urbanc@in.tum.de>
parents: 158
diff changeset
     1
val urban_prices1 = CW6c.get_prices(List("BIDU"), 2004 to 2008)
b37052895281 updated
Christian Urban <urbanc@in.tum.de>
parents: 158
diff changeset
     2
val urban_prices2 = CW6c.get_prices(List("GOOG", "AAPL"), 2010 to 2012)
b37052895281 updated
Christian Urban <urbanc@in.tum.de>
parents: 158
diff changeset
     3
val urban_prices3 = CW6c.get_prices(List("GOOG", "AAPL", "BIDU"), 2010 to 2012)
158
94b11ac19b41 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
169
b37052895281 updated
Christian Urban <urbanc@in.tum.de>
parents: 158
diff changeset
     5
val urban_deltas1 = CW6c.get_deltas(urban_prices1)
b37052895281 updated
Christian Urban <urbanc@in.tum.de>
parents: 158
diff changeset
     6
val urban_deltas2 = CW6c.get_deltas(urban_prices2)
b37052895281 updated
Christian Urban <urbanc@in.tum.de>
parents: 158
diff changeset
     7
val urban_deltas3 = CW6c.get_deltas(urban_prices3)
158
94b11ac19b41 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
169
b37052895281 updated
Christian Urban <urbanc@in.tum.de>
parents: 158
diff changeset
     9
assert(CW6c.yearly_yield(urban_deltas1, 100, 0) == 100)
b37052895281 updated
Christian Urban <urbanc@in.tum.de>
parents: 158
diff changeset
    10
assert(CW6c.yearly_yield(urban_deltas1, 100, 2) == 192)
b37052895281 updated
Christian Urban <urbanc@in.tum.de>
parents: 158
diff changeset
    11
assert(CW6c.yearly_yield(urban_deltas2, 100, 0) == 125)
b37052895281 updated
Christian Urban <urbanc@in.tum.de>
parents: 158
diff changeset
    12
assert(CW6c.yearly_yield(urban_deltas3, 100, 0) == 164)
b37052895281 updated
Christian Urban <urbanc@in.tum.de>
parents: 158
diff changeset
    13
assert(CW6c.yearly_yield(urban_deltas3, 100, 1) == 119)
158
94b11ac19b41 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
169
b37052895281 updated
Christian Urban <urbanc@in.tum.de>
parents: 158
diff changeset
    15
val urban_inv1 = CW6c.investment(List("IBM", "BIDU"), 2004 to 2008, 100)
b37052895281 updated
Christian Urban <urbanc@in.tum.de>
parents: 158
diff changeset
    16
val urban_inv2 = CW6c.investment(List("GOOG", "AAPL", "BIDU"), 2010 to 2012, 100)
158
94b11ac19b41 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
169
b37052895281 updated
Christian Urban <urbanc@in.tum.de>
parents: 158
diff changeset
    18
assert(urban_inv1 >= 295 && urban_inv1 <= 301)
b37052895281 updated
Christian Urban <urbanc@in.tum.de>
parents: 158
diff changeset
    19
assert(urban_inv2 >= 194 && urban_inv2 <= 198)
158
94b11ac19b41 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20