class_docstr: Calculates basic statistics for given timeframe
  
  Params:
  
    - ``timeframe`` (default: ``Years``)
      If ``None`` the ``timeframe`` of the 1st data in the system will be
      used
  
      Pass ``TimeFrame.NoTimeFrame`` to consider the entire dataset with no
      time constraints
  
    - ``compression`` (default: ``1``)
  
      Only used for sub-day timeframes to for example work on an hourly
      timeframe by specifying "TimeFrame.Minutes" and 60 as compression
  
      If ``None`` then the compression of the 1st data of the system will be
      used
  
    - ``fund`` (default: ``None``)
  
      If ``None`` the actual mode of the broker (fundmode - True/False) will
      be autodetected to decide if the returns are based on the total net
      asset value or on the fund value. See ``set_fundmode`` in the broker
      documentation
  
      Set it to ``True`` or ``False`` for a specific behavior
  
  
  ``get_analysis`` returns a dictionary containing the keys:
  
    - ``average``
    - ``stddev``
    - ``positive``
    - ``negative``
    - ``nochange``
    - ``best``
    - ``worst``
  
  If the parameter ``zeroispos`` is set to ``True``, periods with no change
  will be counted as positive
code: def __init__(self):
      self._tr = TimeReturn(
          timeframe=self.p.timeframe,
          compression=self.p.compression,
          fund=self.p.fund,
      )
  
file_path: backtrader/backtrader/analyzers/periodstats.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import backtrader
  from backtrader.utils.py3 import itervalues
  from backtrader.mathsupport import average, standarddev
  from .None import TimeReturn
label_desc: Use image node_id 1 to create a new PeriodStats object from inherited base classes: bt with example: obj = PeriodStats()