Giter Club home page Giter Club logo

hurst's People

Contributors

mottl avatar vido avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hurst's Issues

Series length condition

Why do you require series length to be above 100 and not 50? Is this an arbitrary or universal condition? thttps://github.com/Mottl/hurst/blob/5ca5005485a679e6ce11a2769c948915ae27b2da/hurst/init.py#L146

Finite differencing step at the beginning when kind='random_walk'?

When I look at the code for the compute_Hc function, there is an initial finite differencing step. Everything else after that agrees with Wikipedia's description of the Hurst exponent except it works with the derivative of the series, instead of the original series.

The random_walk function, which is supposed to use Fractional Brownian Motion, seems to be in agreement with their compute_Hc function. If you remove the differencing step, then there ends up being disagreement. But then is the random_walk function correctly implemented? Because if it is correctly implemented, then the Wikipedia article needs to be corrected.

kind in compute_Hc

I have a cycle data, how I choose the "random_walk","change" and "price"? My data looks like Sin function.

Hurst exponent less than 0 or greater than 1?

I noticed that the compute_Hc result for some time series is less than 0 or greater than 1. Is this behavior intended?

MWE to reproduce this bug:

import hurst
import numpy as np

print("numpy", np.__version__)
print("hurst", hurst.__version__)
print()

np.random.seed(988)
H, _, _ = hurst.compute_Hc(np.random.uniform(size=100), kind="random_walk", simplified=True)
print(H) # -0.017687382184009826

np.random.seed(916)
H, _, _ = hurst.compute_Hc(np.random.uniform(size=100), kind="random_walk", simplified=False)
print(H) # -0.011722357538317393

np.random.seed(164)
H, _, _ = hurst.compute_Hc(np.random.exponential(1, size=100), kind="change", simplified=True)
print(H) # 1.0118591069505447

Fix

Hello, Sir,
I would like to question you about this part in "hurst":
"
elif kind == 'change':
incs = series
_series = np.hstack([[0.],np.cumsum(incs)])
mean_inc = (series[-1] - series[0]) / len(incs)
deviations = incs - mean_inc
Z = np.cumsum(deviations)
R = max(Z) - min(Z)
S = np.std(incs, ddof=1)
"
shouldn't it be there like this
"mean_inc = (_series[-1] - _series[0])/len(incs)"?
Sorry in advance if I am wrong.

Random series should return 0.5?

Random series should return 0.5, but:

a=np.random.randint(100,size=(300))
H, c, data = compute_Hc(a)
print(sname,"H={:.4f}, c={:.4f}".format(H,c))

Hurst exponent

Hello! Just working with your code on a time series analysis, to compute the Hurst exponent of a equity, e.g. Google.

Here is the code:

import matplotlib.pyplot as plt
from hurst import compute_Hc
from datetime import datetime
import pandas_datareader as web

series = web.DataReader("GOOG", "yahoo", datetime(2000,1,1), datetime(2013,1,1))

H, c, data = compute_Hc(series['Adj Close'], kind='price', simplified=True)

Output: H 0.82083 C 0.5268

Following this resource for the Google stock a Hurst of 0.50788 was calculated -> https://www.quantstart.com/articles/basics-of-statistical-mean-reversion-testing

In your script c is the equivalent to the Hurst Exponent being calculated in above link? Or are the two methods not comparable?

Hurst Exponents Above 1.0?

Hi Dmitry,

I was working with the latest release of your Hurst Exponent implementation (https://pypi.org/project/hurst/) and am seeing a bit of strangeness. Specifically my crypto price series seems to be getting HE values > 1.0, which obviously is incorrect.

I did email you the notebook as I am unable to attach it here.

Thanks in advance for any help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.