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().



    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?


      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.


        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’


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s