--- tags: - ml-intern --- # 🏦 Crypto Predictive Model — ML Ensemble for Crypto Price Prediction A production-grade machine learning pipeline for cryptocurrency price prediction using **15 years of Yahoo Finance historical data**, engineered for integration with high-frequency trading systems. ## 🚀 Quick Start ```bash pip install yfinance pandas numpy scikit-learn lightgbm ta torch pyarrow joblib git clone https://huggingface.co/AcyLa/crypto-predictive-model cd crypto-predictive-model python train.py --ticker BTC-USD python predict.py --ticker BTC-USD ``` ## 🏗 Architecture ``` Data (yfinance) → Features (207 indicators) → Labels (multi-horizon) → Ensemble (LightGBM+LSTM) → Prediction API ↑ Walk-Forward Backtester (purged CV) ``` ## 📊 Components | Component | Description | |-----------|-------------| | **Data** | Downloads up to 15 years of OHLCV from Yahoo Finance (BTC since 2014) | | **Features** | 207 causal technical indicators: trend, momentum, volatility, volume, price structure, regime, calendar | | **Labels** | Multi-horizon (1d, 3d, 7d, 14d, 30d) regression + classification + triple-barrier | | **Models** | Ensemble of LightGBM (gradient boosting) + LSTM with attention pooling | | **Backtest** | Walk-forward cross-validation with purging — no look-ahead bias | | **Prediction** | Real-time multi-horizon signals with consensus voting | ## 🔧 HFT Integration ```python from predict import CryptoPredictor predictor = CryptoPredictor(ticker="BTC-USD") result = predictor.get_multi_horizon(use_lstm=False) # sub-ms for HFT print(f"Consensus: {result['consensus']} ({result['consensus_confidence']:.0%})") ``` See `hft_integration.py` for a complete trading loop with stop-loss, take-profit, and position management. | Mode | Latency | Use Case | |------|---------|----------| | LightGBM only | < 1ms | HFT, tick-level | | LightGBM + LSTM (CPU) | ~6-50ms | Swing trading | ## 📁 Files ``` ├── config.py # All hyperparameters ├── data_loader.py # Yahoo Finance download ├── features.py # 207 technical indicators ├── labels.py # Multi-horizon labels + triple-barrier ├── models.py # LightGBM + LSTM ensemble ├── backtest.py # Walk-forward backtesting engine ├── train.py # Main training pipeline ├── predict.py # Live prediction API + CLI ├── hft_integration.py # HFT trading loop example └── models/BTC-USD/ # Trained models ``` ## ⚠️ Disclaimer Research tool, not financial advice. Always backtest with transaction costs and never risk more than you can afford to lose. ## Generated by ML Intern This model repository was generated by [ML Intern](https://github.com/huggingface/ml-intern), an agent for machine learning research and development on the Hugging Face Hub. - Try ML Intern: https://smolagents-ml-intern.hf.space - Source code: https://github.com/huggingface/ml-intern ## Usage ```python from transformers import AutoModelForCausalLM, AutoTokenizer model_id = "AcyLa/crypto-predictive-model" tokenizer = AutoTokenizer.from_pretrained(model_id) model = AutoModelForCausalLM.from_pretrained(model_id) ``` For non-causal architectures, replace `AutoModelForCausalLM` with the appropriate `AutoModel` class.