169
|
1 |
val urban_prices1 = CW6c.get_prices(List("BIDU"), 2004 to 2008)
|
|
2 |
val urban_prices2 = CW6c.get_prices(List("GOOG", "AAPL"), 2010 to 2012)
|
|
3 |
val urban_prices3 = CW6c.get_prices(List("GOOG", "AAPL", "BIDU"), 2010 to 2012)
|
158
|
4 |
|
169
|
5 |
val urban_deltas1 = CW6c.get_deltas(urban_prices1)
|
|
6 |
val urban_deltas2 = CW6c.get_deltas(urban_prices2)
|
|
7 |
val urban_deltas3 = CW6c.get_deltas(urban_prices3)
|
158
|
8 |
|
169
|
9 |
assert(CW6c.yearly_yield(urban_deltas1, 100, 0) == 100)
|
|
10 |
assert(CW6c.yearly_yield(urban_deltas1, 100, 2) == 192)
|
|
11 |
assert(CW6c.yearly_yield(urban_deltas2, 100, 0) == 125)
|
|
12 |
assert(CW6c.yearly_yield(urban_deltas3, 100, 0) == 164)
|
|
13 |
assert(CW6c.yearly_yield(urban_deltas3, 100, 1) == 119)
|
158
|
14 |
|
169
|
15 |
val urban_inv1 = CW6c.investment(List("IBM", "BIDU"), 2004 to 2008, 100)
|
|
16 |
val urban_inv2 = CW6c.investment(List("GOOG", "AAPL", "BIDU"), 2010 to 2012, 100)
|
158
|
17 |
|
169
|
18 |
assert(urban_inv1 >= 295 && urban_inv1 <= 301)
|
|
19 |
assert(urban_inv2 >= 194 && urban_inv2 <= 198)
|
158
|
20 |
|