This is super nit-picky, but in like every coding example I've seen, the window length of n-thly (monthly, annual, etc.) returns is at least a day too short.
For example, the average number of days in a trading month is pretty dead-on close to 21 (I crunched the numbers and got 20.99). That also happens to be the window length of choice for nearly everyone's monthly returns factor.
However, the average number of days in a day is one, and yet daily returns have window_length=2, not one. Doesn't that suggest that the window length for monthly returns should equal 22, not 21?