- Changes taken from https://github.com/QuantConnect/Lean/pull/6227 - Rebased + a few more tweaks and added tests