Back to Community
Close price for minute and daily data

I've been using the pandas resampling method to derive daily close data from the minute data in a batch transform and I've found a difference between the close price from the daily data and minute data.

If the strategy is run with daily data using the "Build Algorithm" button, the log gives

2012-01-06print_data:13 INFO 422.45  
2012-01-06print_data:15 INFO 2012-01-03 00:00:00+00:00 411.10 2012-01-04 00:00:00+00:00 413.44 2012-01-05 00:00:00+00:00 417.96 2012-01-06 00:00:00+00:00 422.45 Freq: B  

The closing price for the 4th day is $422.45. Now, running a full backtest with minute data gives
2012-01-06 print_data:13 INFO 419.541 2012-01-06 print_data:15 INFO 2012-01-03 00:00:00+00:00 411.100 2012-01-04 00:00:00+00:00 413.440 2012-01-05 00:00:00+00:00 417.960 2012-01-06 00:00:00+00:00 419.541 Freq: B Here the closing price for the 4th day is $419.541. Looking at the second lines of both log outputs, the close price for the daily and minute data is the same for the first 3 days. It's only the close price on the last day in the batch transform that has a discrepancy.

I'm guessing this is likely caused by an incomplete dataset being passed to the batch transform during a full backtest with minute data.

Aidan

Clone Algorithm
6
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 50b87d6a43707962aa7a219c
This backtest was created using an older version of the backtester. Please re-run this backtest to see results using the latest backtester. Learn more about the recent changes.
There was a runtime error.
3 responses

Thanks Aidan. I think you've found something here, but I don't recognize the problem right away. We opened a bug, and we'll look at it and get back to you in a day or two.

We really appreciate the bug reports.

Dan

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.

I wanted to let you know that this is still in queue - we haven't gotten to it yet. I hope/expect it will be the top item shortly.

Aidan, we were going through old bugs and found this one. Sorry for the slow response, but we think this is fixed now!