equal
deleted
inserted
replaced
22 // It should read the corresponding CSV-file and reads the January |
22 // It should read the corresponding CSV-file and reads the January |
23 // data from the given year. The data should be collected in a list of |
23 // data from the given year. The data should be collected in a list of |
24 // strings for each line in the CSV-file. |
24 // strings for each line in the CSV-file. |
25 |
25 |
26 def get_january_data(symbol: String, year: Int) : List[String] = |
26 def get_january_data(symbol: String, year: Int) : List[String] = |
27 Source.fromFile(symbol ++ ".csv")("ISO-8859-1").getLines.toList.filter(_.startsWith(year.toString)) |
27 Source.fromFile(symbol ++ ".csv")("ISO-8859-1").getLines().toList.filter(_.startsWith(year.toString)) |
28 |
28 |
29 |
29 |
30 //test cases |
30 //test cases |
31 //blchip_portfolio.map(get_january_data(_, 2018)) |
31 //blchip_portfolio.map(get_january_data(_, 2018)) |
32 //rstate_portfolio.map(get_january_data(_, 2018)) |
32 //rstate_portfolio.map(get_january_data(_, 2018)) |
167 |
167 |
168 |
168 |
169 |
169 |
170 //test cases for the two portfolios given above |
170 //test cases for the two portfolios given above |
171 |
171 |
172 //println("Real data: " + investment(rstate_portfolio, 1978 to 2019, 100)) |
172 println("Real data: " + investment(rstate_portfolio, 1978 to 2019, 100)) |
173 //println("Blue data: " + investment(blchip_portfolio, 1978 to 2019, 100)) |
173 println("Blue data: " + investment(blchip_portfolio, 1978 to 2019, 100)) |
174 |
174 |
175 } |
175 |
176 |
176 } |
177 |
177 |
178 |
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 import CW6b._ |
|
200 investment(rstate_portfolio, 1978 to 2019, 100) |