Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Can I "delay" the benchmark start?

I'm playing around with some algorithms which need to look back at fundamental data, e.g. compare last year's financials vs. this year's. Since I'm looking back, my algorithm won't actually start trading until around 1 year after the start of the lookback. The benchmark, however, starts on day 1. This clouds the results. I'd much rather compare against the algorithm from the time my algorithm makes the first trade.

Is there any way to only start tracking the benchmark from the first trade?
Is there any way to only start tracking the benchmark from a fixed date? (e.g. start backtest on 1-1-2010 but start benchmark on 1-1-2011?)

10 responses

just a thought but would it be easier to use the custom data window to track the benchmark movement commencing at t + 1yr?

That sounds like what I want, but I'm not sure I know how to do that? Are you suggesting I run a separate backtest to capture the benchmark return starting at t + 1y? Or is there a way to take a backtest and re-analyze based on a custom window?

umm...ok this is the blind leading the blind until someone who can 'see' chimes into this conversation ... see attached to get you started - believe it still needs tweaks to get you to where you need it to be though (sorry but in a rush but just wanted to get this out to you to play with) but should start showing you some direction ... ignore everything I import at the beginning - i just kind of import various libraries in anything I put together.

Also it might be better to take a look at the before_trading start function - think (not sure since still teaching myself 'Q') that might be able to do the look back you need therefore avoiding the need for such t+1 gap ... will leave you with this until someone who knows a bit more chimes in

Hi John,

Thanks for bringing this question to the attention of us and the Quantopian community! The short answer to your question is no, there is no way that you can start the benchmark from the date of your first trade or from a fixed date (essentially the same problem).

I can see why you want it - so that your algorithm is assessed over the correct amount of time, instead of over a period that is 1 year too long. The root of the problem seems to be that you are forced into this workaround approach, when you are most likely trying to get a history after calling get_fundamentals - a feature that is currently not supported on our platform. The ability to do this has been requested multiple times and is high on our radar. When we have added this feature to our site, we will announce it and the problem you are experiencing should be resolved.

In the meantime, your best bet is to make some sort of manual calculation for your returns (it shouldn't be too hard, just subtract the time-delay from the total time in the calculation).

Does this help clarify things?

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.

It does. Thanks. I'll look for the new feature.

Jamie - just curious at why the workaround I mentioned does not get him there?

Hi Umar

I think your idea works in principle for visualization. It doesn't give me any of the risk metrics. Your idea does let me compare the final returns (which is definitely an improvement over nothing).

Umar - From my understanding, you are suggesting that John adjust the time-frame window in the backtest performance visualization. If this is the case, adjusting this window only changes the visuals, not the quantitative metrics at the top, which I believe is what John is interested in!

makes sense.

Is this possible in 2.0?