class_docstr:  References:
  
     - https://www.quantopian.com/posts/hurst-exponent
     - https://www.quantopian.com/posts/some-code-from-ernie-chans-new-book-implemented-in-python
  
  Interpretation of the results
  
     1. Geometric random walk (H=0.5)
     2. Mean-reverting series (H<0.5)
     3. Trending Series (H>0.5)
  
   Important notes:
  
     - The default period is ``40``, but experimentation by users has shown
       that it would be advisable to have at least 2000 samples (i.e.: a
       period of at least 2000) to have stable values.
  
     - The `lag_start` and `lag_end` values will default to be ``2`` and
       ``self.p.period / 2`` unless the parameters are specified.
  
       Experimentation by users has also shown that values of around ``10``
       and ``500`` produce good results
  
   The original values (40, 2, self.p.period / 2) are kept for backwards
   compatibility
  
   
class_docstr_tok: ["References",":","-","https",":","\/\/www.quantopian.com\/posts\/hurst-exponent","-","https",":","\/\/www.quantopian.com\/posts\/some-code-from-ernie-chans-new-book-implemented-in-python","Interpretation","of","the","results","1",".","Geometric","random","walk","(","H=0.5",")","2",".","Mean-reverting","series","(","H","<","0.5",")","3",".","Trending","Series","(","H",">","0.5",")","Important","notes",":","-","The","default","period","is","``","40","``",",","but","experimentation","by","users","has","shown","that","it","would","be","advisable","to","have","at","least","2000","samples","(","i.e",".",":","a","period","of","at","least","2000",")","to","have","stable","values",".","-","The","`","lag_start","`","and","`","lag_end","`","values","will","default","to","be","``","2","``","and","``","self.p.period","\/","2","``","unless","the","parameters","are","specified",".","Experimentation","by","users","has","also","shown","that","values","of","around","``","10","``","and","``","500","``","produce","good","results","The","original","values","(","40",",","2",",","self.p.period","\/","2",")","are","kept","for","backwards","compatibility"]
code: def next(self):
      # Fetch the data
      ts = asarray(self.data.get(size=self.p.period))
  
      # Calculate the array of the variances of the lagged differences
      tau = [
          sqrt(std(subtract(ts[lag:], ts[:-lag]))) for lag in self.lags
      ]
  
      # Use a linear fit to estimate the Hurst Exponent
      poly = polyfit(self.log10lags, log10(tau), 1)
  
      # Return the Hurst exponent from the polyfit output
      self.lines.hurst[0] = poly[0] * 2.0
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  from .None import PeriodN
label_desc: Use image node_id 3 for calling the HurstExponent obj's underlying member method code with example usage: obj.next() without return types