FE5206 Final Assignment, Due: Wednesday, 22 November 2023
Submit your answers to Canvas. Word and PDF files are acceptable. Please include your name (family name first) at the beginning of the filename.
You will construct two alpha factors: V and M for the US market.
V is based on the prior 10-day returns and M is the MAX factor discussed in the lecture. The steps to construct factor V are the same as in Assignment 2 (except that the order of steps c and d are interchanged). For simplicity, ranking is not used to construct V and M.
1. Consider the US market and the years 2004 to 2023 (you will also need some data in 2003 to calculate the alpha factor). The universe used for each year will be based on the universe from the start of the year (defined in the univ_h.csv file).
2. To construct factor V
a) calculate the daily volatility 𝜎𝜎 (𝑡𝑡) using the prior 21 days of
daily returns (use the log return 𝑟𝑟(𝑡𝑡′)=ln� 𝑝𝑝𝑖𝑖�𝑡𝑡′� �,𝑡𝑡′ =𝑡𝑡− 𝑖𝑖 𝑝𝑝 (𝑡𝑡′−1)
20, … , 𝑡𝑡, the return is set to 0 if there is an “NA” in the adjusted
prices). If 𝜎𝜎𝑖𝑖(𝑡𝑡) obtained is less than 0.005, set it to 0.005. b) calculate the prior 10-day return; you can use the log-return
𝑣𝑣(𝑡𝑡)=ln( 𝑝𝑝(𝑡𝑡) ) (again,thereturnissetto0ifthepriceisnot
𝑝𝑝𝑖𝑖(𝑡𝑡−10)
c) normalize the variable by dividing the volatility 𝜎𝜎 (𝑡𝑡) obtained
available)
d) subtract out the market average 𝑣𝑣𝑀𝑀(𝑡𝑡) = 𝑁𝑁1 ∑𝑁𝑁𝑖𝑖=1 𝑣𝑣𝑖𝑖(𝑡𝑡) (N is the
in step a), 𝑣𝑣𝑖𝑖(𝑡𝑡) ← 𝑣𝑣𝑖𝑖(𝑡𝑡)/𝜎𝜎𝑖𝑖(𝑡𝑡)
number of stocks in the universe for the year), 𝑣𝑣𝑖𝑖 (𝑡𝑡) ←
𝑣𝑣𝑖𝑖(𝑡𝑡) − 𝑣𝑣𝑀𝑀(𝑡𝑡)
3. To construct factor M
a) Use the daily returns for the past 21 trading days, 𝑟𝑟 (𝑡𝑡′) =
ln� 𝑝𝑝𝑖𝑖�𝑡𝑡′� �,𝑡𝑡′ = 𝑡𝑡 − 20,…,𝑡𝑡, calculated in Step 2a).
𝑝𝑝𝑖𝑖(𝑡𝑡′−1)
b) subtract out the corresponding market returns (calculated using asimpleaverage): 𝑅𝑅(𝑡𝑡′)=𝑟𝑟(𝑡𝑡′)−𝑟𝑟 (𝑡𝑡′),𝑡𝑡′ =𝑡𝑡−20,…,𝑡𝑡
c) get the maximum value, 𝑚𝑚𝑖𝑖 (𝑡𝑡), of the magnitudes of the prior 21
daily returns, |𝑅𝑅𝑖𝑖(𝑡𝑡′)|, 𝑡𝑡′ = 𝑡𝑡 − 20, … , 𝑡𝑡. The normalization by the volatility is not applied to this factor.
Programming Help
d) subtract out the market average 𝑚𝑚𝑀𝑀(𝑡𝑡) = 𝑁𝑁1 ∑𝑁𝑁𝑖𝑖=1 𝑚𝑚𝑖𝑖(𝑡𝑡), 𝑚𝑚𝑖𝑖(𝑡𝑡) ← 𝑚𝑚𝑖𝑖(𝑡𝑡) − 𝑚𝑚𝑀𝑀(𝑡𝑡)
4. Do a cross-sectional regression of the next day’s return 𝑅𝑅𝑖𝑖(𝑡𝑡 + 1) ≡
𝑅𝑅𝑖𝑖(𝑡𝑡,𝑡𝑡 + 1) 𝑅𝑅𝑖𝑖(𝑡𝑡 + 1) = 𝛽𝛽𝑣𝑣(𝑡𝑡)𝑣𝑣𝑖𝑖(𝑡𝑡) + 𝛽𝛽𝑚𝑚(𝑡𝑡)𝑚𝑚𝑖𝑖(𝑡𝑡) + 𝜖𝜖𝑖𝑖, 𝑖𝑖 = 1,…,𝑁𝑁
on day t and get the time series of 𝛽𝛽𝑣𝑣(𝑡𝑡) and 𝛽𝛽𝑚𝑚(𝑡𝑡). Here 𝑅𝑅𝑖𝑖(𝑡𝑡 + 1) is definedas 𝑅𝑅𝑖𝑖(𝑡𝑡+1)=𝑟𝑟𝑖𝑖(𝑡𝑡+1)−𝑟𝑟𝑀𝑀(𝑡𝑡+1),
where 𝑟𝑟𝑖𝑖(𝑡𝑡 + 1) = ln �𝑝𝑝𝑖𝑖(𝑡𝑡+1)�) and the market return 𝑟𝑟𝑀𝑀(𝑡𝑡 + 1) is the 𝑝𝑝𝑖𝑖(𝑡𝑡)
simple average of 𝑟𝑟𝑖𝑖(𝑡𝑡 + 1).
5. From the years 2005 to 2023, calculate the 2-year average of
𝛽𝛽 (𝑡𝑡), 𝛽𝛽 (𝑡𝑡), and the t-stat, √𝑇𝑇 ���� 𝑎𝑎𝑎𝑎𝑎𝑎 √𝑇𝑇 ����� , where T is the number
𝜎𝜎𝑣𝑣 𝜎𝜎𝑚𝑚 𝛽𝛽𝑣𝑣 𝛽𝛽𝑚𝑚
of trading days in the year and the year before (for example, the average obtained for the year 2005 is over the years 2004 and 2005; for the year 2023 the average is over one and half years as there is
only half year data in 2023) and 𝜎𝜎 and 𝜎𝜎 are the standard 𝛽𝛽𝑣𝑣 𝛽𝛽𝑚𝑚
deviation of 𝛽𝛽𝑢𝑢(𝑡𝑡), 𝛽𝛽𝑣𝑣(𝑡𝑡) calculated using 𝛽𝛽𝑢𝑢(𝑡𝑡), 𝛽𝛽𝑣𝑣(𝑡𝑡) in these two-year periods. List the two-year average betas and the t-stat obtained in a table.
��� ���� From the years 2006 to 2023, use the two-year average 𝛽𝛽 , 𝛽𝛽
calculated (in Part A) from the previous year (for example, for the year 2006, use the 2-year average obtained in 2005 in Part A) and evaluate
the expected returns for the year,
𝑅𝑅 (𝑡𝑡,𝑡𝑡+1)=𝛽𝛽𝑣𝑣(𝑡𝑡)+𝛽𝛽 𝑚𝑚(𝑡𝑡)
𝐸𝐸𝑖𝑖 𝑣𝑣𝑖𝑖𝑚𝑚𝑖𝑖
Construct and evaluate the portfolio as follows,
1. On each day t, rank the stocks according to the expected returns,
and long (with equal weights) the top 20% of the stocks with the largest values of 𝑅𝑅 (𝑡𝑡, 𝑡𝑡 + 1) and short the bottom 20% of the stocks
with the smallest values (most negative values) of 𝑅𝑅𝐸𝐸𝑖𝑖 (𝑡𝑡, 𝑡𝑡 + 1)
2. Get the portfolio return at each time step t. The return is on the long market value of the portfolio, so it is the sum of the returns on individual positions divided by the number of long positions in the portfolio, 𝑙𝑙 𝑠𝑠
𝑟𝑟(𝑡𝑡,𝑡𝑡+1)= 1 �∑𝑁𝑁 𝑟𝑟 (𝑡𝑡,𝑡𝑡+1)−∑𝑁𝑁 𝑟𝑟
𝑝𝑝 𝑁𝑁𝑙𝑙 𝑗𝑗=1 𝐿𝐿(𝑗𝑗) 𝑗𝑗=1 𝑆𝑆(𝑗𝑗)
(𝑡𝑡,𝑡𝑡+1)�,
where 𝑁𝑁𝑙𝑙 and 𝑁𝑁𝑠𝑠 are the number of long and short positions (both
Computer Science Tutoring
are equal to 0.2 × 𝑁𝑁, 𝑁𝑁 is the number of stocks in the universe for that year). 𝐿𝐿(𝑗𝑗) is the stock index of the long position j. 𝑆𝑆(𝑗𝑗) is the stock index of the short position j. Note that when calculating the portfolio return, the full return 𝑟𝑟 (𝑡𝑡 + 1) ≡ 𝑟𝑟 (𝑡𝑡, 𝑡𝑡 + 1) without subtracting the market return is used. 𝑖𝑖 𝑖𝑖
3. For each year calculate the total annual return (assuming the cost of trading is 0) and the annual return volatility of the portfolio. Which are the best and the worst years for the strategy?
Part C (optional)
Assume that the percentage trading cost is 5 bps and calculate the portfolio returns, taking into account the cost. Compare the results to the case when the costs are not taken into account (obtained in Part B). For simplicity, we assume the LMV (the long market value) of the portfolio is kept the same and we ignore the cost of maintaining the constant LMV.
Your reflections on the group project and the course: Briefly describe a) How do you contribute to the project? b) What difficulty, if any, have you encountered in doing the project and studying for the course? c) Which topic of quant investment is most interesting to you? d) Which topic is the most difficult to understand?
浙大学霸代写 加微信 cstutorcs