18
|
1 |
// Advanvced Part 3 about Mr T. Drumb investing into stocks
|
|
2 |
//==========================================================
|
|
3 |
|
|
4 |
//two test portfolios
|
|
5 |
|
|
6 |
val blchip_portfolio = List("GOOG", "AAPL", "MSFT", "IBM", "FB", "YHOO", "AMZN", "BIDU")
|
|
7 |
val rstate_portfolio = List("PLD", "PSA", "AMT", "AIV", "AVB", "BXP", "CBG", "CCI",
|
|
8 |
"DLR", "EQIX", "EQR", "ESS", "EXR", "FRT", "GGP", "HCP")
|
|
9 |
|
|
10 |
|
19
|
11 |
def get_yahoo_page(url: String): Option[List[String]] = ...
|
18
|
12 |
|
19
|
13 |
def get_first_price(symbol: String, year: Int): Option[Double] = ...
|
18
|
14 |
|
19
|
15 |
def get_prices(portfolio: List[String], years: Range): List[List[Option[Double]]] = ...
|
18
|
16 |
|
|
17 |
|
19
|
18 |
//val p = get_prices(List("GOOG", "AAPL"), 2010 to 2012)
|
18
|
19 |
|
|
20 |
|
19
|
21 |
def get_delta(price_old: Option[Double], price_new: Option[Double]): Option[Double] = ...
|
18
|
22 |
|
19
|
23 |
def get_deltas(data: List[List[Option[Double]]]): List[List[Option[Double]]] = ...
|
18
|
24 |
|
19
|
25 |
//val d = get_deltas(p)
|
18
|
26 |
|
|
27 |
|
|
28 |
|
19
|
29 |
def yearly_yield(data: List[List[Option[Double]]], balance: Long, year: Int): Long = ...
|
|
30 |
|
|
31 |
//yearly_yield(d, 100, 0)
|
|
32 |
|
|
33 |
def compound_yield(data: List[List[Option[Double]]], balance: Long, year: Int): Long = ...
|
|
34 |
|
18
|
35 |
|
19
|
36 |
def investment(portfolio: List[String], years: Range, start_balance: Long): Long = ...
|
|
37 |
|
|
38 |
|
|
39 |
//investment(rstate_portfolio, 1978 to 2016, 100)
|
|
40 |
//investment(blchip_portfolio, 1978 to 2016, 100)
|
|
41 |
|