Shannon Entropy Market Analysis
Shannon Entropy Market Analysis is an exploratory framework for measuring the diversity of short term price movements. Using Shannon entropy, it classifies each price change as buy (up), hold (flat), or sell (down), then measures how evenly those actions are distributed across a rolling window.
Entropy ranges from 0.0 bits, when every move is the same, to 1.585 bits, when up, down, and flat moves occur with equal frequency.
The earlier pooled results (r = -0.193 live and r = -0.601 simulation) have been withdrawn. They mixed multiple symbols in one file, used a fixed polling rotation, and relied on an undocumented volatility definition. The project is now being re-run using per-symbol data, clearer volatility calculations, and statistical controls.
What This Tests
The project asks a simple question:
Does the Shannon entropy of price-move actions tend to move with realized short-term volatility?
This is not a trading strategy or a predictive model. It is an exploratory measurement framework intended to test whether entropy can provide a useful behavioral lens on market activity.
Because entropy and volatility are calculated from the same underlying returns, some correlation between them is expected mechanically. A permutation control is therefore used to estimate how much of the observed relationship could arise by chance.
Why It Matters
- A different view of market activity — Entropy summarizes the balance between upward, downward, and flat price movements, rather than relying only on price or volume.
- A potential regime lens — Different market conditions may produce different entropy and volatility profiles, although this remains to be established across symbols and time periods.
- A reproducible research pipeline — The project includes data collection, entropy calculation, volatility measurement, visualization, and statistical validation.
- A foundation for further work — Clean entropy and regime features could support future classification or modeling experiments, but no predictive claims are made at this stage.
What I Built
- Live data pipeline — Collects per-symbol intraday quotes, records both local polling time and provider quote time, and stores raw responses for auditing.
- Entropy engine — Calculates Shannon entropy over rolling windows of price-action counts.
- Volatility calculation — Measures realized volatility as the sample standard deviation of consecutive log returns within non-overlapping windows.
- Statistical controls — Includes block-bootstrap confidence intervals, permutation-null bands, and p-values to distinguish signal from mechanical correlation.
- Visualization — Produces per-asset plots showing entropy, volatility, their relationship, and regime-specific results.
- Synthetic validation — Confirms entropy calculations against known action distributions and edge cases.
How It Works
For each symbol, price changes relative to the previous snapshot are classified as:
0— hold / flat1— buy / up2— sell / down
Entropy is calculated as:
H = -Σ p_i log2(p_i)
where p_i is the proportion of each action type within the window.
The theoretical maximum is:
log2(3) = 1.585 bits
This maximum occurs only when buy, hold, and sell actions are equally represented.
Volatility is calculated as the sample standard deviation of consecutive log returns over non overlapping windows.
Synthetic Validation
| Window | Actions | Entropy (bits) | Note |
|---|---|---|---|
| 1 | [0, 0, 1, 2, 2, 0, 1] | 1.557 | Counts: 3 hold, 2 buy, 2 sell |
| 2 | [0, 0, 0, 0, 0, 0, 0] | 0.000 | All hold |
| 3 | [0, 1, 2, 0, 1, 2, 0] | 1.557 | Counts: 3 hold, 2 buy, 2 sell |
| 4 | [0, 1, 2, 0, 1, 2] | 1.585 | Uniform distribution; theoretical maximum |
These checks confirm that the entropy implementation behaves correctly for uniform, non-uniform, and degenerate action distributions.
Current Status
The previous pooled multi-symbol results are no longer considered valid and should not be quoted.
The current implementation uses:
- Per-symbol CSV files
- Randomized symbol polling with jitter
- Symbol-specific rate-limit handling
- Explicit local and provider timestamps
- Log-return-based volatility
- Block-bootstrap confidence intervals
- Permutation testing for mechanical correlation
- Low- and high-volatility regime analysis
The next phase is a 1–2 week live collection period during US market hours, covering both normal and higher-volatility conditions.
What Will Be Reported
For each asset, the analysis will report:
- Pearson correlation between entropy and realized volatility
- 95% block-bootstrap confidence interval
- Permutation-null band and p-value
- Correlation within low- and high-volatility regimes
- Entropy and volatility distributions
- Time-series visualizations
Results will only be reported after the revised pipeline has collected enough clean, per-symbol data.
Limitations
- Entropy and volatility are derived from the same return series, so some association is expected by construction.
- A weak or absent correlation would not necessarily mean entropy is uninformative; it may simply reflect the chosen window, symbol, or market period.
- Results from one symbol or one market episode cannot establish a general relationship.
- This framework does not yet demonstrate predictive ability, crash detection, or trading performance.
- Live quote data may contain stale or irregular updates, which is why timestamps and raw responses are retained.
Next Steps
- Collect per-symbol live data across multiple market conditions
- Re-run the full analysis using the revised volatility definition
- Compare entropy–volatility relationships across symbols
- Test sensitivity to window length and sampling frequency
- Evaluate whether entropy adds information beyond conventional volatility measures
- Explore regime classification only after establishing a reliable baseline
Links
- Repository: Shannon-Entropy