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:

1. the suitability of the input data; [15/45 points]

2. the trading algorithm itself; and [10/45 points]

3. 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:

1. Rank the individual stocks by their average monthly excess returns over the risk free rate.

2. Rank the individual stocks by their monthly excess return standard deviations.

3. Rank the individual stocks by their Sharpe ratios.

4. Examine the correlations between the excess returns on the stocks.

5. Assess the appropriateness of assuming that excess returns are normally distributed.

6. 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

0 MQG.AX Macquarie Group Limited

1 RIO.AX RIO Tinto Limited

2 WPL.AX Woodside Petroleum

3 NCM.AX Newcrest Mining

4 QAN.AX Qantas Airline

5 ALL.AX Aristocrat Leisure

6 IAG.AX Insurance Australia

7 STO.AX Santos Limited

8 HVN.AX Harvey Norman Retailer

9 SUN.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.

1. “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.

2. “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.

3. “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.

4. “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.

5. “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.

6. “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.