docstr: 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.
docstr_tok: ["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","."]
code: def to_dict(self, dt=None):
      """
      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.
      """
      rval = self.__core_dict()
  
      if self.serialize_positions:
          positions = self.position_tracker.get_positions_list()
          rval["positions"] = positions
  
      # we want the key to be absent, not just empty
      if self.keep_transactions:
          if dt:
              # Only include transactions for given 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:
              # only include orders modified as of the given 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
  
imports: from __future__ import division
  import logbook
  import numpy
  from collections import namedtuple
  from catalyst.assets import Future
  from six import itervalues, iteritems
  import catalyst.protocol
  from catalyst.constants import LOG_LEVEL
label_desc: Use image node_id 22 for calling the PerformancePeriod obj's underlying member method code with example usage: obj.to_dict(dt) and returns: rval