Momentum

This code replicates the methodology of Jegadeesh and Titman (1993). Momentum portfolios are formed based on past 3-12 months returns. This is a relatively simple Python application as it involves only one database, which is CRSP, and main variable of interest, cumulative past return, is fairly easy to compute.

As always, first import the various Python data packages and establish connection with WRDS server.

The next step is to extract return related data from CRSP database:

With the return data ready, I then calculate the cumulative return by summing log returns. There can be many other methods to arrive at the same goal.

Form momentum portfolios:

Calculate long winners-short losers strategy and report portfolio statistics:

The table below reports the summary statistics of the winner, loser and long-short portfolios.

The chart below reports the historical performance of the momentum strategy:

The left figure reports the cumulative return of the long-short portfolio. The right figure reports the winner and loser portfolio separately, where the blue line represents the portfolio return of the past winners and the red line shows the portfolio return for past losers.