This project tests the Random Walk Hypothesis on Bitcoin (BTC-USD) using rigorous statistical methods across 13 years of daily price data.
We investigate whether price movements are:
- Random
- Independent
- Unpredictable
Verdict: RWH REJECTED — Bitcoin is NOT weak-form efficient.
The Random Walk Hypothesis states that:
Future price movements cannot be predicted using past price data.
It is closely related to the Efficient Market Hypothesis (Weak Form).
Mathematical formulation:
P_t = P_(t-1) + ε_t where ε_t ~ IID(0, σ²)
r_t = ln(P_t / P_(t-1)) ← log return
- ✅ Data Collection —
btc-usd-max.csv(CoinGecko, 2013–2026) - ✅ Data Preprocessing — datetime parsing, sorting, NaN removal
- ✅ Log Return Calculation — 4,735 observations
- ✅ Exploratory Data Analysis — 5-panel chart generated
- ✅ Statistical Testing:
- ✅ Augmented Dickey-Fuller (ADF)
- ✅ Autocorrelation / Ljung-Box Q
- ✅ Wald-Wolfowitz Runs Test
- ✅ Variance Ratio (Lo-MacKinlay 1988)
- ✅ Extensions:
- ✅ GARCH(1,1) volatility modelling
- ✅ Rolling window ADF + Runs analysis
Random Walk Hypothesis/
│── btc-usd-max.csv ← Raw data (CoinGecko)
│── rw_btc_test.py ← Main statistical test pipeline
│── rw_extensions.py ← GARCH + rolling window analysis
│── btc_eda_plots.png ← EDA visualisations
│── btc_variance_ratio.png ← VR(k) profile chart
│── btc_garch_plots.png ← GARCH volatility + rolling analysis
│── Research_Report.md ← Full academic report
│── implementations.md ← Code documentation
│── results.md ← Test results and tables
│── analysis.md ← Final verdict and insights
│── skills.md ← Skills developed
│── README.md ← This file
# Step 1 — Run core statistical tests
python rw_btc_test.py
# Step 2 — Run GARCH + rolling window extensions
python rw_extensions.pyRequirements:
pip install pandas numpy matplotlib statsmodels arch yfinance| Test | Result | RWH Verdict |
|---|---|---|
| ADF (prices) | p = 0.7450 | ✔ Supports |
| ADF (returns) | p = 0.0000 | ✔ Supports |
| Ljung-Box ACF | Sig. lags 6–30 | ✘ Rejects |
| Runs Test | Z=3.04, p=0.0024 | ✘ Rejects |
| Variance Ratio | VR=1.32 at k=30 | ✘ Rejects |
| Final Score | 2/5 | ❌ REJECTED |
- Create project structure
- Load dataset (BTC-USD from btc-usd-max.csv)
- Inspect columns and data types
- Convert timestamps to datetime
- Sort data chronologically
- Handle missing values
- Extract closing price
- Compute log returns
- Drop NaN values
- Validate return distribution
- Plot price series
- Plot log returns
- Generate histogram
- Compute summary statistics
- Generate rolling volatility chart
- Autocorrelation / Ljung-Box Q Test
- Augmented Dickey-Fuller Test
- Wald-Wolfowitz Runs Test
- Variance Ratio Test (Lo-MacKinlay)
- Analyze each test result
- Compare outcomes across tests
- Evaluate randomness vs. momentum
- Accept or reject Random Walk Hypothesis → REJECTED
- Document findings in results.md + analysis.md
- Suggest improvements (GARCH, rolling analysis)
- GARCH(1,1) volatility modelling
- Rolling window ADF stationarity analysis
- Rolling Runs Test across time
✅ Determined that Bitcoin does not follow a random walk
✅ Identified market inefficiencies (momentum at 6–30 day horizons)
✅ Built statistical foundation for quantitative trading strategy research