Project 07 / 10 · Forecast & ML

Amazon Stock Forecasting

Multi-model forecasting dashboard on AWS EC2 — Seq2Seq LSTM cut MAPE from 17.45% to 8.86% with technical-indicator fusion and backtested signals.

01 / Context

The problem

Instead of treating stock prediction as a visually convincing curve-fit, this project tests whether deep learning or classical models can beat simple baselines under chronological, leakage-resistant evaluation.

02 / System workflow

From input to output

  1. 01yfinance OHLCV
  2. 0211 engineered signals
  3. 03Chronological split
  4. 04Four-model benchmark
  5. 05Risk dashboard

03 / Architecture

Inside the system

A1

Daily market data feeds technical indicators including RSI, MACD, Bollinger width, moving-average ratios, volume ratio, and rolling volatility.

A2

Linear Regression, one-step LSTM, Seq2Seq LSTM, and XGBoost are compared with rolling walk-forward validation across AMZN, MSFT, and GOOGL.

A3

MLflow tracks 18 runs while Streamlit combines forecasts with SHAP, risk statistics, anomaly detection, backtests, sentiment, and peer comparisons.

04 / Engineering decisions

What shaped the build

Decision 01

Leakage-resistant evaluation

Every split is chronological, scalers fit only on training data, and results are scored against naive or majority baselines.

Decision 02

Predict the actionable target

Returns and direction are evaluated separately from absolute price, which is easily flattered by carry-forward behavior.

Decision 03

Document failed experiments

Bidirectional LSTM, FinBERT features, autoregressive rollout, and larger cloud tuning runs are reported with their failure reasons.

05 / Evidence

Measured, not implied

56.7%

5-day direction

High-confidence XGBoost predictions with 69% coverage.

+3.7pp

Baseline edge

Five-day high-confidence result over majority class.

7,300+

Trading days

Historical OHLCV records used in the current benchmark.

06 / Delivery

What shipped

  • 01GitHub Actions refreshes the market CSV after trading hours, with a local fallback for API rate limits.
  • 02Streamlit caching keeps LSTM inference, SHAP, walk-forward validation, and risk calculations responsive.
  • 03The current application is deployed on Streamlit Cloud with resource-aware XGBoost settings.

Constraint documented

No model beats the naive previous-price baseline on MAPE. The useful result is the modest directional edge and the disciplined evidence showing where the models do and do not generalize.