Building a Basic Cross-Sectional Momentum Strategy – Python Tutorial

In this tutorial we utilize the free Alpha Vantage API to pull price data and build a basic momentum strategy that is rebalanced weekly. This approach can be adapted for any feature you’d like to explore. Let me know what you’d like to see in the next video!

5 thoughts on “Building a Basic Cross-Sectional Momentum Strategy – Python Tutorial

  1. Hi Colton, how are you? nice video!
    Just two things:
    1 – when calculating the weekly return you are doing look ahead bias because in the first line you already have a return and in my opinion need to be at the opposite way.
    2 – for returns you can use the pandas function pct_change().

    tks!

    Like

    1. Hey Felipe, glad you enjoyed it! The reason I do it this way without pct_change() is because want to align the coming week’s return with the signal which makes it easy to work with (think of the return as a label). The return wouldn’t be realized until the following week but there isn’t look ahead bias. Does that make sense?

      Like

      1. Yeap! you are right. One thing you can do is some dual momentum approach. using the sectors etfs as your macro momentum and operate inside their members using the relative momentum.

        Cheers!

        Liked by 1 person

  2. Hi Colton,

    Appreciate you very helpful tutorial. I am getting the following error while executing:

    ValueError: could not convert string to float: ‘1999-11-12 00:00:00’

    Like

Leave a comment