class_docstr: Tracks the performance of the algorithm.
docstr: Handles the close of the given day, in both minute and daily emission.
  In daily emission, also updates performance, benchmark and risk metrics
  as it would in handle_minute_close if it were minute emission.
  
  Parameters
  __________
  dt : Timestamp
      The minute that is ending
  
  Returns
  _______
  A daily perf packet.
docstr_tok: ["Handles","the","close","of","the","given","day",",","in","both","minute","and","daily","emission",".","In","daily","emission",",","also","updates","performance",",","benchmark","and","risk","metrics","as","it","would","in","handle_minute_close","if","it","were","minute","emission",".","Parameters","__________","dt",":","Timestamp","The","minute","that","is","ending","Returns","_______","A","daily","perf","packet","."]
code: def handle_market_close(self, dt, data_portal):
      """
      Handles the close of the given day, in both minute and daily emission.
      In daily emission, also updates performance, benchmark and risk metrics
      as it would in handle_minute_close if it were minute emission.
  
      Parameters
      __________
      dt : Timestamp
          The minute that is ending
  
      Returns
      _______
      A daily perf packet.
      """
      completed_session = self._current_session
  
      if self.emission_rate == "daily":
          # this method is called for both minutely and daily emissions, but
          # this chunk of code here only applies for daily emissions. (since
          # it's done every minute, elsewhere, for minutely emission).
          self.position_tracker.sync_last_sale_prices(
              dt, False, data_portal
          )
          self.update_performance()
          account = self.get_account(False)
  
          benchmark_value = self.all_benchmark_returns[
              completed_session
          ]
  
          self.cumulative_risk_metrics.update(
              completed_session,
              self.todays_performance.returns,
              benchmark_value,
              account.leverage,
          )
  
      # increment the day counter before we move markers forward.
      self.session_count += 1.0
  
      # Get the next trading day and, if it is past the bounds of this
      # simulation, return the daily perf packet
      try:
          next_session = self.trading_calendar.next_session_label(
              completed_session
          )
      except NoFurtherDataError:
          next_session = None
  
      # Take a snapshot of our current performance to return to the
      # browser.
      daily_update = self.to_dict(emission_type="daily")
  
      # On the last day of the test, don't create tomorrow's performance
      # period.  We may not be able to find the next trading day if we're at
      # the end of our historical data
      if self.market_close >= self.last_close:
          return daily_update
  
      # If the next trading day is irrelevant, then return the daily packet
      if (next_session is None) or (next_session >= self.last_close):
          return daily_update
  
      # move the market day markers forward
      # TODO Is this redundant with next_trading_day above?
      self._current_session = next_session
      (
          self.market_open,
          self.market_close,
      ) = self.trading_calendar.open_and_close_for_session(
          self._current_session
      )
  
      # Roll over positions to current day.
      self.todays_performance.rollover()
      self.todays_performance.period_open = self.market_open
      self.todays_performance.period_close = self.market_close
  
      # Check for any dividends, then return the daily perf packet
      self.check_upcoming_dividends(
          next_session=next_session,
          adjustment_reader=data_portal._adjustment_reader,
      )
  
      return daily_update
  
imports: from __future__ import division
  import logbook
  import pandas
  from pandas.tseries.tools import normalize_date
  from catalyst.finance.performance.period import PerformancePeriod
  from catalyst.errors import NoFurtherDataError
  import catalyst.finance.risk
  from .position_tracker import PositionTracker
  from catalyst.constants import LOG_LEVEL
label_desc: Use image node_id 19 for calling the PerformanceTracker obj's underlying member method code with example usage: obj.handle_market_close(dt, data_portal) and returns: daily_update, daily_update, daily_update