AcyLa's picture
Update ML Intern artifact metadata
18d2991 verified
|
Raw History Blame Contribute Delete
3.45 kB
---
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.
<!-- ml-intern-provenance -->
## 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.