main_testing1/drumb_test5.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Sun, 15 Sep 2024 12:57:59 +0100
changeset 493 244df77507c2
parent 402 de59aa20a1dc
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
     1
/*def myassert(cond : => Boolean) = {
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
     2
  try {
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
     3
    assert(cond)
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
     4
  } catch { 
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
     5
    case _ : Throwable => System.exit(1)
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
     6
  }
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
     7
}
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
     8
*/
248
1616d06a0893 updared
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
// get_prices(List("GOOG", "AAPL"), 2010 to 2012)
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
    10
val urban_prices = List(List(Some(312.204773), Some(26.782711)), 
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
    11
                        List(Some(301.0466), Some(41.244694)), 
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
    12
                        List(Some(331.462585), Some(51.464207)))
248
1616d06a0893 updared
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
1616d06a0893 updared
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
402
de59aa20a1dc updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    15
assert(M1.get_deltas(urban_prices) == List(List(Some(-0.03573991804411003), Some(0.539974575389325)), 
281
87b9e3e2c1a7 updated
Christian Urban <urbanc@in.tum.de>
parents: 248
diff changeset
    16
                                          List(Some(0.10103414222249969), Some(0.24777764141006836))))
248
1616d06a0893 updared
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
1616d06a0893 updared
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
1616d06a0893 updared
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
//get_prices(List("BIDU"), 2004 to 2008)
1616d06a0893 updared
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
val urban_prices2 = List(List(None), List(None), 
1616d06a0893 updared
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
                         List(Some(6.35)), List(Some(12.241)), 
1616d06a0893 updared
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
                         List(Some(38.188)))
1616d06a0893 updared
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
1616d06a0893 updared
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
402
de59aa20a1dc updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 347
diff changeset
    25
assert(M1.get_deltas(urban_prices2) == List(List(None), List(None), 
248
1616d06a0893 updared
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
                                        List(Some(0.9277165354330709)), 
1616d06a0893 updared
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
                                        List(Some(2.119679764725104))))