main_marking1/drumb_test6.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Mon, 08 Nov 2021 01:54:32 +0000
changeset 407 81bdb364f98f
parent 388 ed63dca8068a
child 424 daf561a83ba6
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
388
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     1
//val urban_deltas = get_deltas(get_prices(List("GOOG", "AAPL"), 2010 to 2012))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     2
/*
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     3
def myassert(cond : => Boolean) = {
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     4
  try {
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     5
    assert(cond)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     6
  } catch { 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     7
    case _ : Throwable => System.exit(1)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     8
  }
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
     9
}
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    10
*/
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    11
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    12
val ds_urban = List(List(Some(-0.03573991804411003), Some(0.539974575389325)), 
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    13
                    List(Some(0.10103414222249969), Some(0.24777764141006836)))
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    14
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    15
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    16
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    17
assert(CW6b.yearly_yield(ds_urban, 100, 0) == 125)
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff changeset
    18
assert(CW6b.yearly_yield(ds_urban, 100, 1) == 117)