Hi guys -
We've tracked down why you're seeing this. As you say Peter - the desired behavior is to have consistent window length and that's how the behavior is explained in the help documentation.
What's happened here (which exposes a fragility in the batch_transform method) is that we had a non-standard trading day on August 22, 2013 (you may recall this: http://www.reuters.com/article/2013/08/29/us-nasdaq-halt-glitch-idUSBRE97S11420130829 ) where we accumulated only 216 minutes of the trading day for AAPL, and I believe all NASDAQ traded stocks.
Our 'padding' mechanism for filling in the batch_transform window turns out to be brittle in the sense that it will fill only when handle_data is called. In Grant's example passing in ONLY a stock on the NASDAQ, handle_data is not called when there is no trade data - and so no filling is done.
The short term fix for this is to pass the SPY in as a context stock as well. If you do this you will see the expected behavior for collecting data on AAPL in that case:
2013-09-10PRINT DatetimeIndex: 5850 entries, 2013-08-20 13:31:00+00:00 to 2013-09-10 20:00:00+00:00
Data columns (total 2 columns):
8554 5850 non-null values
24 5850 non-null values
In the longer term we will make sure to add this case to our spec for re-factoring access to trailing historical data. We definitely understand the use case for having a consistent window length to operate on.
Thanks for catching this issue and raising it!
-Jess
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.