Is there any convenient method for accessing the returns() method within the research platform? I want to calculate pct chg from the prior day's closing values (which is my understanding of what returns() does within handle_data in backtests). At the moment the best way I can find is messy:
1) get daily bars, shift(1) the close price to get prior daily close
2) get minute bars
3) do a bunch of recasting of the datetime indices to create a date field on both dataframes that have the same type and can be used to merge
4) ffill the prices field of the intraday dataframe
5) merge both dfs, using the appropriate join type and maybe cartesian? to get the prior daily close to appear on every minute-ly bar
6) calculate the pct change intraday
7) figure out some way to adjust for dividends earned between the prior day and current day (which would wreak havoc on the pct_chg calculations)
Messy, and not totally correct. I'm hoping there's an easier and/or more accurate way to go about it?