Hi, I am using this beta computation code from (https://www.quantopian.com/lectures/example-long-short-equity-algorithm)
beta = 0.66*RollingLinearRegressionOfReturns(
).beta + 0.33*1.0
I noticed that in backtest periods for short durations the beta is much higher than the bounds I set in the order_optimal_portfolio that takes beta bounds from the above code in the pipeline.
For instance, beta is like 0.6 to 0.8 when the bounds of beta are [-0.25 .. 0.25] if I run it for a month or two. Over long periods (6months+) beta ultimately seems to settle within the bounds that was set in the constraint.
I am wondering if I can continue to use the beta calculation code in that lecture for all my algorithms for limiting beta to the bound that is necessary for Quantopian requirements or do I need to do some calculations on my own or use a different piece of code?