Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Referring to price data at specific times

I am seeking info on how to refer to specific price data, more accurately:

Close price on a specified date
Open price on a specified date

I want to use this for referring to future days in an if-condition such as
If 'xxxxx':
get latest price(price a T1)
resultvariable = latest price - price 10 days ahead(T10)

After reading through the help section the closest I have found is the 'history' command:

history(2, "1d", "price") returns yesterday's close price and the current price.

2 responses

I found this old thread, where they go with the history command, as I suggested myself - which seems somewhat an alternative solution to me
https://www.quantopian.com/posts/working-with-history-dataframes

If I am to use the history command it seems I would have to make by price comparisons the other way around - it. to take the example from my original post:
resultvariable = latest price - price 10 days ahead(T10)

I would then have to calculate this on the date (T10) and look 10 days back, instead of at the actual date where some x condition is met and looking 10 days ahead

There must be other people who have used such elements in their backtests