'Check if we currently own any stocks with dividends whose ex_date is
the next trading day.  Track how much we should be payed on those
dividends\' pay dates.
Then check if we are owed cash/stock for any dividends whose pay date
is the next trading day.  Apply all such benefits, then recalculate
performance.'

def check_upcoming_dividends(self, next_session, adjustment_reader):

    if (adjustment_reader is None):
        return
    position_tracker = self.position_tracker
    held_sids = set(position_tracker.positions)
    if held_sids:
        cash_dividends = adjustment_reader.get_dividends_with_ex_date(held_sids, next_session, self.asset_finder)
        stock_dividends = adjustment_reader.get_stock_dividends_with_ex_date(held_sids, next_session, self.asset_finder)
        position_tracker.earn_dividends(cash_dividends, stock_dividends)
    net_cash_payment = position_tracker.pay_dividends(next_session)
    if (not net_cash_payment):
        return
    self.cumulative_performance.handle_dividends_paid(net_cash_payment)
    self.todays_performance.handle_dividends_paid(net_cash_payment)
