Hello - I'm running the following code:
import zipline.api as algo
import numpy as np
from zipline.finance import commission, slippage
from zipline.pipeline import Pipeline
from zipline.pipeline.data import EquityPricing
from zipline.pipeline.factors import AverageDollarVolume, Returns, SimpleBeta, CustomFactor
from codeload.pipeline_tutorial.tradable_stocks import TradableStocksUS
from zipline.api import (
attach_pipeline,
date_rules,
time_rules,
get_datetime,
schedule_function,
pipeline_output,
record,
get_open_orders,
order_target_percent,
set_commission,
set_slippage,
)
MOMO_SHORTER = 126
BUNDLE = "usstock-1min"
DATA_FREQUENCY = "daily"
N_LONGS = 15
STOP_LOSS = .85
REBALANCE = 3
#SPY = 'FIBBG000BDTBL9'
class Advanced_Momentum_Shorter(CustomFactor):
""" Momentum factor """
inputs = [EquityPricing.close,
Returns(window_length=126)]
window_length = 126
def compute(self, today, assets, out, prices, returns):
out[:] = ((prices[-21] - prices[-MOMO_SHORTER])/prices[-MOMO_SHORTER] -
(prices[-1] - prices[-21])/prices[-21]) / np.nanstd(returns, axis=0)
def make_pipeline():
price = EquityPricing.close.latest
universe_price = price.all_present(252)
avg_dollar_volume = AverageDollarVolume(window_length=90)
mid_and_large_cap = avg_dollar_volume.percentile_between(26, 100)
universe_tradable = TradableStocksUS() & mid_and_large_cap
universe = universe_price & universe_tradable
beta = SimpleBeta(target=sid('FIBBG000BDTBL9'), regression_length=126)
price_momentum = Advanced_Momentum_Shorter() / beta
````
And receiving the following error:
````
HTTPError: ('400 Client Error: BAD REQUEST for url: http://houston/zipline/backtests/Price_Momentum_6Month_LongOnly_Beta_Adjusted_strategy?start_date=2017-01-01&end_date=2024-01-01&progress=M', {'status': 'error', 'msg': "name 'sid' is not defined (see detailed logs for full traceback)"})
````
I believe I've followed the documentation on the required parameters for SimpleBeta correctly. Any guidance would be appreciated.
Thanks.