ABSTRACT

Welcome to our section on asset returns, wherein we perform the un-glamorous work of taking raw price data for 5 individual assets and transforming them into monthly returns for a single portfolio.

Our portfolio will consist of the following Exchange Traded Funds (ETFs):

+ SPY (S&P500 ETF) weighted 25% + EFA (a non-US equities ETF) weighted 25% + IJS (a small-cap value ETF) weighted 20% + EEM (an emerging-markets ETF) weighted 20% + AGG (a bond ETF) weighted 10%

1) Import daily prices from the internet, a csv file or xls file 2) Transform daily prices to monthly prices 3) Transform monthly prices to monthly returns 4) Visualize monthly returns 5) Calculate portfolio monthly returns based on asset monthly returns

and weights 6) Visualize portfolio returns 7) Save the data objects for use throughout this book

To map a data science work flow onto this section, those steps encompass data import, cleaning, wrangling, transformation and initial visualization to make sure the wrangling has gone how we wish. Even though the substantive issues are not complex, we will painstakingly review the code to ensure that the data provenance is clear, reproducible and reusable. In fact, we will devote as much time to this section as we do to any of the more analytic sections. That might seem a bit unbalanced - after all, quants do not get paid to import,

clean and wrangle data. But this work is fundamental to our more complex alpha-generating and risk-minimizing tasks. Our partners, collaborators and future selves will thank us for this effort when they want to update our models, extend our work or stress test our portfolios.