Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
How to select start and end date in IDE?

Hi all,

In the Notebook, when I want to select a start and end date for the backtest, I can do something like this:

period_start = '2018-09-11'  
period_end = '2018-10-11'

data_output = run_pipeline(  
    make_pipeline(),  
    start_date=period_start,  
    end_date=period_end  
)

But in the IDE, I can't figure out how to accomplish the same thing. If the code is...

algo.attach_pipeline(make_pipeline(context), 'algo_name_here')  

...then how can I select the time period? If I try to pass start_date/end_date parameters to this, I get the expected error "attach_pipeline() got an unexpected keyword argument 'start_date'".

Thanks
Jovan

6 responses

Have a look at the right hand side, you have drop down menus for backtest start and stop. You don’t specify this in the code in the IDE. :)

The example here seems to have everything except the date period definition:

https://www.quantopian.com/tutorials/pipeline#lesson12

@Joakim - ha, that's kinda obvious. Thanks. Any idea why you can't define it through code though?

Just a design decision they made I guess.

Hi Jovan,

In backtesting, an attached pipeline is executed once for every day in the simulation. On simulation day N of the backtest, the pipeline will be executed for day N. You can get the result of your pipeline execution on day N by calling pipeline_output on that day (this is why pipeline_output` is usually called every day).

In research, there's no implicit date, so you instead have to pass a start and end date to run_pipeline, as you noted above. The results of a pipeline execution in research include the results from each of the days in the range from start_date to end_date, but you should think about the results from each day as being the result of the pipeline being executed on that day.


Other folks have asked for the ability to run a pipeline for more than a day (i.e. provide a start and end date) in the IDE/backtesting. The common use case here has been the desire to train a model on a historical window of data. Unfortunately, explicitly running a pipeline over multiple days is not currently supported in backtesting.

Can you tell me more about your use case? What are you looking to do with your pipeline in the IDE?

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Hi Jamie,

My partner and I are working on an algorithm together. The reason I needed to set it up on the IDE instead of the notebook is simple - there's no "collaborate" option on a notebook.

So when I want to share my code with him (and vice-versa) it looks like I have to set it up on the IDE, which is a bit cumbersome. I suppose we could use an outside service like GitHub, but ideally I would like to be able to collaborate on a notebook.

Do you know if there's any way to make that possible?

Thanks
Jovan