Key insight: Exact price prediction (R² ≈ 0) is extremely hard — the directional signal at ~57% beats random chance (50%) and is actionable for swing trades when combined with risk management.
Per-Ticker Breakdown
Ticker
Directional Acc
Classification Acc
RMSE
SPY
0.614
0.488
0.0226
QQQ
0.564
0.506
0.0331
AAPL
0.569
0.482
0.0306
MSFT
0.589
0.490
0.0334
TSLA
0.543
0.512
0.0804
NVDA
0.543
0.476
0.0497
AMD
0.585
0.494
0.0544
META
0.601
0.482
0.0414
JPM
0.569
0.507
0.0304
XOM
0.568
0.506
0.0307
Files in this Repository
summary.json # Complete training metrics & feature list
TICKER_reg_5d.json # XGBoost regression model (log-return target)
TICKER_clf_5d.json # XGBoost classification model (direction target)
TICKER_reg_5d.pkl # Pickled Booster (convenience)
TICKER_clf_5d.pkl # Pickled Booster (convenience)
stock_predictor.py # Training & feature engineering code
inference.py # Simple inference script
README.md # This file
Usage
Quick inference (single ticker)
python
1import xgboost as xgb
2import yfinance as yf
3import numpy as np
4import pandas as pd
56# 1. Load model from Hub7from huggingface_hub import hf_hub_download
8model_path = hf_hub_download(9 repo_id="mohan170802/stock-price-predictor-xgboost",10 filename="SPY_reg_5d.json"11)12model = xgb.Booster()13model.load_model(model_path)1415# 2. Fetch latest data & engineer features16# (see stock_predictor.py in source for full feature pipeline)17# ...1819# 3. Predict20X = xgb.DMatrix(latest_features, feature_names=feature_names)21predicted_log_return = model.predict(X)[0]22predicted_price = current_price * np.exp(predicted_log_return)