I am a newbie here. Trying to learn and deploy my investment through Quantopian. I started with some youtube tutorial videos, and now working through the API docs.
In the section of pipeline, I tried to run the sample code in the Algorithms. I just copy and paste the attached 'official' code, but the system returned with the Error message: --- Error InvalidSidCount: 0019 Algorithm must reference 1-500 SIDs. Found 0
So what happened to the code? is it an official documented code? What shall I do?
Thanks in advance for your help, Allan
from quantopian.algorithm import attach_pipeline, pipeline_output
from quantopian.pipeline import Pipeline
from quantopian.pipeline.data.builtin import USEquityPricing
from quantopian.pipeline.factors import SimpleMovingAverage
# Create and attach an empty Pipeline. pipe = Pipeline() pipe = attach_pipeline(pipe, name='my_pipeline') # Construct Factors. sma_10 = SimpleMovingAverage(inputs=[USEquityPricing.close], window_length=10) sma_30 = SimpleMovingAverage(inputs=[USEquityPricing.close], window_length=30) # Construct a Filter. prices_under_5 = (sma_10 < 5) # Register outputs. pipe.add(sma_10, 'sma_10') pipe.add(sma_30, 'sma_30') # Remove unwanted rows from output. pipe.set_screen(prices_under_5)
def before_trading_start(context, data):
# Access results using the name passed to
results = pipeline_output('my_pipeline')