class_docstr: This analyzer calculates the AnnualReturns by looking at the beginning
  and end of the year
  
  Params:
  
    - (None)
  
  Member Attributes:
  
    - ``rets``: list of calculated annual returns
  
    - ``ret``: dictionary (key: year) of annual returns
  
  **get_analysis**:
  
    - Returns a dictionary of annual returns (key: year)
code: def stop(self):
      # Must have stats.broker
      cur_year = -1
  
      value_start = 0.0
      value_cur = 0.0
      value_end = 0.0
  
      self.rets = list()
      self.ret = OrderedDict()
  
      for i in range(len(self.data) - 1, -1, -1):
          dt = self.data.datetime.date(-i)
          value_cur = self.strategy.stats.broker.value[-i]
  
          if dt.year > cur_year:
              if cur_year >= 0:
                  annualret = (value_end / value_start) - 1.0
                  self.rets.append(annualret)
                  self.ret[cur_year] = annualret
  
                  # changing between real years, use last value as new start
                  value_start = value_end
              else:
                  # No value set whatsoever, use the currently loaded value
                  value_start = value_cur
  
              cur_year = dt.year
  
          # No matter what, the last value is always the last loaded value
          value_end = value_cur
  
      if cur_year not in self.ret:
          # finish calculating pending data
          annualret = (value_end / value_start) - 1.0
          self.rets.append(annualret)
          self.ret[cur_year] = annualret
  
file_path: backtrader/backtrader/analyzers/annualreturn.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  from collections import OrderedDict
  from backtrader.utils.py3 import range
  from backtrader import Analyzer
label_desc: Use image node_id 1 for calling the AnnualReturn obj's underlying member method code with example usage: obj.stop() without return types