# ECMT2130: assignment

# Instructions

- This assignment accounts for 15% of your final result for the course. It will be marked out of a maximum total of 45 points.
- This is an individual assignment. You are not allowed to copy a classmate’s assignment (or to borrow the bulk of the material from a classmate’s assignment). You are required to perform the full assignment on your own and hand in independently.
- This assignment is due by 5pm on Friday November 6, 2020. Upload your assignment through Canvas.
- Upload a single compressed (ZIP format) file containing your R scripts, your data, and your report (as a PDF document).
- When decompressed (unzipped) all documents should be in the one folder. The PDF report, and the scripts must all include your student ID.
- The file name for the single compressed file must also include your student ID. The single compressed file that you upload to the Canvas assignment must have a “.zip” file extension.
- Be concise in your report (limit it to 1,500 words). Use tables and graphs where appropriate.
- The assignment involves preparing a report for a hypothetical “client” that is a large financial institution with the ability to borrow and lend at or very near to interbank interest rates. If you have questions to put to the “client”, raise them on the Assignment topic of the Ed discussion forum. For fairness, questions for the “client” will not be answered in any other forum (tutorials/consultation hours/emails etc.).

# Background

You have been asked to assess an equity trading algorithm. Your client has dismissed the quant. responsible for designing the algorithm because the documentation was inadequate. The client now wants to determine whether they should, adopt, modify and then adopt, or write-off the cost of developing the trading algorithm.

The trading algorithm has been implemented in a set of R scripts. You will need to be able to run these (and modify them in places) to gather the information required for your report. The scripts are documented in more detail below.

Each month, the algorithm rebalances the weights on a selection of Australian equities to form a fully-invested portfolio.

Your report must assess:

- the suitability of the input data; [15/45 points]
- the trading algorithm itself; and [10/45 points]
- the performance evaluation of the trading algorithm when used to manage a portfolio with an initial value of $10,000,000. [10/45 points]

The report should also suggest ways in which the algorithm could be improved if it is adopted and reasons for not using it if the recommendation is to not use the trading algorithm. [5/45 points]

Conclude your report with a recommendation for your client about how to proceed with the trading algorithm. [5/45 points] In evaluating the input data:

- State the stocks that the trading algorithm is allowed to invest in.
- Identify any flaws in or problems with the data sourced from Yahoo Finance and the Reserve Bank of Australia.
- Describe the properties of the data (using graphs where appropriate) and their implications for the trading algorithm. In your analysis of the data:
- Rank the individual stocks by their average monthly excess returns over the risk free rate.
- Rank the individual stocks by their monthly excess return standard deviations.
- Rank the individual stocks by their Sharpe ratios.
- Examine the correlations between the excess returns on the stocks.
- Assess the appropriateness of assuming that excess returns are normally distributed.
- Address the stability over time of the distribution of excess returns.

- Identify any extreme outliers and assess whether they have been suitably handled in the data preparation process.
- Assess the adequacy of the way in which monthly returns have been computed.
- Assess the adequacy of the way in which missing values have been handled.

In evaluating the trading algorithm:

- Describe the features of the trading algorithm and their impact on the portfolio weights.
- Indicate any features of the trading algorithm or its development process that are likely to compromise the informativeness of its performance assessment.

In evaluating the performance assessment for the trading algorithm:

- State how likely it is that the predicted profitability of the trading algorithm will be informative about performance into the future and explain your view.
- Include in you report, a 1-month-ahead 99th percentile Value-at-Risk measure computed for the portfolio that would be held at the end of the available data if the trading algorithm were to be adopted for an initial investment of $10,000,000. Explain and justify your decisions when deciding how to compute the VaR.

If you suggest improvements to the algorithm, describe and motivate the recommended changes in your report.

# 1 Raw data used by the trading algorithm

The stocks that are included in the portfolio managed by the trading algorithm are based upon your student ID.

For all students, all 9 stocks from Table 1 are included in the set of assets that can be included in the portfolio by the trading algorithm.

Table 1: companies in common Yahoo Finance Code Company CBA.AX Commonwealth Bank CSL.AX CSL Limited

BHP.AX BHP Group Limited

WBC.AX Westpac Banking Corp

NAB.AX National Aust. Bank ANZ.AX ANZ Banking Group Limited

WOW.AX Woolworths Group Limited

TLS.AX Telstra Corporation

WES.AX Wesfarmers Limited

Also include between one and three additional stocks from table 2. The last three digits of your SID number determine which stocks from table 2 are investment options for the trading algorithm that you are to review.

Table 2: individual-specific companies

SID digit Yahoo Finance Code Company

- AX Macquarie Group Limited
- AX RIO Tinto Limited
- AX Woodside Petroleum
- AX Newcrest Mining
- AX Qantas Airline
- AX Aristocrat Leisure
- AX Insurance Australia
- AX Santos Limited
- AX Harvey Norman Retailer
- AX Suncorp Group Limited

*For example, if you SID is 47033566, the trading algorithm would also be able to include Aristocrat Leisure (ALL.AX) because the third last digit is 5. The trading algorithm would also be able to include Insurance Australia (IAG.AX) because both the second last and last digits are 6.*

All of the stock data is available from Yahoo Finance. For each stock, you can download a CSV file that will include columns for the open, high, low, close and “adj. close”. The data that is used for equity return calculation is the “adj. close” data, which is adjusted so that the returns are not impacted by dividends, stock splits and other discretionary activities of the company.

The trading algorithm uses the 30-day bank bill swap rate as the risk-free rate. This “risk-free” rate has been sourced from the Reserve Bank of Australia’s historical data publication using the older 30-day bank bill rates from 1976 to 2010 and combining it with the more recent data from the RBA’s interest rate tables, specifically the rates from 2011 onwards. The data for the 30-day bank bill rate, “FIRMMBAB30D”, has been retained from these sources in the spreadsheet “30dayBBSW.xlsx”.

The retrieval of the latest data from Yahoo is done for you by the R script “Get Raw Data.R” so only download the CSV files if you want to validate the raw data gathering process. You just need to update it to reflect the list of stocks that can be included in the portfolio (based on your SID) by the trading algorithm. The same script also loads the risk free rate data from the Excel spreadsheet and combines it into an extended time series with the adjusted stock prices.

# 2 Transaction costs

The trading algorithm assumes a transaction cost associated with trading risky assets. Specifically, when purchases or sales of a dollar amount of a risky asset will incur a transaction cost of 0.1% of the value of the amount purchased or sold. This has been taken into account in the design of the trading algorithm and its performance assessment.

# 3 Explanation of R scripts

Before he departed, the quant. who designed the trading algorithm said that the code for the algorithm is “self-documenting”. It has been implemented in 6 separate R scripts that are to be run in a specific order.

- “Get Raw Data.R”, downloads the latest data from Yahoo and merges it with data from the RBA before saving it as an R dataset to a file in the same directory as the script itself. This script also saves the close price data in a second R data file, for use in trading algorithm performance analysis.
- “Prepare Data.R”, computes monthly returns on the equity data and saves the data to two files, one containing all the data and one containing only the training data set.
- “Trading Algorithm Using Training Data.R”, uses the trading algorithm to produce monthly updates to portfolio weights for the risk-free asset and the risky stocks using the training data set.
- “Calculate Profits Over Training Data.R”, computes the portfolio value and the earnings from each asset for every month of portfolio rebalances based on the training data set.
- “Trading Algorithm Using Heldback Data.R”, uses the trading algorithm to produce monthly updates to portfolio weights for the risk-free asset and the risky stocks using the held-back data set.
- “Calculate Profits Over Heldback Data.R”, computes the portfolio value and the earnings from each asset for every month of portfolio rebalances based on the heldback data set.

The scripts, along with the spreadsheet containing the RBA interest rates data have been made available to you in a compressed ZIP archive file that contains the relevant files in a folder. Extract the ZIP archive. Using R Studio, open the file:

“Assignment R.Rproj”

This will provide you with access to all the scripts and data in the one folder.

Before leaving his employer, the quant. described the trading algorithm, saying that it was developed by optimising performance over the training data set and then evaluating it using the held-back data, from the end of the training data set to the end of 2019. It was based upon Markowitz-style portfolio optimisation, doing monthly updates of the tangency portfolio, computing the capital allocation line, and then targeting a specific expected return along that capital allocation line.

To mitigate risk, the algorithm then overrides the weight on the risk-free asset, if necessary, capping it at -50%. This risk mitigation step ensured that the investor never borrowed more than 50% of the amount invested in risky assets.

Transaction costs were too small to factor into the portfolio optimisation process. Instead they were accounted for by adjusting the weight on the risk-free asset, to reflect the costs of the transactions necessary to rebalance the investments in the risky assets.

## Leave a Reply

Want to join the discussion?Feel free to contribute!