Back to Community
Why aren't these prices the same?

Dear Q Community:

A beginner here, but picking things up fast. Please have a look at the attached code. I can't figure out why, with get_pricing, I am getting different reports for the opening price on a given day at the start of an interval depending on whether the open_price field is used, or the None field with the open_price attribute, and also depending on whether the start date and the end date are the same or different. I a hoping someone can explain it. I not that if I repeat the experiment for a few days ago, 2018-03-13 to 2018-03-15, the problem goes away. Is this a problem with definitions, time offsets, gaps in the data, or just a bug? Thanks for your help!

Tom Higgins

Loading notebook preview...
Notebook previews are currently unavailable.
3 responses

The 'get_pricing' method is point-in-time split and dividend-adjusted. For these adjustments, the reference date, or the ‘date which you are looking back from’, is always the end_date of the get_pricing call. So, yes, it does make a difference which end date is chosen.

You will see an adjustment IF there were any splits or dividends between the start and end dates. There was a dividend for SPY on 2010-9-17 which is why running between 2010-08-31 and 2010-10-01 one sees an 'adjusted' price on 2010-08-31. If there weren't any splits or dividends, then you won't see a difference. This is the case when running between 2010-08-31 to 2010-08-31 or between 2018-03-13 to 2018-03-15. There weren't any dividends so one doesn't see any adjustment.

See this post for an explanation https://www.quantopian.com/posts/research-updates-get-pricing-and-jupyter-notebook-upgrade.

Hope that helps

Dan,

This helps a lot. Thank you very much. I find that I really need to know what "discrepancies" like this really mean, or I lose confidence in my code.

I really appreciate the explanation.

Tom

Dear Q Community:

There were some errors in the first notebook I attached. When the start and end dates are different, one will see the price correction if a correction is needed to account for dividends and splits that occurred during the interval so defined. When the start and end dates are the same, no correction is seen. The method of retrieving the data, whether by "Field" or by "Attribute" makes no difference. Please see the attached corrected notebook.

Tom

Loading notebook preview...
Notebook previews are currently unavailable.