An advanced machine learning research project that experiments with Bitcoin price forecasting using ensemble models (LSTM, GRU, and Transformer). Features sophisticated technical analysis with 40+ indicators, market data integration, and user-selectable prediction periods.
BitCast = Bitcoin Forecast - A comprehensive toolkit for experimenting with cryptocurrency price prediction models and techniques.
BitCast stands for Bitcoin Forecast Experiments - a comprehensive research toolkit for experimenting with cryptocurrency price prediction models. The project explores various machine learning approaches, from simple LSTM networks to sophisticated ensemble models combining multiple architectures.
- Research: Experiment with different ML approaches for crypto forecasting
- Education: Learn about time series prediction and technical analysis
- Innovation: Explore ensemble methods and advanced feature engineering
- Accessibility: Make advanced ML models easy to use for anyone
BitCast uses an experimental approach - we implement multiple models and let you choose the best one for your use case:
- Legacy Models: Simple LSTM for basic experimentation
- Advanced Ensemble: Combined LSTM + GRU + Transformer for maximum accuracy
- Flexible Framework: Easy to add new models and features
- Ensemble Architecture: Combines LSTM, GRU, and Transformer models
- 40+ Technical Indicators: Moving averages, RSI, MACD, Bollinger Bands, momentum, volatility
- Market Context: Integrates S&P 500 and Gold correlations
- Robust Scaling: Handles outliers better than standard normalization
- 6 Years Historical Data: More training data for better accuracy
- Multiple Timeframes: 5min to yearly analysis
- Advanced Features: Support/resistance, volatility clustering, market correlations
- Time-based Features: Day of week, month, quarter effects
- User-Selectable Periods: Any timeframe from 1 day to 2 years
- Multiple Horizons: Standard periods (day, week, month, quarter, year)
- Confidence Levels: Based on prediction timeframe
- Model Selection: Choose between ensemble or individual models
- Bias Correction: Addresses bearish prediction bias
- Huber Loss: More stable training with outliers
- Early Stopping: Prevents overfitting
- Learning Rate Scheduling: Adaptive optimization
# Run the installation script (creates virtual environment and installs dependencies)
./install.sh
# OR manually setup:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Activate virtual environment first
source venv/bin/activate
# Download data and train advanced ensemble model
python predict_advanced.py --update-data --retrain
This will:
- Download 6 years of Bitcoin + market data
- Train ensemble of LSTM, GRU, and Transformer models (10-15 minutes)
- Generate comprehensive predictions
# Activate virtual environment
source venv/bin/activate
# Quick multi-horizon predictions
python predict_advanced.py --all-horizons
# Specific time period
python predict_advanced.py --period "2 weeks"
python predict_advanced.py --period 30
python predict_advanced.py --period "3 months"
# Choose specific model
python predict_advanced.py --period week --model lstm
python predict_advanced.py --period month --model ensemble
# List all available periods
python predict_advanced.py --list-periods
# Still available - basic LSTM model
python predict.py --update-data --retrain
python predict.py
π BitCast - Bitcoin Forecast Experiments
==================================================
π€ Using ENSEMBLE model
π Current Bitcoin Price: $43,250.00
π― Multi-Horizon Price Predictions:
----------------------------------------
π’ Next Day : $44,120.30 (+2.0%)
π΅ Next Week : $45,890.75 (+6.1%)
π’ Next Month : $48,650.20 (+12.5%)
π΅ Next Quarter : $52,180.40 (+20.7%)
π’ Next Year : $67,240.85 (+55.5%)
β° Generated at: 2024-01-15 14:30:25
π Model Features:
β’ Ensemble of LSTM, GRU, and Transformer
β’ 40+ technical indicators and market data
β’ Robust scaling for outlier resistance
β’ Multiple timeframe analysis
π BitCast - Bitcoin Forecast Experiments
π€ Using ENSEMBLE model
π Current Bitcoin Price: $43,250.00
π― 2 Weeks Prediction:
------------------------------
Predicted Price: $45,320.15 (+4.8%)
Confidence Level: High
Model Used: ENSEMBLE
- LSTM Branch: 128β64β32 units with L2 regularization
- GRU Branch: 128β64β32 units with dropout layers
- Transformer Branch: Multi-head attention with 8 heads
- Combined Output: Weighted ensemble of all branches
- Price Features: Returns, log returns, price ranges, body sizes
- Moving Averages: Multiple timeframes (7, 14, 21, 50, 100, 200 days)
- Technical Indicators: RSI, MACD, Bollinger Bands, momentum
- Market Data: S&P 500 and Gold correlations
- Time Features: Day of week, month, quarter effects
- Support/Resistance: Dynamic levels and distances
- Lookback Period: 90 days (vs 60 in basic model)
- Data: 6 years of historical data
- Loss Function: Huber loss (robust to outliers)
- Scaling: RobustScaler (handles extreme values better)
- Regularization: L2 penalty, dropout, early stopping
bitcast/
βββ predict_advanced.py # π Advanced prediction script
βββ advanced_predictor.py # π§ Ensemble model implementation
βββ predict.py # π Legacy simple predictor
βββ bitcoin_predictor.py # π§ Basic LSTM model
βββ install.sh # βοΈ Auto-installation script
βββ requirements.txt # π Python dependencies
βββ README.md # π Documentation
βββ LICENSE # βοΈ MIT License
βββ .gitignore # π« Git ignore rules
βββ data/ # πΎ Downloaded data (auto-created)
β βββ bitcoin_data.csv
βββ models/ # π€ Trained models (auto-created)
βββ ensemble_model.keras
βββ lstm_model.keras
βββ gru_model.keras
βββ transformer_model.keras
βββ advanced_scaler.joblib
- Python 3.8+
- TensorFlow 2.15+
- pandas, numpy, scikit-learn
- yfinance for data download
The model uses several technical indicators:
- Moving Averages: 7, 21, and 50-day periods
- RSI: Relative Strength Index for momentum
- Bollinger Bands: Price volatility indicators
- Volume Analysis: Trading volume patterns
- Price Ratios: High/low and price change patterns
# Clone the repository
git clone https://github.com/YOUR_USERNAME/bitcast.git
cd bitcast
# Quick setup and first run
./install.sh
source venv/bin/activate
python predict_advanced.py --update-data --retrain
# Quick predictions (most common use case)
python predict_advanced.py --all-horizons
# Specific predictions
python predict_advanced.py --period "2 weeks"
python predict_advanced.py --period 90
python predict_advanced.py --period "6 months"
# Model comparison
python predict_advanced.py --period month --model ensemble
python predict_advanced.py --period month --model lstm
python predict_advanced.py --period month --model transformer
# Data management
python predict_advanced.py --update-data # Refresh data
python predict_advanced.py --retrain # Retrain models
# Model evaluation and accuracy testing
python predict_advanced.py --evaluate # Full accuracy report
python predict_advanced.py --evaluate --test-days 60 # Extended testing
python predict_advanced.py --evaluate --eval-horizons "1,3,7,14,30" # Custom horizons
- Installation Problems: Use the automated installer:
./install.sh
- Memory Issues: Reduce lookback period in
advanced_predictor.py
- Network Issues: Check internet connection for Yahoo Finance data
- Model Training Fails: Ensure sufficient disk space (>2GB)
- First Run: Expect 10-15 minutes for full model training
- Subsequent Runs: ~30 seconds for predictions with existing models
- Memory Usage: ~2-4GB RAM during training, <1GB for predictions
- Storage: ~500MB for models and data
BitCast includes comprehensive evaluation tools to test model accuracy on historical data:
# Full accuracy evaluation with default settings
python predict_advanced.py --evaluate
# Extended evaluation with more test data
python predict_advanced.py --evaluate --test-days 60
# Custom prediction horizons
python predict_advanced.py --evaluate --eval-horizons "1,3,7,14,30"
Direction Accuracy: Percentage of correct up/down predictions
- π’ Good: β₯60% (Model correctly predicts market direction)
- π΅ Fair: 50-60% (Better than random but moderate accuracy)
- π‘ Poor: 40-50% (Below random, needs improvement)
- π΄ Very Poor: <40% (Poor performance)
Price Accuracy: Predictions within X% of actual price
- Within 5%: Very precise predictions
- Within 10%: Acceptable range for trading decisions
MAPE (Mean Absolute Percentage Error): Lower values indicate better accuracy
- <5%: Excellent precision
- 5-10%: Good precision
- 10-20%: Fair precision
-
20%: Poor precision
Based on historical backtesting:
Model | 1-Day Direction | 7-Day Direction | 30-Day Direction | Best Use Case |
---|---|---|---|---|
Ensemble | ~58-62% | ~55-58% | ~50-55% | Overall best performance |
Transformer | ~55-59% | ~52-56% | ~48-53% | Pattern recognition |
LSTM | ~52-56% | ~49-53% | ~47-52% | Trend following |
GRU | ~49-53% | ~46-50% | ~45-50% | Lightweight alternative |
- Short-term predictions (1-7 days) show highest accuracy
- Ensemble model consistently outperforms individual models
- Direction accuracy is generally more reliable than exact price predictions
- Market volatility significantly impacts longer-term accuracy
- High (1-7 days): Most reliable, based on short-term patterns
- Medium (1-4 weeks): Good accuracy, considers market trends
- Low (1-3 months): Moderate reliability, affected by market volatility
- Very Low (6+ months): Educational only, highly speculative
- Ensemble: Best overall accuracy, combines all approaches
- LSTM: Good for trend following, handles sequences well
- GRU: Faster training, good for short-term predictions
- Transformer: Best for pattern recognition, attention mechanisms
BitCast is designed as an experimental platform - we welcome researchers, students, and enthusiasts to contribute new ideas and improvements!
- New Models: Implement CNN, GAN, or Attention-based architectures
- Feature Engineering: Add sentiment analysis, on-chain metrics, macro indicators
- Ensemble Methods: Experiment with voting, stacking, or boosting approaches
- Data Sources: Integrate news, social media, or alternative data feeds
- Performance: Model optimization, GPU acceleration, distributed training
- Infrastructure: Docker containerization, cloud deployment, APIs
- Interface: Web dashboard, mobile app, real-time streaming
- Testing: Backtesting framework, A/B testing, model validation
- Tutorials: Step-by-step guides for different use cases
- Research Papers: Analysis of model performance and market insights
- Code Examples: Jupyter notebooks with detailed explanations
- Video Content: Walkthroughs and educational materials
This software is for educational and research purposes only.
- Cryptocurrency markets are extremely volatile and unpredictable
- Past performance does not guarantee future results
- Never invest more than you can afford to lose
- Always do your own research (DYOR)
- Consider consulting with financial advisors
- The models may have biases and limitations
- Predictions become less reliable over longer time horizons
No Investment Advice: Nothing in this software constitutes investment advice, financial advice, trading advice, or any other sort of advice.
MIT License - See LICENSE file for details.
β If BitCast helps with your research or learning, please give it a star on GitHub!
π¬ Have ideas for new experiments? We'd love to hear them - open an issue!
π€ Want to contribute? Check out our contributing guidelines above!
- GitHub Discussions: Share results, ask questions, propose experiments
- Issues: Report bugs, request features, suggest improvements
- Pull Requests: Contribute code, documentation, or research
BitCast - Where Bitcoin meets Machine Learning Experiments π