cws/cw01.tex
changeset 35 9fea5f751be4
parent 31 d0caa12ab8d8
child 42 a5106bc13db6
equal deleted inserted replaced
34:40424bbe109e 35:9fea5f751be4
   123 \noindent
   123 \noindent
   124 you need to write a function that returns a pair of indices for when
   124 you need to write a function that returns a pair of indices for when
   125 to buy and when to sell this commodity. In the example above it should
   125 to buy and when to sell this commodity. In the example above it should
   126 return the pair $\texttt{(1, 3)}$ because at index $1$ the price is lowest and
   126 return the pair $\texttt{(1, 3)}$ because at index $1$ the price is lowest and
   127 then at index $3$ the price is highest. Note the prices are given as
   127 then at index $3$ the price is highest. Note the prices are given as
   128 lists of \texttt{Float}s.\newline \mbox{} \hfill[1 Mark]
   128 lists of \texttt{Double}s.\newline \mbox{} \hfill[1 Mark]
   129 
   129 
   130 \item[(2)] Write a function that requests a comma-separated value (CSV) list
   130 \item[(2)] Write a function that requests a comma-separated value (CSV) list
   131   from the Yahoo websevice that provides historical data for stock
   131   from the Yahoo websevice that provides historical data for stock
   132   indices. For example if you query the URL
   132   indices. For example if you query the URL
   133 
   133 
   184 shareprice for Google was on 2004-09-03 with \$49.95513 per share and the
   184 shareprice for Google was on 2004-09-03 with \$49.95513 per share and the
   185 highest on 2016-10-24 with \$813.109985 per share.\bigskip
   185 highest on 2016-10-24 with \$813.109985 per share.\bigskip
   186 
   186 
   187 \subsection*{Advanced Part 3 (3 Marks)}
   187 \subsection*{Advanced Part 3 (3 Marks)}
   188 
   188 
   189 A purely fictional character named Mr T.~Drump inherited in 1978
   189 A purely fictional character named Mr T.~Drumb inherited in 1978
   190 approximately 200 Million Dollar from his father. Mr Drump prides
   190 approximately 200 Million Dollar from his father. Mr Drumb prides
   191 himself to be a brilliant business man because nowadays it is
   191 himself to be a brilliant business man because nowadays it is
   192 estimated he is 3 Billion Dollar worth (one is not sure, of course,
   192 estimated he is 3 Billion Dollar worth (one is not sure, of course,
   193 because Mr Drump refuses to make his tax records public).
   193 because Mr Drumb refuses to make his tax records public).
   194 
   194 
   195 Since the question about Mr Drump's business acumen remains, let's do a
   195 Since the question about Mr Drumb's business acumen remains, let's do a
   196 quick back-of-the-envelope calculation in Scala whether his claim has
   196 quick back-of-the-envelope calculation in Scala whether his claim has
   197 any merit. Let's suppose we are given \$100 in 1978 and we follow a
   197 any merit. Let's suppose we are given \$100 in 1978 and we follow a
   198 really dump investment strategy, namely:
   198 really dump investment strategy, namely:
   199 
   199 
   200 \begin{itemize}
   200 \begin{itemize}
   311 \textbf{Moral:} Reflecting on our assumptions, we are over-estimating
   311 \textbf{Moral:} Reflecting on our assumptions, we are over-estimating
   312 our yield in many ways: first, who can know in 1978 about what will
   312 our yield in many ways: first, who can know in 1978 about what will
   313 turn out to be a blue chip company.  Also, since the portfolios are
   313 turn out to be a blue chip company.  Also, since the portfolios are
   314 chosen from the current S\&P 500, they do not include the myriad
   314 chosen from the current S\&P 500, they do not include the myriad
   315 of companies that went bust or were de-listed over the years.
   315 of companies that went bust or were de-listed over the years.
   316 So where does this leave our fictional character Mr T.~Drump? Well, given
   316 So where does this leave our fictional character Mr T.~Drumb? Well, given
   317 his inheritance, a really dumb investment strategy would have done
   317 his inheritance, a really dumb investment strategy would have done
   318 equally well, if not much better.
   318 equally well, if not much better.
   319 \end{document}
   319 \end{document}
   320 
   320 
   321 %%% Local Variables: 
   321 %%% Local Variables: