$24
Directions: Please submit your Python code le, formatted as in previous assignments.
The grader should be able to run your code when it is placed in the same directory as the input data le.
Be sure that your code loads any libraries you are using.
Background: The folder Stocks.zip contains nearly 300 les, each including daily data for a speci c stock, with stock ticker symbol given in the le name. Each observation includes the following:
Date = date information recorded
Open = opening stock price
High = high stock price
Low = low stock price
Close = closing stock price
Volume = number of shares traded
Adj Close = closing price adjusted for stock splits (ignored for this assignment)
The time interval covered varies from stock to stock. There are some missing records, so the data is incomplete. Note that some dates are not present because the exchange is closed on weekends and holidays. Those are not missing records. Answer the questions below based on the data available in the les.
1. Find the mean for the Open, High, Low, and Close entries for all of the records taken as a single group.
2. Find the top-5 and bottom-5 stocks in terms of their average Close price. Give tables showing the stock ticker symbol and the average Close price. (Print out of a Series or DataFrame is ne.)
3. Find the top-5 and bottom-5 stocks in terms of the day-to-day volatility of the price. This is the mean of the di erences High - Low daily for each stock. Give tables for each, as in the previous problem.
4. Repeat the previous problem, this time using the relative volatility, which is given by
High Low
0:5(Open + Close)
for each day. As above, provide tables.
5. For each day the market was open in February 2010, nd the average daily price for all stocks for each of Open, High, Low, Close, and Volume.
6. For 2012, nd the date with the maximum average relative volatility for all stocks and the date with the minimum average relative volatility for all stocks. (Consider only days when the market is open.)
7. For 2008-2013, for each day of the week, nd the average relative volatility for all stocks. (Consider only days when the market is open.)
8. The \Python Index" is designed to capture the collective movement of all of our stocks. For each date, this is de ned as the average price for all stocks for which we have data on that day, weighted by the volume of shares traded for each stock. That is, for stock values S1; S2; : : : with corresponding sales volumes V1; V2; : : :, the average weighted by volume is
S1V1 + S2V2 +
V1+V2+
Find the Open, High, Low, and Close for the Python Index for each day the market was open in October 2010. Give a table the includes the Date, Open, High, Low, and Close, with one date per row.