Exercises
Choose one or several assets (e.g., stocks or cryptocurrencies) for the following exercises.
Exercise 2.1 (Price time series) Choose one asset and plot the price time series using both a linear and logarithmic scale. Compare the plots and comment.
Exercise 2.2 (Return time series) Choose one asset and plot the linear returns and log-returns. Compare the plots and comment.
Exercise 2.3 (Volatility envelope) Choose one asset and compute the volatility (square root of the average of the squared returns over \(k\) samples) on a rolling-window basis in two ways:
- Left-aligned window: at each time \(t\), use the samples \(t-k+1, \dots, t\). Try different values of \(k\), observe the effect, and discuss.
- Centered window: at each time \(t\), use the samples \(t-\lfloor k \rfloor/2, \dots, t+\lceil k \rceil/2 - 1\). Try different values of \(k\), observe the effect, and discuss.
Finally, compare the left-aligned and centered rolling-window approaches and discuss.
Exercise 2.4 (Return distribution) Choose one asset and perform the following tasks:
- Plot the histogram of the log-returns at different frequencies. Compare the plots and comment.
- Draw the Q-Q plots to focus on the tail distribution. Do the returns follow a Gaussian distribution?
- Compute the skewness and kurtosis to see if they correspond to a Gaussian distribution.
Exercise 2.5 (Return autocorrelation) Choose one asset and perform the following tasks:
- Plot the autocorrelation function of the log-returns at various frequencies. Compare the plots and comment.
- Repeat the process using squared returns instead of log-returns. Compare these plots and comment.
Exercise 2.6 (Asset correlation) Choose several stocks and perform the following tasks:
- Compute the cross-correlations and plot a heatmap.
- Compute the correlation between each of the stocks and the index. Discuss the results.
- Compute the correlation between a stock and a cryptocurrency. Discuss the result and the implications.