In this notebook, we will code and analyse a time series momentum strategy across multiple asset classes. We will use lookback period of 12 months and holding period of 1 month. In time series momentum, we look at the past performance of financial instruments over time. If the financial instruments perform well in the past, we will buy; otherwise, we will sell.
First, we will import the necessary libraries and then, we will read the csv file with the different security prices using the 'read_csv' method of pandas.
We create a new function called get_ts_mom_strategy_returns function and pass data, lookback period and holding period as parameters. In the function, we calculate the strategy returns.
We create a new function, analytics_returns and pass strategy returns as a parameter to calculate Sharpe ratio, annualised returns, annualised volatility and maximum drawdown. Here, we will create an equal-weighted portfolio where we will allocate equal weight to each security in a particular class.
As we can observe, the time series momentum fails for most of the securities. The possible reasons for this failure could be:
- Time series under observation might not be trending
- 12 months and 1 month might not be the optimal lookback and holding period for all securities.