Hello,
I'm trying to create a factor that allows me to take the average between one month price change and 12 month price change, with the 12 month price change excluding most recent month - i.e. lagged by one month. I've got one month price change using: pchg_1mo = Factors.Returns(window_length = 30). I was also getting 12 month price chang using: pchg_12mo = Factors.Returns(window_length = 252) to get the returns, but I'm getting stuck with regard to lagging them.
I tried using pchg_1mo = Factors.Returns(window_length = 30).shift(-30), but get an error that the returns object has no attribute of shift. Then I thought I could use prices(assets, start, end, frequency='daily', price_field='price', symbol_reference_date=None, start_offset=0) and just set the start_offset=-30, but then I realized I'm not sure I know how to set dynamic start and end dates for that. Is that possible? If so, how would I do that?
Has anyone a good method of lagging returns by 1 month with dynamic date? My pipeline is using base_universe of QTradableStocksUS, and so just trying to get the two returns columns mentioned above and take the average between them.
THANK YOU IN ADVANCE!
-> Nate