Skip to content
Mirza Fathir
2026ML Engineer

Exchange-Rate Forecasting Pipeline

An end-to-end USD/IDR forecasting pipeline — XGBoost with quantile intervals and walk-forward validation, served via FastAPI and a Streamlit dashboard.

USD/IDR Forecast
01 — Problem

What I set out to solve

  • Exchange-rate forecasts are easy to make look good and hard to make honest. Prices are non-stationary, tree models can't extrapolate past the prices they've seen, and a random train/test split quietly leaks the future into training. I wanted a USD/IDR forecaster with an evaluation I could defend — and one people could actually use.
02 — Approach

How I built it

  • Engineered 27 daily features — price lags, rolling statistics, RSI, the BI–Fed rate spread, commodity prices, and calendar effects.
  • Predicted log-returns instead of raw prices so the tree model never has to extrapolate, then rebuilt prices recursively for multi-step forecasts.
  • Trained XGBoost with Q10/Q90 quantile models for a confidence band, plus an optional 2-layer BiLSTM, stacked by a Ridge meta-learner.
  • Validated with walk-forward splits — expanding-window and blocked with a purge gap — so no future data leaks into training.
  • Shipped it as a FastAPI service (single, batch, and 14-day forecast endpoints) and a Streamlit dashboard, containerised with Docker, deployed to Hugging Face Spaces, and smoke-tested in GitHub Actions.
03 — Outcome

What it achieved

  • XGBoost reached an MAE of 37.9 IDR (0.22% MAPE, R² 0.984) on held-out data.
  • Every forecast ships with a Q10–Q90 interval, so the dashboard shows uncertainty, not just a single line.
  • Sub-millisecond inference behind a documented REST API, with the full method written up as an IEEE-style paper.
Stack

Built with

  • Python
  • pandas
  • scikit-learn
  • XGBoost
  • TensorFlow
  • FastAPI
  • Streamlit
  • Docker
  • GitHub Actions
  • Hugging Face Spaces
Keep exploring

More projects