使用Python生成两组股票的汇总统计表

COMM 486H Assignment #2
September 11, 2019
Due on September 18, 2019, beginning of class
Note: Since this is your first assignment to be handed in, and many of you are getting up to speed on Python, we will allow you to hand in the assignment twice, or more, until you are satisfied with your work. But we do want you to show that you are making progress and we want to understand any difficulties you might be having, so please hand in something on September 18.
Please hand in a printed copy of your solution. Work either by yourself, or with one other student. It can be useful to work with someone, so we allow that, but we want everyone to learn the basics, so no groups of 3 or 4 (no free riders). In later assignments once we are sure that everyone has learned basics we will allow larger groups.
Hand in your answers as well as the Python codes when you submit the assignment. The sample code we provided for Assignment 1 will be useful.
Please note that we care about presentation and communication ability. Follow the same rules that you would in a business memorandum: make the work easy to read and use appropriate formatting, sentence structure, etc. Explanation and interpretation of your findings is just as important as getting the findings themselves correct.
1. The purpose of this assignment is to use Python to produce a table of summary statistics for two sets of stocks, for the period September 1, 2018 to August 31, 2019. In part A, you will work with the TSX 60 stocks. In Part B, you will choose your own set of “small” stocks.
A. Using the updated TSX 60 data from Assignment #1, for each stock calculate the following statistics from daily data: simple-return mean, simple-return standard deviation, simple-return autocorrelation, log return mean, log return standard deviation, log return autocorrelation. Tabulate these summary statistics for each stock. Separately, report statistics that describe the distribution of the summary statistics across the sample: sample mean, sample standard deviation, and the 10th, 50th, and 90th percentiles. For example:
1

Stocks
Mean μi
Standard deviation σi
Autocorrelation ρi
AEM.TO
AGU.TO

YRI.TO
Sample averages
The average μi
Sample standard deviation
SD of the μi
10th percentile
10th percentile of the μi
50th percentile 90th percentile
B. The TSX 60 includes all large firms. We want to see if there are differences for small stocks. Choose 30 “small” Canadian stocks. Ideally, we would like to use market capitalization as of August 31, 2018 to decide what is a small stock, but there is an issue. Yahoo Finance gives us accurate historical returns for most stocks, but not other fundamental information that we might be interested in (market cap, etc.). We could use other sources, such as CRSP/Compustat or Bloomberg, to get some of this information, but CRSP/Compustat is only for US firms, and for Bloomberg we would have to choose which stocks to look at. For right now, you can use one of two alternatives:
a. Choose a sample of stocks with low market capitalization now, cutoff of say $100 million. Note that using market cap today introduces a selection bias. What is the selection bias?
b. Choose a sample of stocks with a low share price, say below $2 CAD. While share price is not a perfect proxy for market cap, the two are highly correlated, so this should give us a sample of stocks that also have pretty low market caps today.
2

Given your choice of (a) or (b), produce the same table as in part A, but for your sample of small stocks. (It may be useful to use a stock screener as available at finance.yahoo.com for this part of the exercise.)
C. Discuss your results. What facts do you find interesting, within and across the tables? Can you relate your findings to any of the reading materials in Assignment #1? [Hint: what are your expectations of the differences in the two tables based on Blume and Stambaugh (1983)? We will be talking about Blume and Stambaugh in class next week so do not worry if this is not clear to you now.]
3