Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
pipeline using monthly window length period

I am trying to build a pipeline where the lookback window-length period is measured in whole months... for example the 6-monthly return. At the moment, I use 126 days as a proxy (21 days roughly equals 1 trading month), but its not accurate enough.
Can anyone suggest how I can use a window length in months?
Thanks, and best regards,

1 response

Don't waste your time!
Its easy enough to code... you can put the date calculation into your pipeline, or into the class your pipeline calls if you have one. Print statements in both reveal correct calculations and setting of window_length.
However, if the window_length parameter is played with after pipeline initialization, the outputs you get become unstable, and the results you get back from pipeline calculations are incorrect.
For anyone who comes across this post in the future and wants to do the same thing, probably the next step is to abandon pipeline and just use the history function.