Using the code from the help section as an example:
def initialize(context):
pipe = Pipeline()
pipe = attach_pipeline(pipe, name='my_pipeline')
sma_10 = SimpleMovingAverage(inputs=[USEquityPricing.close], window_length=10)
sma_30 = SimpleMovingAverage(inputs=[USEquityPricing.close], window_length=30)
prices_under_5 = (sma_10 < 5)
pipe.add(sma_10, 'sma_10')
pipe.add(sma_30, 'sma_30')
pipe.set_screen(prices_under_5)
def before_trading_start(context, data):
results = pipeline_output('my_pipeline')
update_universe(results)
I'm new to Quantopian and how everything fits together still, but correct me if I'm wrong; calling update_universe
like this will mean that when I do:
def handle_data(context,data):
for stock in data:
print stock
Each of these stocks will be a result of what was filtered out in the pipeline
, yes? So what if I had a portfolio with assets which were excluded from the pipeline screen
? Would they not be included in data
?
If they are excluded, how would we be able to update_universe()
with the pipeline screen and the assets in our portfolio?
Thanks!