I didnt see a post on this AttributeError so I thought I would make a post asking for some help. Below is how I have initialize() and make_pipeline() set up. The error is pointing to pipe = make_pipeline()
. For context, I am trying to calculate the drawdown of SPY and then rebalance the portfolio (context.w) based on the drawdown percentage of SPY. As a result, I am trying to create a pipeline for a single stock. Perhaps there is a better way of going about doing this?
def initialize(context):
context.w = {symbol('VTI'): 0.30,
symbol('TLT'): 0.40,
symbol('IEI'): 0.15,
symbol('GLD'): 0.075,
symbol('GSG'): 0.075}
pipe = make_pipeline()
attach_pipeline(pipe, name='my_pipeline')
schedule_function(rebalance, date_rules.week_start(), time_rules.market_open(hours=1))
def make_pipeline():
asset = [symbols('SPY')]
spy_screen = StaticAssets(asset)
drawdown = DrawdownFactor()
return Pipeline(
columns={
'drawdown': drawdown
},
screen=spy_screen,
)