BlueShift error for course "Mean Reversion Strategies In Python" Section 16, Unit 9 in

I am trying to run the mean reversion strategy based on an ETF and 500 US stocks. As per instructions I did not change the code at all and expect it to work outside the box in this exercise.

It follows the code snippet affected for context and the error logs thrown by the console.

Please let me know how this can be fixed.

"""
    Title: Long-Short Portfolio Strategy Template
    Description: The long-short portfolio is implemented by making positions
    on the SP500 constituents using pipelines.
    Dataset: US Equities
    
    ############################# DISCLAIMER #############################
    This is a strategy template only and should not be
    used for live trading without appropriate backtesting and tweaking of
    the strategy parameters.
    ######################################################################
"""

# Import numpy
import numpy as np

from blueshift.pipeline import CustomFactor
from blueshift.pipeline.data import EquityPricing

# Import blueshift libraries
from blueshift_library.pipelines.pipelines import average_volume_filter

Throws the following error:

  • [ERROR]

Blueshift Alert(ff567251-c1e3-459e-be5c-67bd0c6595a8)2026-01-02 16:49:59.143764-05:00: Algo reported status created:Failed to create algo: Error in line 21, file <>:Import from blueshift_library is deprecated. Use blueshift.library instead…

  • [PLATFORM]

Failed to create algo: Error in line 21, file <>:Import from blueshift_library is deprecated. Use blueshift.library instead…

  • [PLATFORM]

Blueshift Alert(ff567251-c1e3-459e-be5c-67bd0c6595a8)2026-01-02 16:49:59.149959-05:00: Algo run ff567251-c1e3-459e-be5c-67bd0c6595a8 finished.

Hi Benjamin,

Thank you for sharing the detailed logs. This issue is happening due to a couple of recent Blueshift platform/library updates, so the code may not run “out of the box” as-is at the moment. We’ll be updating the course code/content on our end soon to reflect these Blueshift changes. For now, applying the above fixes should allow you to proceed smoothly.

  1. Use the correct asset class / dataset

This strategy is meant for US Equities (SP500 constituents + SPY). If the backtest is run on an India equity dataset/backtester (or another non-US dataset), symbol('SPY') won’t be available and the algo will fail.
Please make sure the backtest environment is set to US Equities (US backtester / US dataset).

  1. Update deprecated imports

Blueshift has deprecated blueshift_library imports. Please replace:

from blueshift_library.pipelines.pipelines import average_volume_filter

with:

from blueshift.library.pipelines.pipelines import average_volume_filter
  1. Replace iteritems() with items() (pandas update)

Blueshift is now running pandas 2.x, where Series.iteritems() has been removed. Please replace:

for asset, weight in current_weights.iteritems():

with:

for asset, weight in current_weights.items():

If you try these and still see an error, feel free to share the updated logs and we’ll help you resolve it quickly. Thanks again for your query.