progs/drumb.scala
author Christian Urban <urbanc@in.tum.de>
Wed, 09 Nov 2016 01:02:41 +0000
changeset 19 fa18976cf4cf
parent 18 87e55eb309ed
child 26 a7afc2540a88
permissions -rw-r--r--
updated

// Advanvced Part 3 about Mr T. Drumb investing into stocks
//==========================================================

//two test portfolios

val blchip_portfolio = List("GOOG", "AAPL", "MSFT", "IBM", "FB", "YHOO", "AMZN", "BIDU")
val rstate_portfolio = List("PLD", "PSA", "AMT", "AIV", "AVB", "BXP", "CBG", "CCI", 
                            "DLR", "EQIX", "EQR", "ESS", "EXR", "FRT", "GGP", "HCP") 


def get_yahoo_page(url: String): Option[List[String]] = ...

def get_first_price(symbol: String, year: Int): Option[Double] = ...

def get_prices(portfolio: List[String], years: Range): List[List[Option[Double]]] = ...


//val p = get_prices(List("GOOG", "AAPL"), 2010 to 2012)


def get_delta(price_old: Option[Double], price_new: Option[Double]): Option[Double] = ...

def get_deltas(data: List[List[Option[Double]]]):  List[List[Option[Double]]] = ...

//val d = get_deltas(p)



def yearly_yield(data: List[List[Option[Double]]], balance: Long, year: Int): Long = ... 

//yearly_yield(d, 100, 0)

def compound_yield(data: List[List[Option[Double]]], balance: Long, year: Int): Long = ... 


def investment(portfolio: List[String], years: Range, start_balance: Long): Long = ...


//investment(rstate_portfolio, 1978 to 2016, 100)
//investment(blchip_portfolio, 1978 to 2016, 100)