templates/drumb.scala
changeset 132 2ca6db82d207
parent 129 b1a51285de7e
child 135 077e63e96287
equal deleted inserted replaced
131:1fb90f5d53ee 132:2ca6db82d207
     9 val blchip_portfolio = List("GOOG", "AAPL", "MSFT", "IBM", "FB", "YHOO", "AMZN", "BIDU")
     9 val blchip_portfolio = List("GOOG", "AAPL", "MSFT", "IBM", "FB", "YHOO", "AMZN", "BIDU")
    10 val rstate_portfolio = List("PLD", "PSA", "AMT", "AIV", "AVB", "BXP", "CBG", "CCI", 
    10 val rstate_portfolio = List("PLD", "PSA", "AMT", "AIV", "AVB", "BXP", "CBG", "CCI", 
    11                             "DLR", "EQIX", "EQR", "ESS", "EXR", "FRT", "GGP", "HCP") 
    11                             "DLR", "EQIX", "EQR", "ESS", "EXR", "FRT", "GGP", "HCP") 
    12 
    12 
    13 
    13 
    14 // (1) The function below should obtain the first trading price
    14 // (1.a) The function below takes a stock symbol and a year as argument.
    15 // for a stock symbol by using the query
    15 //       It should read the corresponding CSV-file and read the january 
       
    16 //       data from that year. The data should be collected in a list of
       
    17 //       strings for each line in the CSV file.
       
    18 
       
    19 //def get_january_data(symbol: String, year: Int) : List[String] = ...
       
    20 
    16 //
    21 //
    17 //    http://ichart.yahoo.com/table.csv?s=<<symbol>>&a=0&b=1&c=<<year>>&d=1&e=1&f=<<year>> 
    22 //    http://ichart.yahoo.com/table.csv?s=<<symbol>>&a=0&b=1&c=<<year>>&d=1&e=1&f=<<year>> 
    18 // 
    23 // 
    19 // and extracting the first January Adjusted Close price in a year.
    24 // and extracting the first January Adjusted Close price in a year.
    20 
    25 // 
    21 //def get_january_data(symbol: String, year: Int) : List[String] = ...
    26 // (1.b) From the output of the get_january_data function, the next function 
       
    27 //       should extract the first line (if it exists) and the corresponding
       
    28 //       first trading price in that year as Option[Double]. If no line is 
       
    29 //       given 
       
    30 //
    22 
    31 
    23 //def get_first_price(symbol: String, year: Int) : Option[Double] = ...
    32 //def get_first_price(symbol: String, year: Int) : Option[Double] = ...
    24 
    33 
    25 
    34 
    26 // Complete the function below that obtains all first prices
    35 // Complete the function below that obtains all first prices