Fixed bugs in the sequence of dividend payment calculations.

Previously, we were using midnight of the current trading day in market
close. That meant that we were "rewinding" the clock, and then checking the
ex_date and pay_date. As a result, we were delaying payments by one day.

With this patch, on the close of markets we "fast forward" to midnight of the
next trading day and calculate the dividend payments. This patch assumes that
the dividend dates are all at midnight UTC.