--- a/solutions1/drumb.scala Sat Dec 01 15:09:37 2018 +0000
+++ b/solutions1/drumb.scala Thu Dec 06 13:15:28 2018 +0000
@@ -105,6 +105,7 @@
for (j <- (0 until (data(0).length)).toList) yield get_delta(data(i)(j), data(i + 1)(j))
+
// test case using the prices calculated above
//val d = get_deltas(p)
//val ttd = get_deltas(tt)
@@ -125,6 +126,10 @@
}
+yearly_yield(get_prices(rstate_portfolio, 2016 to 2018), 100, 2)
+get_prices(rstate_portfolio, 2016 to 2018)(2).flatten.sum
+
+
// (7) Write a function compound_yield that calculates the overall balance for a
// range of years where in each year the yearly profit is compounded to the new
// balances and then re-invested into our portfolio. For this use the function and