main_marking1/drumb_test5.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Fri, 22 Jan 2021 10:37:55 +0000
changeset 388 ed63dca8068a
child 424 daf561a83ba6
permissions -rw-r--r--
update
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
388
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     1
/*def myassert(cond : => Boolean) = {
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     2
  try {
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     3
    assert(cond)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     4
  } catch { 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     5
    case _ : Throwable => System.exit(1)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     6
  }
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     7
}
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     8
*/
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     9
// get_prices(List("GOOG", "AAPL"), 2010 to 2012)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    10
val urban_prices = List(List(Some(312.204773), Some(26.782711)), 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    11
                        List(Some(301.0466), Some(41.244694)), 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    12
                        List(Some(331.462585), Some(51.464207)))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    13
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    14
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    15
assert(CW6b.get_deltas(urban_prices) == List(List(Some(-0.03573991804411003), Some(0.539974575389325)), 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    16
                                          List(Some(0.10103414222249969), Some(0.24777764141006836))))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    17
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    18
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    19
//get_prices(List("BIDU"), 2004 to 2008)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    20
val urban_prices2 = List(List(None), List(None), 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    21
                         List(Some(6.35)), List(Some(12.241)), 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    22
                         List(Some(38.188)))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    23
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    24
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    25
assert(CW6b.get_deltas(urban_prices2) == List(List(None), List(None), 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    26
                                        List(Some(0.9277165354330709)), 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    27
                                        List(Some(2.119679764725104))))