Skip to content

hyuntaepark-gh/Bitcoin-Price-Regression-Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ˆ Bitcoin Price Regression Analysis (Time-Series ML)

Python Pandas NumPy Scikit-Learn Time Series Financial ML Feature Engineering Walk Forward Validation Explainable Modeling Quant Analytics

A regression-based time-series project to predict Bitcoin short-term returns using historical market signals and engineered features.
The project focuses on time-series-safe validation, interpretable modeling, and realistic evaluation.


🎯 Project Goal

This project explores the question:

Can Bitcoin’s next-day movement be predicted using regression models and time-series features?

Instead of chasing unrealistic β€œperfect price prediction”, the project emphasizes:

  • Time-series safe validation (preventing data leakage)
  • Feature engineering from market signals
  • Model comparison with baselines
  • Explainable modeling and interpretable results

🧩 Problem Definition

Target Variable

The model predicts next-day log return.

log_return(t+1) = log( Price(t+1) / Price(t) )

Why returns instead of price?

  • Bitcoin prices are non-stationary
  • Returns provide more stable statistical properties
  • Better suited for regression modeling

πŸ“‚ Dataset

This project uses Bitcoin historical market data.

Data Sources

  • Bitcoin price and trading volume
  • Optional macro indicators such as:
    • S&P 500 return
    • VIX volatility index
    • USD index (DXY)
    • Interest rate indicators

Raw datasets are not included in this repository.
Results can be reproduced by downloading the same data sources and running the notebook.


πŸ”§ Feature Engineering

Features are designed to capture momentum, trend, and volatility.

Price-based Features

  • Lagged log returns
  • Moving averages (MA7, MA30)
  • Rolling volatility (7-day and 30-day standard deviation)
  • Momentum indicators

Volume-based Features

  • Volume change rate
  • Rolling volume Z-score

Optional Market Signals

  • S&P 500 return
  • VIX change
  • USD index movement
  • Interest rate proxy

These signals help capture market dynamics influencing short-term Bitcoin movement.


🧠 Modeling Workflow

The modeling pipeline follows a quantitative ML workflow:

Raw Data
β†’ Feature Engineering
β†’ Time-Series Train/Test Split
β†’ Model Training
β†’ Prediction
β†’ Evaluation

Key steps include:

  • log-return calculation
  • rolling statistical features
  • chronological data splitting
  • regression model comparison
  • performance evaluation

πŸ€– Models Used

Baselines

  • Naive baseline (Tomorrow = Today)
  • Linear Regression

Regularized Regression

  • Ridge Regression
  • Lasso Regression

These models evaluate:

  • linear relationships
  • regularization effects
  • robustness against overfitting

βœ… Evaluation Strategy

Random train/test splits cause data leakage in time-series problems.

Therefore the project uses:

Time-Series Validation

  • chronological train/test split
  • no future information in training data

Evaluation Metrics

Regression metrics:

  • MAE (Mean Absolute Error)
  • RMSE (Root Mean Squared Error)
  • MAPE (optional)

Directional metric:

  • Directional Accuracy (correct prediction of up/down movement)

πŸ“Š Key Results

(Replace this section with final results)

Model MAE RMSE Direction Accuracy
Naive Baseline - - -
Linear Regression - - -
Ridge Regression - - -
Lasso Regression - - -

Key takeaway:

The objective is not perfect prediction but:

  • outperforming naive baselines
  • identifying useful predictive signals
  • maintaining realistic evaluation

πŸ“‰ Example Prediction Visualization

Example evaluation visualization:

Actual Return vs Predicted Return

This chart helps illustrate how closely the model captures short-term market movements.

You can generate prediction charts from the notebook and place them in:

reports/figures/

Then reference them in this README.


πŸ”Ž Feature Importance (Interpretability)

Linear and regularized regression models allow us to interpret the influence of features.

Important predictive signals may include:

  • Lagged returns
  • Rolling volatility
  • Volume changes
  • Market momentum indicators

These signals help explain what drives short-term Bitcoin movement.


▢️ How to Run the Project

1. Install dependencies

pip install -r requirements.txt

2. Launch Jupyter Notebook

jupyter notebook

3. Run the notebook

Open:

notebook/Bitcoin Price Regression Analysis.ipynb

and execute all cells to reproduce the analysis.


πŸ“Œ Business / Financial Interpretation

Although simplified, similar techniques are used in:

  • quantitative trading research
  • crypto market analysis
  • risk monitoring systems
  • volatility forecasting

Even simple regression models can reveal meaningful predictive signals in financial time-series data.


⚠️ Limitations

Bitcoin markets are challenging due to:

  • high volatility
  • regime shifts
  • macro shocks
  • non-linear market behavior

Prediction accuracy may degrade over time.

This project is intended for learning and portfolio demonstration, not financial advice.


πŸ—‚οΈ Repository Structure

Bitcoin-Price-Regression-Analysis/

notebook/
Bitcoin Price Regression Analysis.ipynb

src/ (future modularization)
data.py
features.py
train.py
evaluate.py

reports/
figures/

requirements.txt
README.md


πŸ›  Tools & Libraries

  • Python
  • Pandas
  • NumPy
  • Scikit-Learn
  • Jupyter Notebook

πŸ“š What This Project Demonstrates

This repository demonstrates skills in:

  • time-series regression modeling
  • financial feature engineering
  • machine learning experimentation
  • model evaluation
  • interpretable modeling
  • reproducible analytical workflows

πŸš€ Future Improvements

Possible extensions include:

  • walk-forward validation
  • XGBoost / Gradient Boosting models
  • LSTM deep learning models
  • crypto-specific indicators
  • trading strategy backtesting

About

Regression-based analysis of Bitcoin price movements using U.S. market indicators and Python.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors