Skip to content

TimeGAN model for simulation of European short rates. MSc Thesis Quantitative Finance at Erasmus University Rotterdam

Notifications You must be signed in to change notification settings

Larsterbraak/TimeGAN-short-rates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TimeGAN for short rates

Welcome to my MSc Thesis for completion of the MSc Quantitative Finance at the Erasmus University Rotterdam. In this study, I simulate 1-day, 10-day, and 20-day short rate paths for EONIA using the TimeGAN model. Next to that, I evaluate the ECB's mapping of EONIA to €STER and check the applicability of TimeGAN for interest rate simulation of €STER, i.e. after the EONIA-€STER transition. See the Thesis or check out the rest below!

Table of contents

Results

Below is the visualization of the results presented in Table 4.

T-VaR(99%) estimate for regular TimeGAN (left) and TimeGAN with PLS+FM (right) during the validation dataset.

Normal TimeGAN T VaR TimeGAN with PLS+FM T VaR

Below is the visualization of the results presented in Table 4 and Table 5 for TimeGAN with PLS+FM.

1-day, 10-day, and 20-day VaR(99%) estimates for TimeGAN with PLS+FM during validation and test dataset.

1 day VaR TimeGAN with PLS+FM 10 day VaR TimeGAN with PLS+FM 20 day VaR TimeGAN with PLS+FM

Reproducing paper

Web application

Would like to see how the model works? This web application shows the influence of different hyperparameters and allows you to generate your own EONIA or €STER simulations. Note that it is still under construction

Getting started

To train the TimeGAN model on EONIA data, install the folder locally using npm and run tgan.py:

$ cd ../TimeGAN-short-rates
$ npm install tgan.py
$ python tgan.py
>> [step: 1, g_loss_u_e: 0.018, g_loss_s: 0.023, g_loss_s_embedder: 0.021, e_loss_t0: 0.312, d_loss: 0.014]
>> [step: 2, g_loss_u_e: 0.019, g_loss_s: 0.022, g_loss_s_embedder: 0.031, e_loss_t0: 0.314, d_loss: 0.029]
...

To simulate 20-day short rate paths of EONIA or €STER, run the following code in python

# Generic packages
import pandas as pd
from sklearn import preprocessing
import tensorflow

# TimeGAN specific functions
from metrics import load_models
from training import RandomGenerator

# Import data and apply min-max transformation
df = pd.read_csv("data/Master_EONIA.csv", sep=";")
df = df.iloc[:, 1:] # Remove the Date variable from the dataset
df.EONIA[1:] = np.diff(df.EONIA) # Make first difference for EONIA
df = df.iloc[1:, :] # Remove the first value
scaler = preprocessing.MinMaxScaler().fit(df) # Perform min-max transformation

# Load the models, simulate scaled short rates and unscale
load_epochs = 8250, hparams = [], hidden_dim = 4, T = 20, nr_simulations = N
_, recovery_model, _, generator_model, _ = load_models(load_epochs, hparams, hidden_dim)
Z_mb = RandomGenerator(N, [T, hidden_dim])
samples = recovery_model(generator_model(Z_mb)).numpy()
reshaped_data = samples.reshape((samples.shape[0]*samples.shape[1], 
                                 samples.shape[2]))
scaled_reshaped_data = scaler.inverse_transform(reshaped_data)
simulations = scaled_reshaped_data.reshape(((samples.shape[0],
                                             samples.shape[1], 
                                             samples.shape[2])))    

Technologies

Project is created with:

  • Tensorflow version: 2.2
  • Python version: 3.6.0
  • Tensorboard version: 2.2
  • Plotly Dash 1.16

Inspiration

This MSc Thesis is inspired on TimeGAN by @jsyoon0823

About

TimeGAN model for simulation of European short rates. MSc Thesis Quantitative Finance at Erasmus University Rotterdam

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published