Some have linked market efficiency with entropy , e.
when a price series has high entropy, it has low redundancy and high information content, and hence there are no arbitrage opportunities.
During periods of low entropy or inefficiency, bubbles can form.
If we can measure the information entropy of a price series, we can create strategies that work better during periods of high or low entropy.
Before we can measure entropy, we have to encode our return series.
We use return series instead of price series because of the need for stationarity — the author of AFML heavily emphasizes a fractionally differentiated price series to preserve the memory — something I will try soon.
After encoding the return series, a simple way to do it would be to count the number of unique bits needed to represent the price series, essentially creating a dictionary.
Entropy is also a measure of compression, and if many bits are needed to explain a price series, the higher the entropy of a price series.
To actually encode and calculate entropy turned out to be quite hard without the flexibility of Python, so I implemented it on the platform indirectly (and probably wrongly) using kurtosis.
Kurtosis is a measure of how ‘fat’ the tails of the distribution is.
The fatter the tail, the more outliers there are, the higher the kurtosis.
If we were to encode the price series of a stock, one with higher kurtosis would likely need more bits to encode since there is a bigger range of returns to encode.
Note that the kurtosis formula below measures excess kurtosis, so if you are calculating kurtosis from scratch, you will need to minus off 3, which is the kurtosis of a normal distribution.
with 2 lines of code, I can implement a kurtosis check over any time period!Now that you’ve learned two ways of extracting features from price series, you can come up with creative strategies that work well in structural breaks or in periods of high/low entropy.
Have you read AFML too and have thoughts on how my execution can be better or want to see how other chapters can be executed from the book?.Let me know in the comments below.
References Chia-Shang James Chu (1996), Stinchcombe, Halbert White.
Monitoring Structural Change.
 Clausius R (1870) XVI.
On a mechanical theorem applicable to heat.
The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science 40: 122–127.
 Shannon CE (1948) A Mathematical Theory of Communication.
Bell System Technical Journal 27: 379– 423.
 Gulko, L.
The entropic market hypothesis.
International Journal of Theoretical Applied Finance, 2, 293–329.