Skip to content

mertso13/fx-prophet

Repository files navigation

FX-Prophet: Time Series Forecasting with Prophet for USD/TRY Exchange Rate


What This Shows

  • Proper train/validation/test split, hyperparameter tuning with cross-validation, MAPE evaluation
  • From raw data acquisition to interpretable forecasts with confidence intervals
  • Clear documentation and analysis of model behavior

Quick Start

Via Jupyter

# Clone and install
git clone https://github.com/mertso13/fx-prophet
cd fx-prophet
pip install -r requirements.txt

# Run notebook
jupyter notebook usd_try_forecasting.ipynb

Via Docker

docker build -t fx-prophet .
docker run -p 8888:8888 fx-prophet
# Open URL with token from terminal output

Results Preview

Plot 1: Historical Data Shows Domain Understanding

Historical USD/TRY Data

The raw data we're working with shows significant volatility, especially post-2020, reflecting Turkey's economic conditions.


Plot 2: Train/Validation/Test Split Prevents Data Leakage

Train/Val/Test Split

I started the training data after 2020 because there weren't any significant jumps in the graph until then.

Things got “interesting” after that point, so to speak.


Plot 3: Final Forecast with Uncertainty Quantification

Final Forecast with Confidence Intervals

The width of the light blue areas, which is the width of the interval, shows how honest the model is with us. Since Turkey's economy is not stable and predictable, the model has to give a wide range, and as the period it tries to predict increases from the present, this range also increases.


Project Structure

src/
├── __init__.py            # Module initialization
├── fetch_util.py          # Data fetching from Yahoo Finance
├── model.py               # Prophet model training & hyperparameter tuning
└── plot_util.py           # Visualization & quarterly/yearly analysis

usd_try_forecasting.ipynb  # Main analysis: USD/TRY 2026 forecast

Key Results: USD/TRY 2026 Forecast

Period Expected Rate 95% Confidence Interval
Q1 2026 44.08 [43.59, 44.58]
Q2 2026 46.31 [44.14, 48.39]
Q3 2026 48.51 [42.34, 54.28]
Q4 2026 49.83 [38.63, 60.57]

Insight: The model captures the historical volatility of USD/TRY (Turkish economic inflation) and reflects this uncertainty in wider confidence intervals, showing it learned realistic patterns from data.


Methodology

  1. Data: Historical daily rates (2010-01-01 to 2026-02-03) from Yahoo Finance
  2. Split:
    • Train: 2020-2024 (1,044 days)
    • Validation: 2024-2025 (261 days)
    • Test: 2025-2026 (279 days)
  3. Tuning: Cross-validation on training set to find optimal changepoint_prior_scale
  4. Test Validation: Trained model on train+val, evaluated on held-out test set
  5. Final Model: Trained on extended dataset that includes test set with optimal changepoint_prior_scale
  6. Forecast: 365-day outlook with uncertainty quantification

Data Leakage Prevention

This project properly separates concerns:

  • Hyperparameters tuned on train set only using cross-validation (val/test sets untouched)
  • Validation set used to evaluate tuned model performance
  • Test set held completely out to measure generalization
  • Final model trained on extended dataset with learned hyperparameters for production forecasting

Requirements

  • Python 3.10+
  • See requirements.txt for full dependencies

Disclaimer: This model’s predictions are just for learning. It’s clueless about big world events, economic policies. Don’t take them as financial advice.

About

Time series forecasting for USD/TRY exchange rates using Prophet, featuring hyperparameter tuning and cross-validation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors