'Creates a dictionary representing the state of this performance
period. See header comments for a detailed description.
Kwargs:
dt (datetime): If present, only return transactions for the dt.'

def to_dict(self, dt=None):

    rval = self.__core_dict()
    if self.serialize_positions:
        positions = self.position_tracker.get_positions_list()
        rval['positions'] = positions
    if self.keep_transactions:
        if dt:
            try:
                transactions = [x.to_dict() for x in self.processed_transactions[dt]]
            except KeyError:
                transactions = []
        else:
            transactions = [y.to_dict() for x in itervalues(self.processed_transactions) for y in x]
        rval['transactions'] = transactions
    if self.keep_orders:
        if dt:
            try:
                orders = [x.to_dict() for x in itervalues(self.orders_by_modified[dt])]
            except KeyError:
                orders = []
        else:
            orders = [x.to_dict() for x in itervalues(self.orders_by_id)]
        rval['orders'] = orders
    return rval
