docstr: The purpose of this method is to provide a portfolio
  object to algorithms running inside the same trading
  client. The data needed is captured raw in a
  PerformancePeriod, and in this method we rename some
  fields for usability and remove extraneous fields.
docstr_tok: ["The","purpose","of","this","method","is","to","provide","a","portfolio","object","to","algorithms","running","inside","the","same","trading","client",".","The","data","needed","is","captured","raw","in","a","PerformancePeriod",",","and","in","this","method","we","rename","some","fields","for","usability","and","remove","extraneous","fields","."]
code: def as_portfolio(self):
      """
      The purpose of this method is to provide a portfolio
      object to algorithms running inside the same trading
      client. The data needed is captured raw in a
      PerformancePeriod, and in this method we rename some
      fields for usability and remove extraneous fields.
      """
      # Recycles containing objects' Portfolio object
      # which is used for returning values.
      # as_portfolio is called in an inner loop,
      # so repeated object creation becomes too expensive
      portfolio = self._portfolio_store
      # maintaining the old name for the portfolio field for
      # backward compatibility
      portfolio.capital_used = self.cash_flow
      portfolio.starting_cash = self.starting_cash
      portfolio.portfolio_value = self.ending_cash + self.ending_value
      portfolio.pnl = self.pnl
      portfolio.returns = self.returns
      portfolio.cash = self.ending_cash
      portfolio.start_date = self.period_open
      portfolio.positions = self.position_tracker.get_positions()
      portfolio.positions_value = self.ending_value
      portfolio.positions_exposure = self.ending_exposure
      return portfolio
  
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 23 for calling the PerformancePeriod obj's underlying member method code with example usage: obj.as_portfolio() and returns: portfolio