Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Access previous data (last day, last 5 days, etc.)

Hello,

How can I access the previous day or previous 5 days closes for any stock in my context.stocks?
Related to that, how can I access the previous day or previous 5 days indicators (eg. mavg) values?

Thanks,

JM

1 response

You can use a Batch Transform or keep your own list of past prices (updated as appropriate in every event).

https://www.quantopian.com/help#ide-batch-transforms

There is another thread on this topic but I can't find it.

Edit:
https://www.quantopian.com/posts/how-to-access-previous-day-open-or-close
https://www.quantopian.com/posts/get-the-past-price