Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Values used by the history function of data object

When using the command hist = data.history(context.aapl, 'volume', 10, '1m') and testing from
08/24/17 to 8/25/17 the values it returns seem odd to me. For example, at 9:33 on 8/24 it uses the values below:

2017-08-23 19:54:00+00:00 52136.0
2017-08-23 19:55:00+00:00 45886.0
2017-08-23 19:56:00+00:00 62649.0
2017-08-23 19:57:00+00:00 79221.0
2017-08-23 19:58:00+00:00 103543.0
2017-08-23 19:59:00+00:00 138552.0
2017-08-23 20:00:00+00:00 351770.0
2017-08-24 13:31:00+00:00 362637.0
2017-08-24 13:32:00+00:00 134127.0
2017-08-24 13:33:00+00:00 126430.0

What is the logic behind choosing the values for 8/23 at the given times, but more importantly why is it using
values for 8/24 that are in the future?

1 response

Hi Esfandiar,

When you log the results of data.history, the timestamps correspond to UTC time. In the example you shared, the line:

2017-08-24 13:33:00+00:00 126430.0

corresponds to the volume at 9:33am ET on 08/24. You also get values from 08/23 because your query calls for 10 bars of volume data, which wrap around to the previous day.

I hope this helps 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.