Fix regression introduced with 8f537a1c2c271eb5cfc592b373697732597d26d6
which voids the count of lost trades
Allow rollover to distinguish between no values temporarily (with None)
and no values permanently (with False)
Avoid math domain error for negative returns in logarithmic calculations
Fix local variable declaration for compound returns
Fix typo in date2num tz conversion which shows up in direct usage
The problem with this approach is around edge cases: if we buy on the ex-div date, the function will run and return dividend, even though it shouldn't. Likewise, if we sell on ex-div date the function won't run and the dividend won't be calculated.