All posts by Jérémie Smaga

Why you should not use JustCloud for your backups!















The early days of Quantitative Finance

A lot of people start studying Quantitative Finance because they see it as a great way to earn money. It seems indeed reasonable that somebody with great mathematical skills would be looking for opportunities allowing him to make a profit — sometimes at the expense of others. I can still remember like yesterday seeing a friend — clearly one of the smartest persons I’ve met — losing money at a roulette table being certain that he had a winning strategy (!) as well as countless classmates claiming they could easily make a profit out of the stock market.

Nowadays, we have books about it, computers to help us and  well-known strategies which make it always more difficult to make long-term risk-adjusted profits because all available opportunities are quickly taken away by sophisticated investors.

But how did it work in the old days? Who were the first people to study the field? When did it start? How did they put it in place? Did they make a fortune? Are they still making a fortune? All these questions are fascinating to me, and I just finished reading up a book called Fortune’s Formula by William Poundstone which addresses these topics.

Obviously, this book does not contain any fortune formulas, but it depicts the stories of the men who contributed to the field in the early days. This book was fascinating because it talks about some very important “discoveries” such as the Kelly criterion, based on Information Theory, Modern Portfolio Theory, Market Efficiency and how these techniques were put to practice at the very beginning. It also talks about how the first formula to price warrants was discovered and the struggles through which Edward Thorp went before he could really make money out of it — and how it all ended. We also learn how some brilliant minds — Noble Prize winners — got caught and lost everything in the LTCM collapse.

The good thing about this book, is that it explains all this in relatively simple words. Indeed, Poundstone focuses on the concepts rather than on the technicalities and puts everything in historical context such that any interested reader can go through the pages without being lost in details.

If you’re planning to go on holidays at the end of the year and you’re looking for a good book to read, I strongly recommend this one.

Implied odds behind lay betting

In a precedent post,  I introduced the concept of back and lay bets on a given event, for example the fact that it will rain on a given day.  We also said that we are given some odds $o$, which express how much we can earn if we guess the right outcome between the event happening ($E$) or not ($\bar{E}$).


Usually, people betting are very familiar with the “common” back bet and the odds $o$, which generate a net cash flow of $x (o-1)$ when we guess right and $-x$ when we guess wrong on an invested amount of $x$. However, I always found lay bets less intuitive and I prefer to see them as betting on the event not to happen.  This post about seeing a lay bet on $E$ as a back bet on $\bar{E}$, for example backing that it will not rain on a given day. The difference is explained in the table below:

$E$ $\bar{E}$
Laying $E$ $-x(o-1)$ $x$
Backing $\bar{E}$ $-y$ $y(\bar{o}-1)$

We see a new term $\bar{0}$ appearing, which are the odds of backing the event not to happen. Because both lines actually imply betting on the same thing (the event not to happen), the cash flows in case of $E$ or $\bar{E}$ must be the same. Therefore, we get the following system of equations:

-x(o-1) &= -y\\
x &= y (\bar{o}-1)

The fist equation tell us that $y=x(o-1)$ and we can substitute in the second equation to solve for $\bar{o}$:
x &= y (\bar{o}-1)\\
x &= x(o-1) (\bar{o}-1)\\
\frac{x}{x(o-1)} &= \bar{o}-1\\
\bar{o} &= 1+\frac{1}{o-1}\\
\bar{o} &= \frac{o}{o-1}\\

Now, we can take bets on the event not to happen much more intuitively. Let’s go back to our example and let’s say that the odds of the bet on having rain today is $o = 5$. If we want to bet on the fact that it will not rain today, we need to place a lay bet, but what are our odds $\bar{o}$? Using the formula we derived above, we can easily compute them:

$$\bar{o} = \frac{o}{o-1} = \frac{5}{5-1} = 1.25 $$

Let’s say that we are happy with those odds, and we’d like to place a bet of $y=2$ at $\bar{o}=1.25$. Well, if we look at your system of equation, we see that $x = y (\bar{o}-1)$, so we need to bet:

$$x = y (\bar{o}-1) = 2 (1.25-1)=0.5$$

Let’s check:

$E$ $\bar{E}$
Laying $E$ $-x(o-1) = -0.5 (5-1) = -2$ $x = 0.5$

This is correct! An easy way of computing $x$ is to keep in mind that $x = y (\bar{o}-1)$ is simply the amount you expect to win by betting on the event not to happen.

Expected Shortfall closed-form for Normal distribution

Today, I would like to share a little exercise I did to compute the Expected Shortfall of a normal variable. For those of you who are not familiar with this risk measure, it evaluates the average of the $(1-\alpha)$-worst outcomes of a probability distribution (example and formal definition follow).

If you have enough data, the expected shortfall can be empirically estimated. Let’s say we want to compute the expected shortfall at 95% (denoted $ES_\text{95%}$) and that we have 1000 points. The first thing to do is to sort the 1000 points. Then, we take the $1-95\%=5\%$ worst outcomes, which is for 1000 points $1000 \cdot 5\% = 50$ points. Finally, we simply average these points to get our estimated expected shortfall. Nevertheless, this is only an estimate and it will be precise only if you have enough points available.

Sometimes, you can assume the distribution of the points and when these points are a set of returns, it is quite common to assume that they follow some normal distribution $\mathcal{N}(\mu,\sigma^2)$. In this case, you can find a closed form formula which gives you the exact solution for a given $\alpha$, given the parameters $\mu$ and $\sigma$. This result is available in several papers but usually comes without the proof, which I will provide below.

Let’s assume we have a random variable $X \sim \mathcal{N}(\mu,\sigma^2)$. The first thing to do is to re-express this variable in term of a standard normal variable $Z \sim \mathcal{N}(0,1)$. This is easily done as follows:

$$ X = \mu + \sigma Z $$

The next thing to do is to express the Value at Risk at a certain level $\alpha$, which is defined as follows:

$$\text{VaR}_\alpha (X) = \{ Y ~ | ~ \mathbb{P}(X \leq Y) = 1-\alpha \}$$

This can be easily found as well, since:
\mathbb{P}(X \leq Y) &= \mathbb{P}( \mu + \sigma Z \leq Y)\\
&= \mathbb{P} \left(Z \leq \frac{Y-\mu}{\sigma} \right)\\
&= \Phi \left( \frac{Y-\mu}{\sigma} \right) = 1-\alpha\\
where $\Phi(\cdot)$ is the cumulative standard normal distribution.

We can then deduce that:
$$\text{VaR}_\alpha (X) = Y = \Phi^{-1}(1-\alpha) \sigma + \mu$$
where $\Phi^{-1}(\cdot)$ is the inverse cumulative standard normal distribution and which can be looked up online.

Now, we can actually start working on the closed-form. Let’s first express the expected shortfall in terms of the value at risk:
$$ES_\alpha(X) = \frac{1}{1-\alpha} \int_\alpha^1 \text{VaR}_u(X) du$$

Using our previous result, we can rewrite the definition above as follows:
ES_\alpha(X) &= \frac{1}{1-\alpha} \int_\alpha^1 ( \Phi^{-1}(1-u) \sigma + \mu ) du\\
&= \frac{1}{1-\alpha} \left( \int_\alpha^1 \Phi^{-1}(1-u) \sigma du + \int_\alpha^1 \mu du \right)\\
&= \frac{1}{1-\alpha} \int_\alpha^1 \Phi^{-1}(1-u) \sigma du + \mu

As you can see, we managed to split the big integral into two parts, one of which is solved very easily. However, there remains an integral with $\Phi^{-1}(\cdot)$ which is a very complex function so we need to find a way around. To do this, we are going to use a change of variable introducing $u = \Phi(y)$. We have then $y = \Phi^{-1}(u)$ and $du = \phi(y)dy$ where $\phi(y)=\frac{1}{\sqrt{2\pi}} \exp \left( – \frac{y^2}{2} \right)$ is the standard normal density function.

\int_\alpha^1 \Phi^{-1}(1-u) \sigma du &= \int_{\Phi^{-1} (\alpha)}^{\Phi^{-1}(1)} \Phi^{-1}\left(\underbrace{ 1-\Phi(y)}_{\Phi(-y)} \right) \sigma \phi (y) dy \\
&= \int_{\Phi^{-1} (\alpha)}^\infty -y \sigma \phi (y) dy \\
&= \int_{\Phi^{-1} (\alpha)}^\infty -\frac{y \sigma}{\sqrt{2\pi}} \exp \left( – \frac{y^2}{2} \right) dy \\

So, we got rid of $\Phi^{-1}(\cdot)$ and the remaining integral is relatively easy to solve:

\int_{\Phi^{-1} (\alpha)}^\infty -\frac{y \sigma}{\sqrt{2\pi}} \exp \left( – \frac{y^2}{2} \right) dy &= \frac{\sigma}{\sqrt{2\pi}} \int_{\Phi^{-1} (\alpha)}^\infty -y \exp \left( – \frac{y^2}{2} \right) dy\\
&= \frac{\sigma}{\sqrt{2\pi}} \left( \exp \left( – \frac{y^2}{2} \right)\right)|_{\Phi^{-1} (\alpha)}^\infty\\
&= \frac{\sigma}{\sqrt{2\pi}} \left( 0 – \exp \left( – \frac{\Phi^{-1} (\alpha)^2}{2} \right)\right)\\
&= -\sigma \frac{1}{\sqrt{2\pi}} \exp \left( – \frac{\Phi^{-1} (\alpha)^2}{2} \right)\\
&= -\sigma \phi \left( \Phi^{-1} (\alpha) \right)\\

Now, we just have to include this in our previous result to get:

&= \frac{1}{1-\alpha} \left[ -\sigma \phi \left( \Phi^{-1} (\alpha) \right) \right] + \mu\\
&= \mu – \sigma \cdot \frac{\phi \left( \Phi^{-1} (\alpha) \right)}{1-\alpha}

This is a very good result, since we know that $\lambda( \alpha ) = \frac{\phi \left( \Phi^{-1} (\alpha) \right)}{1-\alpha}$ is a function of $\alpha$ that can be computed very easily, for example in Excel. Below are the results for $\alpha$ from 80% to 99%.

Values of $\lambda$ for different $\alpha$

That’s it, with this simple formula, you can compute the expected shortfall of a normally distributed variable without needing any data point.

An introduction to Risk Parity

Hello everyone!

In this post, I’d like to start talking again about asset allocation and in particular to introduce you to a relatively new concept in
the field: risk parity. Don’t get me wrong, this approach has been around for quite a while now — I think the first to create a product around this concept were Bridgewater in the 90s — but it is a philosophy which I believe is still not taught frequently enough in finance classes and hence is still widely unknown.



I first started to pay attention to risk parity about 5 years ago. In the classic Modern Portfolio Theory (MPT thereafter), the optimization problem has two inputs:

  • the covariance matrix of the assets available
  • an expected return for each asset considered

Both are difficult to estimate, but researchers tend to agree that estimating covariances is easier than estimating returns.

Nevertheless, a lot of asset managers came up with expected future returns based on “their experience” or on “their view of the market” — there is no real mathematical framework available. This causes a real issue because it has been shown that the mean-variance optimization problem (the one behind MPT) is really sensitive to the expected returns inputs: changing slightly the expected return figures can result in a big optimal allocation change. Therefore, estimating wrong expected returns makes manager select potentially pretty sub-optimal portfolios.


Estimating the covariance matrix is not an easy task either. However, there exist frameworks on which managers can rely and estimates they are usually not too far of the reality  (risk tends to be more stable than returns).

What I tried to look for 5 years ago, was an asset allocation method which was independent from the expected returns, as I found them very difficult to estimate accurately. Risk Parity is a perfect example of such method.

How does it work?

I will try to explain to concept without getting into equations. For those who are interested in the maths, please have a look at Thierry Roncalli’s presentation and paper to start with.

The basic idea is to have a portfolio where risk is diversified as much as possible — ideally perfectly diversified. The remaining challenge is to define how to quantify diversification; defining risk is somewhat arbitrary as you could choose different risk measures (volatility, expected shortfall etc) depending on your preference as an asset manager.

Quantifying diversification

Let’s assume that we are considering the simplest risk measure, volatility. Once the covariance matrix of all considered assets has been determined, one can then compute the volatility of a portfolio given the weights of each asset. Furthermore, one can also compute how much each asset contributes to the total volatility (i.e. total risk) of the portfolio. In risk parity the goal is to have each asset contributing equally to the total risk.

Let’s consider a portfolio with two assets $A$ and $B$ with 50% of weight for each asset (so-called equally-weighted portfolio) and let’s assume the total volatility is 8%. By computing the contribution and assuming $A$ is more volatile than $B$, then you could see that $A$ contributes by 6% and $B$ by 2% only (numbers here are arbitrary and taken for the sake of the example).


According to our diversification measure, the portfolio is not very well balanced as it is much more exposed to $A$.

Finding risk-parity

In his paper, Roncalli shows how one can implement an optimization method to find the portfolio where both $A$ and $B$ would equally contribute to the portfolio’s total volatility. Since I want to keep this post fairly non-technical I voluntarily want to skip the details of the methodology. Let’s assume we are provided with an optimizer which gives us the risk-parity portfolio. It would look like something with 70% weight on $B$ and 30% on $A$ and which would result in a total volatility of about 3%.


This time, our portfolio is optimally balanced as it is equally exposed to both assets from a risk point of view. Note that the total volatility of the risk-parity portfolio cannot be chosen, it is purely a result of the optimization.

There is much more to say on the properties of risk-parity, and I will write more about this in later posts.