Skip to content

wandafulworld/tail_gan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation


Simulate Tail-Risk Scenarios

A replication of key results from "Tail-GAN: Simulate Tail-Risk Scenarios"
Open in Colab

Table of Contents
  1. About The Project
  2. Getting Started
  3. License
  4. Acknowledgments

About The Project

Tail-GAN is a GAN architecture with the goal of training a generator to produce realistic stock return scenarios by implementing tail-sensitive loss functions. This is achieved by projecting the stock scenarios to 1D PnL distributions from predictable strategies which in turn are evaluated based on their risk metrics (VaR and ES). While common loss functions (KL-Divergence, Wasserstein Distance) tend to oversample the center of the distribution, the proposed loss function is tail-sensitive.

Data:

We reproduce the results for the synthetic data, which consists of $T = 100$ ticks per scenario with a realistic daily volatiliy. The paper uses a stochastic process of dimension 5 with each component having a different marginal probability distribution to simulate stock returns:

  1. IID normal distribution
  2. AR with $\psi_1 = 0.5$
  3. AR with $\psi_2 = -0.5$
  4. GARCH(1,1) with student-t ($\nu_1 = 5$) distribution
  5. GARCH(1,1) with student-t ($\nu_2 = 10$) distribution

all of them are correlated by an underlying Gaussian innovation vector $u_t \sim \mathcal{N}(0,\Sigma)$ whose covariance matrix is constructed from a randomly drawn correlation matrix $\rho_{ij}$ and some scaling factors related to annualized standard deviations (i.e. a realistic volatility measure) normalized to the time frame that the series is supposed to represent.

Key Architecture Elements

There are four important architectural features:

  1. A set of trading strategies which project the generated stock scenarios to PnL distributions. The discriminator takes these PnL distributions as input.
  2. The discriminator will output two values which will be interepreted as $\alpha$-VaR and $\alpha$-ES and handed as arguments to the score function.
  3. The "Neural Sorting": This refers to a soft-sort algorithm by Grover et al (2019) which can be backpropagated through. Because $\alpha$-VaR of a distribution can be approximated by the $\lfloor \alpha n \rfloor^{\text{th}}$ smallest value in a sample of size $n$, sorting the PnL samples will potentially improve performance.
  4. The score function evaluates how close the discriminator is to the correct $\alpha$-VaR and $\alpha$-ES of the sampled distribution.

What is a "Score function"?

Consider a functional $T(F)$ mapping from a distribution $F$ to $\mathbb{R}$, e.g. the mean or VaR of a distribution. This functional is said to be elicitable if there exists a strictly proper scoring rule $S(x,y)$ s.t.:

$$ T(F) = \arg \min_{x \in \mathcal{X}} \mathbb{E}_{Y \sim F}[S(x,Y)]$$

In other words, $T(F)$ is elicitable if predicting $x = T(F)$ gives you the best expected score under the true data distribution $F$

VaR is elicitable but ES is not. But as it turns out the two are jointly elictable, i.e. we can find a score function $S(e,v,x)$ which is minimized for the correct VaR ($v$) and ES ($e$).

Evaluating Generator Performance

VaR and ES lend themselves to an interpretable measure of tail-realism. During training we can simply evaluate the difference between generated and real tail risk measures. After training we can further:

  • Compare tail risk measures on out-of-sample data
  • Compare the correlation matrix of the generated data with that of the real data
  • Compare autocorrelation coefficients accross the time-series with the real data
  • Compare the rank-distributions of the generated and real data

These methods allow for a rigorous measure of model performance.

(back to top)

Built With

This project was built with PyTorch

(back to top)

Getting Started

Simply install the required packages in your virtual environment and download and run the notebook. Note that training of the models without a GPU can be quite slow.

License

Not fixed yet.

(back to top)

Acknowledgments

This project is a replication of the research by Cont et al. ("Tail-GAN: Learning to Simulate Tail Risk Scenarios"): arXiv

While I have added some numerical experiments and adapted hyperparameters as I saw fit, all of the key ideas in this project are theirs.

(back to top)

About

A Tail-GAN inspired project to simulate tail-risk scenarios

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors