Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
How to calculate the highest ration and lowest ratio between open price in the last week?

I scheduel a job on Monday open, record the open price
open
Then I schedule another job on Friday close, get the highest and lowest price in the last week:
highest = max(data.history(symbol, "high", 5,'1d'))
lowest = min(data.history(symbol, "low", 5,'1d'))

Finally I calculate the ratio highest/open, lowest/open

BUT data.history obviously did not consider stock split or merge, so the highest price change dramatically.

How can I calcualte correctly?? Thanks!

2 responses

@shuo

The Quantopian engine adjusts prices for splits and dividends.
Try this.

@Q
New backtester does not show custom data.

Thank you so much @Vladimir, your solution exactly solves my problem.