If you have a copy of Ernie Chan's new book you might find a bit tricky that all of his code is written in Matlab. I like Matlab but it's proprietary and some of the tool boxes are actually quite expensive. Octave, is the (even slower) alternative but it does not have all the wonderful stats tools that Ernie uses in the code in his book.

In order to do the exercises I started to write out the Python versions of his code. So far I've done the Hurst exponent, the variance ratio test, the EWC-EWA example with ADF-test, a neat implementation of the Johansen test (although the backbones of the Johansen code are from another source), half life of mean reversion, the EWA-EWC example with Johansen, and the self-correlation calculation for his inter-day momentum strategies.

There might still be a bug here and there and the code is not always pretty but I felt that it was worth sharing. If you find some bugs or have any comments or requests please let me know.