Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. from hurst import compute_Hc, random_walk
  4. import seaborn as sns
  5. sns.set();
  6. %matplotlib inline
  7. np.random.seed(42)
  8. random_changes = 1. + np.random.randn(99999) / 1000.
  9. series = np.cumprod(random_changes)
  10. H, c, result = compute_Hc(series, kind='price', simplified=True)
  11.  
  12. plt.rcParams['figure.figsize'] = 10, 5
  13. f, ax = plt.subplots()
  14. _ = ax.plot(result[0], c*result[0]**H)
  15. _ = ax.scatter(result[0], result[1])
  16. _ = ax.set_xscale('log')
  17. _ = ax.set_yscale('log')
  18. _ = ax.set_xlabel('log(time interval)')
  19. _ = ax.set_ylabel('log(R/S ratio)')
  20.  
  21. print("H={:.3f}, c={:.3f}".format(H,c))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement