Market Efficiency
A market is efficient when prices fully reflect the information available, so that no investor can earn a return above that of the risk taken by trading on that information. If a piece of news would predictably raise a price, buyers act on it at once and the price adjusts before the news can be used. Prices then only move on new, unforeseeable information, which is why price changes in an efficient market are close to unpredictable.
Fama (1970) distinguished three forms by the information that is reflected in the price. In the weak form it is the history of prices, so technical analysis of past prices does not earn an excess return. In the semi-strong form it is all public information, such as financial statements and announcements, so fundamental analysis of public data does not either. In the strong form it includes private information, so not even insiders can beat the market.
Efficiency can only be tested together with a model of the returns investors require, the joint hypothesis problem: a strategy that seems to beat the market may simply carry a risk the model leaves out. Tests of the weak form ask whether past returns predict future returns, tests of the semi-strong form how fast prices react to announcements, and tests of fund managers whether they earn an alpha after costs.
The Finance Toolkit tests the weak form with the variance ratio test, the runs test, the autocorrelation of the returns with the Ljung-Box test and the BDS test, which also picks up nonlinear dependence. The alpha of a ticker against the Capital Asset Pricing Model or a factor model measures whether it earned more than its risk explains.
Example · ^GSPC, BTCUSD, TLT · 2021 to 2025
Install the Finance Toolkit with pip install financetoolkit -U, then:
from financetoolkit import Toolkit
toolkit = Toolkit(
["^GSPC", "BTCUSD", "TLT"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.econometrics.get_runs_test(cutoff="zero")
Which returns:
| Item | ^GSPC | BTCUSD | TLT |
|---|---|---|---|
| Runs | 632 | 974 | 647 |
| Expected Runs | 624.325 | 913.487 | 626.324 |
| Z-Statistic | 0.4362 | 2.8338 | 1.17 |
| P-Value | 0.6627 | 0.0046 | 0.242 |
| Observations Above | 675 | 909 | 615 |
| Observations Below | 579 | 916 | 636 |
References
- Paper Fama, E.F. (1970). “Efficient Capital Markets: A Review of Theory and Empirical Work.” The Journal of Finance, 25(2), 383-417.
- Paper Fama, E.F. (1965). “Random Walks in Stock Market Prices.” Financial Analysts Journal, 21(5), 55-59.