Upload README.md with huggingface_hub
Browse files1234567891011121314151617181920212223242526---tags:- ml-intern---# AcyLa/forex-predictive-model<!-- ml-intern-provenance -->## Generated by ML InternThis 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```pythonfrom transformers import AutoModelForCausalLM, AutoTokenizermodel_id = "AcyLa/forex-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.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132# π¦ Forex Predictive Model β ML Ensemble with Nadaraya-Watson + BollingerA production-grade machine learning pipeline for **intraday forex price prediction** using Nadaraya-Watson envelope estimation, multi-window Bollinger Bands, and 180+ technical indicators. Outputs **BUY / SELL / NEUTRAL** signals with pip-based price targets.## π Quick Start```bashpip install yfinance pandas numpy scikit-learn lightgbm ta torch pyarrow joblib scipygit clone https://huggingface.co/AcyLa/forex-predictive-modelcd forex-predictive-model# Get predictions immediately (pre-trained models included)python predict.py --ticker EURUSD=X# Fast mode (LightGBM only, sub-ms)python predict.py --ticker EURUSD=X --no-lstm# Single horizonpython predict.py --ticker EURUSD=X --horizon 8 --features```## π Architecture```Yahoo Finance FX Data β 180+ Features β Multi-Horizon Labels β LightGBM + LSTM Ensemble β BUY/SELL/NEUTRALβ β β730 days 1h bars Nadaraya-Watson Pip-based targetsBollinger (3 windows) Consensus votingRSI, MACD, ADX, IchimokuStochastic, ATR, DonchianSession timing (London/NY/Tokyo)```## π Key Components### Nadaraya-Watson Envelope (12 features)Non-parametric kernel regression that smooths price to identify trend + overbought/oversold zones. Vectorized implementation computes 17k bars in 0.3s.### Bollinger Bands System (45 features)- 3 windows (20, 50, 100) Γ 3 std devs (2.0, 2.5, 3.0)- Bandwidth, %B position, squeeze detection, band-walk signals### All Best Indicators (180+ total)| Category | Indicators ||----------|-----------|| **Trend** | EMA stack (9/21/50/100/200), SMA, MACD, ADX, Ichimoku Cloud, CCI || **Momentum** | RSI (7/14/21), Stochastic, Williams %R, ROC, Awesome Oscillator || **Volatility** | ATR (14/21/50), Bollinger, Keltner, Donchian, Historical Vol || **Volume** | OBV, MFI, VWAP, CMF, Volume ratios || **Price** | Multi-horizon returns, candlestick, support/resistance, drawdown || **Session** | Tokyo/London/NY sessions, overlaps, opens/closes, day-of-week || **NW** | Smooth, envelopes, slope, crossovers, trend regime, breakout signals |### Trading Session AwarenessThe model knows when London opens (08:00 UTC), NY opens (13:00 UTC), and the high-activity London-NY overlap (13:00-17:00 UTC). This is critical for FX β most price action happens during session overlaps.## π Prediction Output```ββββββββββββββββββββββββββββββββββββββββββββββββββββββEURUSD=X | Multi-Horizon FX PredictionsLatest Bar: 2026-09-11 22:00Current Price: 1.16023ββββββββββββββββββββββββββββββββββββββββββββββββββββββ1h: π‘ NEUTRAL | -0.0 pips | target=1.160234h: π‘ NEUTRAL | +0.2 pips | target=1.160258h: π‘ NEUTRAL | +0.8 pips | target=1.1603024h: π‘ NEUTRAL | +3.9 pips | target=1.16062ββββββββββββββββββββββββββββββββββββββββββββββββββββββCONSENSUS: π‘ NEUTRAL (confidence: 50%)ββββββββββββββββββββββββββββββββββββββββββββββββββββββ```## π§ Python API```pythonfrom predict import ForexPredictorpredictor = ForexPredictor(ticker="EURUSD=X")# Multi-horizon with consensusresult = predictor.get_multi_horizon()print(f"Consensus: {result['consensus']}")# Single horizonsignal = predictor.get_signal(horizon=8)# signal = {# 'pair': 'EURUSD=X', 'signal': 'BUY', 'confidence': 0.65,# 'predicted_pips': 12.3, 'current_price': 1.16023,# 'target_price': 1.16146, 'horizon_hours': 8# }# Fast HFT mode (LightGBM only)fast = predictor.get_signal(horizon=1, use_lstm=False)# Batch prediction on your own datapreds = predictor.predict_batch(your_ohlcv_df, horizon=4)```## π Training Other Pairs```bash# Train on GBP/USDpython train.py --ticker GBPUSD=X --no-backtest# Train on USD/JPY (pip size auto-detected as 0.01)python train.py --ticker USDJPY=X --no-backtest# Full walk-forward backtest (slower)python train.py --ticker EURUSD=X```Supported pairs: EURUSD, GBPUSD, USDJPY, USDCHF, AUDUSD, USDCAD, NZDUSD## π Files```forex-predictive-model/βββ config.py # All hyperparametersβββ data_loader.py # Yahoo Finance FX downloadβββ nadaraya_watson.py # NW envelope estimator (vectorized)βββ features.py # 180+ indicators (Bollinger, RSI, MACD, etc.)βββ labels.py # Pip-based labels + triple-barrierβββ models.py # LightGBM + LSTM ensembleβββ backtest.py # Walk-forward backtester (pip P&L)βββ train.py # Training pipeline CLIβββ predict.py # Prediction API + CLIβββ fx_models/EURUSD_X/ # Pre-trained models (4 horizons)```## β οΈ DisclaimerResearch tool, not financial advice. FX trading carries high risk. Always use stop-losses and proper position sizing.
README.md+122-16