How to Pick Good Stocks.
There is a way to find a good stocks for your investments portfolio that uses stock price history for evaluation of the portfolio expected return and volatility. It's called the portfolio optimization.
The Sharpe ratio can be though of as a measure of return to a risk, or as the measure of the portfolio "effectiveness".
If you don't interested in underlying math, you can skip to the Steps section.
$Sharpe\;Ratio = \frac{R_p - R_f}{\sigma_p}$
where
$R_p$ is the expected excess return of portfolio
$R_f$ is a risk - free rate
$\sigma_p$ is the standard deviation of the portfolio return
Return of the portfolio for holding period can be calculated as
$R = \frac{V_f - V_i}{V_i}$
where
$V_f$ = final value, including dividends and interest
$V_{i}$ = initial value
and the excess return formula is $R_p = R - 1$
Expected return of the asset for a long time period in most cases calculated as the geometric mean of the asset return for a small time periods.
$\overline{R} = \left(\prod _{i=1}^{N}a_{i}\right)^{\frac {1}{N}}={\sqrt[{N}]{a_{1}a_{2}\cdots a_{N}}}$
or, equivalently, as the arithmetic mean in logscale:
$\overline{R} = \exp {\left({{\frac {1}{N}}\sum \limits _{i=1}^{N}\ln a_{i}}\right)}$
where $a_i$ are the asset returns for each period, $N$ is a number of periods.
The variance is the expectation of the squared deviation of a random variable from its population mean or sample mean. It can be calculated as follows:
The formula for biased variance is:
$\begin{aligned}\sigma ^{2}&={\frac {1}{N}}\sum _{i=1}^{N}\left(a_{i}-\mu \right)^{2}={\frac {1}{N}}\sum _{i=1}^{N}\left(a_{i}^{2}-2\mu a_{i}+\mu ^{2}\right)\\[5pt]&=\left({\frac {1}{N}}\sum _{i=1}^{N}a_{i}^{2}\right)-2\mu \left({\frac {1}{N}}\sum _{i=1}^{N}a_{i}\right)+\mu ^{2}\\[5pt]&=\left({\frac {1}{N}}\sum _{i=1}^{N}a_{i}^{2}\right)-\mu ^{2}\end{aligned}$
where the population mean is
${\displaystyle \mu ={\frac {1}{N}}\sum _{i=1}^{N}a_{i}.} $
The formula for unbiased variance is:
$ {\displaystyle \sigma ^{2}={\frac {1}{N - 1}}\sum _{i=1}^{N}\left(a_{i}-\mu \right)^{2}. }$
And finally, the standard deviation of the asset (portfolio) return is the square root of the variance.
$\sigma_p = \sqrt{{\sigma}^2}$
It can be seen from these equation that maximizing the Sharpe ratio you could get a portfolio with high expected return and low risk.
Steps:
- Open the https://asset-master.net/ webpage on you PC. (Note that the website isn't working on the mobile, so please use PC or notebook instead.)- Read the "Quickstart" instructions on the main page.
- Register on the website (registration is required for portfolio optimization) and download the example data.
- Unzip the archive with downloaded data. Install the LibreOffice if you don't have it installed already.
- Open the file "tickers.csv" with the help of LibreOffice Calc. Click button "OK" in the prompt window to agree with the settings for opening the file.
- Add stock symbols you would like to see in your portfolio to the column of symbols. For example you can add symbols "MSFT" and "AAPL".
- Delete the rows with the symbols you wouldn't like to be in your portfolio.
- To save your file with symbols choose menu "File" -> "Save As..." on the top left.
- Follow the steps described on the main page of website https://asset-master.net/, but choose "Maximize Sharpe Ratio" method under the "Choose optimization type for Mean - Variance optimization" caption, and choose the file you just saved for "Choose stock universe file" field.
Your portfolio settings page should looks as follows except the file name and portfolio allocation sum (click on the picture to enlarge):
- Click button "Optimize" at the bottom of the page. Take a look at the log messages. while portfolio optimization will take place.
- After you see the message Now you can take a look at your optimization result at the log
window, click the Optimization result... button to view you optimization results.
Tips
Note that you can choose different time horizons for evaluating the expected return and volatility for stocks.
When looking at your optimization results page, take a look at the "Date From" field in the tables, they should be nearly the same for all stocks. In other case, the expected return and volatility for optimization can be estimated incorrectly, because the overall expected return for nearly all the stocks is changing with the time.
Try to use at least 10 years of history data while optimizing portfolio because there are quite big falls of stock prices nearly every 10 years. It is noted in the Economic Cycles theory (Juglar cycle). You can optimize portfolio with up to 150 stock symbols using Daily stock history data for free account type. Also try to use a small (some years maybe) time period of stock quote history, to check if the expected return/volatility for some stocks from the chosen stock set is not degraded recently.
This is essential that the number of the stock price data for calculating the covariance matrix should be greater than the overall symbol count in your portfolio, because in the other case the covariance matrix will be singular (i.e. non-invertible) [6]. Even in the case when the number of the stock price data points is not bigger enough than the overall symbol count in your portfolio, you can get a poor estimate for the covariance matrix if you will not use the covariance matrix shrinkage [6], [7]. In that case it is recommended that you will use the shrinkage estimator for the covariance matrix calculation.
The result of the example of Sharpe ratio optimization.
For example, given 396 stocks from S&P 500 which have about 20 years of history price quotes, the optimization of Sharpe ratio gives a quite impressive results:expected return: 0.35
volatility: 0.218
Sharpe ratio: 1.511
Note that you can also minimize risk for a given target return or maximize return for a given target volatility, or even minimize volatility by choosing the appropriate value in the Choose optimization type for Mean - variance optimization selector.
You can download the complete report here.
You can download ticker list in csv format here.
When observing the optimization result, note that the count of the stock data sample is at least $10$ times larger than the count of the stock symbols, so the estimate of the covariance matrix should be good enough without the covariance matrix shrinkage.
References:
[1] Mean-variance optimization
[2] Portfolio optimization
[3] Portfplio optimization 2
[4] Sharpe ratio
[5] Economical cycles
[6] Improved Estimation of the Covariance Matrix of Stock Returns With an Application to Portfolio Selection
[7] Honey, I Shrunk the Sample Covariance Matrix


Comments
Post a Comment