{ "info": { "author": "Dmitry Mottl", "author_email": "dmitry.mottl@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Scientific/Engineering :: Mathematics" ], "description": "# hurst\n## Hurst exponent evaluation and R/S-analysis\n\n![Python 2.7](https://img.shields.io/badge/python-2.7-blue.svg)\n![Python 3x](https://img.shields.io/badge/python-3.x-blue.svg)\n[![Build Status](https://travis-ci.org/Mottl/hurst.svg?branch=master)](https://travis-ci.org/Mottl/hurst)\n[![pypi](https://img.shields.io/pypi/v/hurst.svg)](https://pypi.org/project/hurst/)\n[![Downloads](https://pepy.tech/badge/hurst)](https://pepy.tech/project/hurst)\n\n**hurst** is a small Python module for analysing __random walks__ and evaluating the __Hurst exponent (H)__.\n\nH = 0.5 \u2014 Brownian motion, \n0.5 < H < 1.0 \u2014 persistent behavior, \n0 < H < 0.5 \u2014 anti-persistent behavior. \n\n## Installation\nInstall **hurst** module with \n`pip install hurst` \nor \n`pip install -e git+https://github.com/Mottl/hurst#egg=hurst`\n\n## Usage\n```python\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom hurst import compute_Hc, random_walk\n\n# Use random_walk() function or generate a random walk series manually:\n# series = random_walk(99999, cumprod=True)\nnp.random.seed(42)\nrandom_changes = 1. + np.random.randn(99999) / 1000.\nseries = np.cumprod(random_changes) # create a random walk from random changes\n\n# Evaluate Hurst equation\nH, c, data = compute_Hc(series, kind='price', simplified=True)\n\n# Plot\nf, ax = plt.subplots()\nax.plot(data[0], c*data[0]**H, color=\"deepskyblue\")\nax.scatter(data[0], data[1], color=\"purple\")\nax.set_xscale('log')\nax.set_yscale('log')\nax.set_xlabel('Time interval')\nax.set_ylabel('R/S ratio')\nax.grid(True)\nplt.show()\n\nprint(\"H={:.4f}, c={:.4f}\".format(H,c))\n```\n\n![R/S analysis](https://github.com/Mottl/hurst/raw/master/examples/regression.png?raw=true \"R/S analysis\")\n\n```H=0.4964, c=1.4877```\n\n### Kinds of series\nThe `kind` parameter of the `compute_Hc` function can have the following values: \n`'change'`: a series is just random values (i.e. `np.random.randn(...)`) \n`'random_walk'`: a series is a cumulative sum of changes (i.e. `np.cumsum(np.random.randn(...))`) \n`'price'`: a series is a cumulative product of changes (i.e. `np.cumprod(1+epsilon*np.random.randn(...)`)\n\n## Brownian motion, persistent and antipersistent random walks\nYou can generate random walks with `random_walk()` function as following:\n\n### Brownian\n```brownian = random_walk(99999, proba=0.5)```\n\n\n![Brownian motion](https://github.com/Mottl/hurst/raw/master/examples/Brownian_motion.png?raw=true \"Brownian motion\")\n\n### Persistent\n```persistent = random_walk(99999, proba=0.7)```\n\n\n![Persistent random walk](https://github.com/Mottl/hurst/raw/master/examples/Persistent.png?raw=true \"Persistent random walk\")\n\n### Antipersistent\n```antipersistent = random_walk(99999, proba=0.3)```\n\n\n![Antipersistent random walk](https://github.com/Mottl/hurst/raw/master/examples/Antipersistent.png?raw=true \"Antipersistent random walk\")\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Mottl/hurst", "keywords": "hurst fractal econometrics time-series", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "hurst", "package_url": "https://pypi.org/project/hurst/", "platform": "", "project_url": "https://pypi.org/project/hurst/", "project_urls": { "Homepage": "https://github.com/Mottl/hurst" }, "release_url": "https://pypi.org/project/hurst/0.0.5/", "requires_dist": [ "pandas (>=0.18)", "numpy (>=1.10)" ], "requires_python": "", "summary": "Hurst exponent evaluation and R/S-analysis", "version": "0.0.5" }, "last_serial": 4791132, "releases": { "0.0.3": [ { "comment_text": "", "digests": { "md5": "b08817d322ca3a71d532de45fe173a46", "sha256": "6ad6cd31d477ebeaacf5ee463bf778aa86914a280915e2da231e32c04916a17a" }, "downloads": -1, "filename": "hurst-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "b08817d322ca3a71d532de45fe173a46", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4788, "upload_time": "2018-09-04T17:12:25", "url": "https://files.pythonhosted.org/packages/7e/2d/79acdbd91b39f1e0a20aa5c54f8e5edf3ca244a21a4dfb3fdd835d74b0e3/hurst-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b092cceb6f9be16c476e0cc0a78a424e", "sha256": "a895c0f12fdbe895976a0a2b0d950452cae15132be984e7a159387f4ad2266db" }, "downloads": -1, "filename": "hurst-0.0.3.tar.gz", "has_sig": false, "md5_digest": "b092cceb6f9be16c476e0cc0a78a424e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4400, "upload_time": "2018-09-04T17:12:26", "url": "https://files.pythonhosted.org/packages/3f/61/044d2b018e49e45d37891f388af06afea420d2d470202353e39550f6d3d4/hurst-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "9edc42da29ebff8d27b0f60217bd65a9", "sha256": "b14dd3b25e1d14ec8cece2bce38a0636ef9ed19fd8062b90c52e6f0adbe3ce26" }, "downloads": -1, "filename": "hurst-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "9edc42da29ebff8d27b0f60217bd65a9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4904, "upload_time": "2018-09-30T12:40:39", "url": "https://files.pythonhosted.org/packages/3b/b3/fe2e6e5ac320f997152c60b5cafe0c9ec5711e7a4d9e2e2bda0d53778bd3/hurst-0.0.4-py3-none-any.whl" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "42b4c739a49ead3a6ea9eb450a7161e2", "sha256": "d163f11fe2318aa8979c921d6667b8dfd6205c629924fefbed68505357cf995e" }, "downloads": -1, "filename": "hurst-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "42b4c739a49ead3a6ea9eb450a7161e2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5856, "upload_time": "2019-02-07T14:07:07", "url": "https://files.pythonhosted.org/packages/02/4f/d3471ce0dca03a21d4c6640da07a6040c9cc800a937233086b6cea6a7dc2/hurst-0.0.5-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "42b4c739a49ead3a6ea9eb450a7161e2", "sha256": "d163f11fe2318aa8979c921d6667b8dfd6205c629924fefbed68505357cf995e" }, "downloads": -1, "filename": "hurst-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "42b4c739a49ead3a6ea9eb450a7161e2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5856, "upload_time": "2019-02-07T14:07:07", "url": "https://files.pythonhosted.org/packages/02/4f/d3471ce0dca03a21d4c6640da07a6040c9cc800a937233086b6cea6a7dc2/hurst-0.0.5-py3-none-any.whl" } ] }