New challenges in Hong Kong!

Hello everyone,

Since arriving in Hong Kong two years ago, I haven’t had too many chances to contribute to this blog. There are multiple reasons to this.

pump-jack-848300_640First of all, my work at Noble Group was taking me a considerable amount of time and energy. It was my first experience in the physical commodity market, and it took me some time to get up to speed and to understand how business works in that field. On top of that, I was lucky to be able to work alongside some amazingly talented individuals. Whilst this gave me an incredible opportunity to learn a lot of new things on topics  I had never worked on before, it was also difficult to live up to expectations. Besides, I also experienced what it meant to work in the headquarters of a global company which has offices literally all around the world. This allowed me to meet a lot of different people and business cultures,  but it also means having to adapt to the time difference with the various offices and essentially having to make calls late at night or early in the morning as well as potentially receiving urgent requests by email or phone in the middle of the night.

Next Friday, I will be leaving Noble Group and moving back to asset management for a Swiss private bank in Hong Kong. I am really looking forward to this new challenge and can’t wait to get started in my new role in November. More on this probably in a later post.

Swisscham YPsIn parallel, I started in 2016 to be actively working with the Swiss Chamber of Commerce. Essentially, the Chamber is a platform for Swiss businesses in Hong Kong. It allows local and Swiss companies or professionals to connect and interact during the events organized by the chamber. In June 2016, I became the President of the Young Professionals Executive Committee. We are organizing monthly events for the Chamber and we help the board of directors in different projects. I invite you to follow our Facebook page for more information about us and to get the most recent updates on our upcoming events.

I will try to add more content from now on if time allows!

Exchange Sports Betting: how to close your bets?

Good evening,

It’s been a very long time since I last posted something on this blog because I have been very busy at work but I thought I will try to be more active from now on.

Today, I’d like to share some basic maths about exchange sports betting, and actually we could generalize this to exchange betting in general.

Exchange betting has emerged over the last decade on the internet. Companies such as Betfair act as intermediary between individuals (or actors) willing to bet on a specific event.

From a general point of view, actors bet on an event $E$ to happen or not to happen.

  • When you want to bet on the fact that $E$ does happen, we say that you back $E$
  • When you want to bet on the fact that $E$ does not happen (denoted $\bar{E}$), we say that you lay $E$.

I chose to discuss exchange betting in this post because you have the opportunity to directly bet both on $E$ and $\bar{E}$. When you bet against a bookmaker, usually he will allow you only on an event to happen. For example, on a football game between Team A and Team B, the bookmaker will allow you to bet on Team A to win, Draw or Team B to win, but he will not let you bet directly on Team A not to win. This does not mean that you cannot recreate this bet synthetically, but I wanted to keep things as simple as possible on this post.

Let’s keep the example of the football game, and let’s say that the event of Team A to win is denoted by $A$. When you place a bet, you do it at given odds, which we will denote by $o$. For example, let’s say that $o=2$. Here I am using the European convention, which means that if you bet an initial amount $x$ on $A$,

  • If $A$ happens, the payoff is $x \cdot (o-1)=x \cdot (2-1)=x$.
  • If $A$ does not happen, the payoff is $-x$.

Now let’s say that the odds do not change and that you lay an initial amount of $x$ on $A$:

  • If $A$ happens, the payoff is $-x \cdot (o-1)=-x$.
  • If $A$ does not happen, the payoff is $x$.

Let’s draw a table to see what happens now in both situations, using generic odds $o$:

$A$ happens $A$ does not happen
Back $x$ at $o$  $x(o-1)$ $-x$
Lay $x$ at $o$  $-x(o-1)$ $x$
Net payoff  $0$ $0$

As expected, if you back and lay $A$ for the same odds $o$, then your payoff will be $0$ in both cases.

Let’s now consider a case where the odds change in time. Originally, you back $A$ at $o_1$, and then the odds change to $o_2$. What I would like to show on this post is that you can again guarantee a similar payoff in both cases ($A$ happens or not) by laying some amount $y$ on $A$ at $o_2$.

Let’s draw the table again:

$A$ happens $A$ does not happen
Back $x$ at $o_1$  $x(o_1-1)$ $-x$
Lay $y$ at $o_2$  $-y(o_2-1)$ $y$
Net payoff $x(o_1-1)-y(o_2-1)$ $y-x$

Now, we want the net payoff to be equal in both cases:

$$x(o_1-1)-y(o_2-1) = y-x$$

$$x(o_1-1) + x = y +  y(o_2-1)$$

$$x(o_1-1+1) = y(o_2-1+1)$$

$$x o_1 = y o_2$$

$$y = x \frac{o_1}{ o_2}$$

By solving this equation, we know that if we bet $y = x \frac{o_1}{ o_2}$, we will have the same payoff in both cases. We can also compute the value of this payoff:

$$\text{Payoff} = y-x = x \frac{o_1}{ o_2} – x = x \left(\frac{o_1}{ o_2} – 1 \right)$$

So we see here that if $\frac{o_1}{ o_2} – 1 > 0$, we will have a positive payoff in any case. In particular, if $\frac{o_1}{ o_2}>1$, we make money, if $\frac{o_1}{ o_2} < 1$, we lose money, and if $\frac{o_1}{ o_2}=1$, we make $0$ (which is the case $o_1=o_2=o$ we saw previously).

In conclusion, we make profit if and only if $o_2<o_1$. This makes a lot of sense; let’s say $o_1=3$ and $o_2=2$, the odds became lower because the market acknowledged that  $A$ is more likely to happen because it’s now willing to pay less if $A$ happens than before. This means that you were right, and hence that you have made money.

Now, how does it work if you want to take the opposite position originally, namely you lay an initial amount $x$ on $A$  at $o_1$, and then the odds change to $o_2$. How can you close the position by backing $A$ with an amount $y$?

$A$ happens $A$ does not happen
Lay $x$ at $o_1$  $-x(o_1-1)$ $x$
Back $y$ at $o_2$  $y(o_2-1)$ $-y
Net payoff $y(o_2-1)-x(o_1-1)$ $x-y$

We then need:


$$y + y(o_2-1)=x + x(o_1-1)$$

$$y o_2 = x o_1 $$

$$y = x \frac{o_1}{o_2} $$

Then, the payoff is:

$$\text{Payoff} = x-y = x – x \frac{o_1}{o_2}  = x \left( 1 – \frac{o_1}{o_2} \right)  $$

In this case, we see that we make a positive payoff if $\frac{o_1}{o_2} < 1$, that is, if $o_1 < o_2$. Again, this makes sense intuitively; if you lay $A$ at $o_1=2$ and then $o_2 = 3$,  then the market believes that $A$ is now less likely to happen than before, which means that you were originally right to lay $A$ and hence deserve a payoff.

Let’s do a final sanity check on what we just said. First, we know that odds can take any value in $[1, \infty]$. When $o=1$, then $E$ will happen with probability $1$. When $o = \infty$, then $E$ will never happen (probability is $0$).

Assume you had a bet at $o_1$ and then $o_2 = 1$, which means that $E$ will happen. Then, if you backed $E$ you can get a payoff of $x \left( \frac{o_1}{1} – 1 \right) = x (o_1 -1 )$. If you laid $E$, then the payoff is $x \left( 1 – \frac{o_1}{1} \right) = -x (o_1 – 1)$. These match the payoff we defined orginally for back and lay bets on $E$.

Assume now $o_2 = \infty$, then if you backed $E$ the payoff is $x ( 0-1) = -x$ and if you laid $E$ the payoff is $x (1-0)=x$. This also matches the original definition and we have shown here that the approach above is sound.

Please keep in mind that all the above assumes there is no transaction costs to take into account, which is not exactly correct and which I will address in a later post, but the idea is there.

That’s all for now, hope you enjoyed that and I’ll be back with more.

CFA Level III: Implementation Shortfall

Good evening,

A quick post tonight to discuss a topic of Trading, Rebalancing and Monitoring part of the Level III curriculum called Implementation Shortfall. The reason why I chose to do this is because it took me some time to overcome the naming conventions of the CFA institute, which are, with all due respect, very counterintuitive in my opinion.

The idea is very simple: you would like to be able to measure the quality of the execution of a trade compared to an ideal execution.

From what I’ve seen in mock exams and exercises, they always give you a little story like the following one:

  • At some point, the investment manager decides to buy 10 Manchester United stocks, which trades at 20.
  • This is called the benchmark price (BP), for some reason.
  • Then (usually the following day), a limit order is placed in the market, say at 19.95 and is not executed at all. The market closes on that day at 20.10. Too bad.
  • You pay 0.05 per share of commission.
  • The following day, the order is revised at like 20.15 and 8 stocks (i.e not the whole 10) are filled at that price, and the market closes at 20.20.

What happens there? Well, assume you are able to magically implement your trading ideas instantly at no cost: this is called the paper portfolio. What is your profit at the end of the story?

  • You buy 10 shares at 20 for 200.
  • At the end of the story, your stocks are worth 20.20 each, which gives you a total of 202.
  • You earned 202 – 200 = 2

In the real world, it did not work out that way:

  • You bought 8 stocks at 20.15 for 161.2
  • You pay 0.4 in commission
  • At the end of the story, your stocks are worth 20.20 each, which gives 161.6
  • You earned 161.6 – 161.2 – 0.4 = 0

The implementation shortfall is defined as follows:

$$\frac{\text{paper portfolio gain}-\text{real portfolio gain}}{\text{paper portfolio investment}}=\frac{2}{200}=1.0\%$$

This means that 1.0% of the potential investment was lost (or, more precisely, not won)  in the implementation, due to different frictions.

The CFA Institute then provides a way to split this difference in different components.

First the explicit costs, which consists in all the obvious transaction costs that are expressed in the trade:

$$\frac{\text{commission}}{\text{paper portfolio investment}}=\frac{0.4}{200}=0.2\%$$

That’s fine. But then comes the bizarre naming conventions.

Some extra costs come from the fact between the moment when the investment manager decides to buy the stock and the day when the order is partially filled, the market moved.

The slippage or delay costs is the difference between the benchmark price and the closing price, the day before the execution day (which is called, poorly the decision price, I don’t understand why) divided by the benchmark price, times the percentage of the order that was filled. In order case we have:

$$\frac{20.10-20.00}{20} \cdot \frac{8}{10}=0.4\%$$

It is the portfolio of the implementation shortfall that was lost because of the delay between the time the manager saw the opportunity and the day the trade was partially executed.

Then, the realized loss is the difference between the execution price and the closing price the previous day (so-called decision price), divided by the benchmark price times the percentage of the order that was filled:

$$\frac{20.15-20.10}{20} \cdot \frac{8}{10}=0.2\%$$

This is what was lost during the execution day.

Finally the missed trade opportunity cost is the difference between the price at the end of the story and the benchmark price divided by the benchmark price time the proportion of the order that was not filled:

$$\frac{20.20-20.00}{20} \cdot \frac{2}{10}=0.2\%$$

This is what was lost by not being executed.

If you sum all the components, you get 0.2% + 0.4% + 0.2% + 0.2% = 1.0%, the total implementation shortfall.

So you are able to see that, in this example, the main component of the implementation shortfall is the delay between the trade idea and the trade execution day. The limit order at 19.95 was too ambitious and resulted in a loss.

Notice also that all the examples I saw are examples where the market goes in the trade direction (i.e. market goes up after a buy decision). It could be possible that the market goes adversely, which would result in a negative implementation shortfall… i.e a gain.

That’s all for today.

I’ll be back soon with more.



Monte-Carlo Method on Panini stickers distribution

Good afternoon everyone,

Today I want to write a funny post which combines two of the most important topics of June 2014: the CFA Level III curriculum and the FIFA World Cup. I know, that a long shot.

I assume that pretty much every reader of this blog had the opportunity to collect Panini stickers before major sporting events. The idea is quite simple. You have an album which you need to fill with stickers that you buy by packs. For the 2014 FIFA World Cup in Brazil, each pack contains 5 stickers and the album has roughly 650 stickers.

When I was a child, I used to buy or to be offered I pack every day and filling the album took weeks. Today, I start off by buying a whole box of 100 packs, which makes it 500 stickers at a time. The thing is, as you open the packs, you would expect to have duplicate stickers that you will exchange with friends for stickers that you don’t already own. This year though, several of my friends and myself bought boxes and got absolutely no duplicate, which mean that we all had an album filled with 500 stickers straightaway.  It then looked clear to me that Panini did this on purpose, but I wanted to make sure using probability thoery.


What is the probability that, after 500 stickers, I still have no duplicate sticker?

Alternatively, you could ask: did Panini make sure that you have no duplicate if you buy a whole box of 500 stickers?

Basic Assumption

For this experiment, I assume that getting the event of getting any sticker is equiprobable. This maximizes the chance of having no duplicate after several draws. Formally, I define a random variable $X$ which can take any value between 1 and $m$ (the number of existing stickers) and which represents the event of drawing the sticker’s number. Then we have that the probability of drawing sticker number $i$ is:


In our case, $m=650$ and the probability of getting any sticker is roughly 0.15%.

Single draws

To begin, I remove the concept of packs and assume that I get every sticker randomly with the probability mentioned above. In this setup, it is quite easy to compute the probability of having no duplicate after $n$ draws:

After 1 draw, the probability of having a duplicate is 100%; of course, because you have no stickers at all.

After 2 draws, the probability of having no duplicate is:


The idea is simple: on the numerator is the number of cards that we don’t already have and on the denominator is the number of possible cards. When then multiply this probability by the probability of having no duplicate so far (which was 100%, i.e. 1, in this case).

After 3 draws we have:

$$99.85 \% \cdot \frac{650-2}{650}=99.54\%$$

We can generalize this by saying that for $m$ existing different stickers, the probability of having no duplicate after $n$ draws is:

$$\prod_{i=1}^n \frac{m – (i-1)}{m}$$

That’s rather easy to compute using any programming language such as Matlab or C#.

Coming back to our world cup 2014 example, we can draw the following chart to see how the probability of having no duplicate evolves along with the number of single draws performed:

Probability of having no duplicate after n draws
Probability of having no duplicate after n draws

As you can see, in this setup the probability of having no duplicate is almost 0% after 100 draws. So, there is little chance that this occurred if Panini did not make something special about it.

Draws from packs

On argument that could be made is that you should not have any duplicate within a single pack. In this case, you are sure to have 5 distinct cards  every time you open a pack, and it should slightly boost your probability to have no duplicates after $n$ draws. This can be shown using a simple example: assume you draw 5 single cards, the probability of having no duplicate using the formula above gives 98.47%. If you get cards by pack, drawing 5 cards corresponds to drawing 1 pack, which by assumption guarantees having no duplicates (probability of 100%).

So, how do we compute the probability of having no duplicate after opening $n$ packs? Well I guess it is possible to formulate it mathematically, and frankly when I thought about this I was not really in the mood of digging into all these permutations. So, I decided to go with another approach: a monte-carlo simulation. How does that work? The idea is quite simple: I am going to create a computer program that simulates the process of opening packs of stickers. Here is how the program will work:

Creating a pack

I assume the pack contains $p$ stickers, with an equal probability of drawing any sticker.

  • Start with an empty pack
  • As long as I don’t have $p$ stickers in the pack
    • Draw a sticker randomly
    • If the sticker is not already in the pack
      • Add the sticker to the pack
  • Return the full pack

Running a simulation

Now that I have a procedure to create a pack, I will define what I mean by running a simulation. The idea is to simulate the action of opening packs randomly generated on the fly until I get a duplicate in the stickers I got:

  • Start with an empty album
  • Until I have a duplicate a duplicate sticker
    • Generate a random pack
    • Open the pack and put the stickers in the album
  • Return the number of opened packs

So, what I’m doing here is to simulate a random variable $Y$ which is the number of opened pack before getting a duplicate.

Back to our Panini example, we really simulate opening packs as we do from the box of 100 packs. What we would like to do is to estimate the probability distribution of this variable $Y$ in order to be able to discuss whether it is statistically possible that we got no duplicate after 100 packs. This is where Monte-Carlo simulation comes into action.

Monte-Carlo simulation

The principle of Monte-Carlo simulation is to simulate the outcome of a random variable $k$ times, where $k$ is very large. We divide the number of each outcome we got  by the total number of simulations, $k$. This gives us an estimation of the probability of each outcome.

This is exactly what I did for the Panini example, and I got the following results:

Probability of having first duplicate after opening n packs.
Probability of having first duplicate after opening n packs.

In the graph above, you see the probability of having the first duplicate after opening $n$ packs, i.e. $\mathbb{P}(Y=n)$. To be able to make a final assessment, we would like to see the estimated cumulative distribution of $Y$ which corresponds to the probability of having at list a duplicate after opening $n$ packs:

Cumulative Probability of having at least one duplicate after opening n pack.
Cumulative Probability of having at least one duplicate after opening n pack.

As you can see, after 15 packs, there is a probability of having no duplicate of almost zero. That is, a probability of about 0 of having no duplicate after $5 \cdot 15 = 75$ stickers. This means that there is almost no chance that my friends and I had no duplicate after opening a whole box of 100 packs.

So, there is not much difference with the simple model, but that’s not really the point. The idea is that it was hard to get a closed form of the probability of having at least duplicate after $n$ packs, but that by using the Monte-Carlo simulation, we managed to estimate this. This is sometimes also used for simulating scenarios under some model assumptions!

I hope you enjoyed this funny example!



CFA Level III: Interest Rate Parity

Hello everyone,

Today I’m gonna talk about some economic concepts that were mentioned at least since Level II and that are quite useful in the whole curriculum and in finance in general when it comes to dealing with currency management.

Covered Interest Rate Parity

The idea is quite simple, we will compute the forward exchange rate between two currencies using an arbitrage argument, say EUR and USD. The spot exchange rate is denoted $S_{\text{EUR}/\text{USD}}$: it corresponds to the number of euros you get today for 1 US dollar. Furthermore, the risk-free rate in USD is denoted $R_{\text{USD}}$ and the risk-free rate in EUR is denoted $R_{\text{EUR}}$. The question is, after some time $T$, how many euros will I get for 1 US dollar? This rate is called the forward rate and is denoted $F_{\text{EUR}/\text{USD}}$.

Well, you can price that quite easily using an arbitrage argument! The idea is simple:

  • I’m going to borrow today $\frac{1}{1+R_\text{USD}}$ USD which means that at time $T$, I will have to pay back 1 USD.
  • Then I’m going to convert what I just borrowed in EUR, which gives me $S_{\text{EUR}/\text{USD}} \cdot \frac{1}{1+R_\text{USD}}$ euros
  • I then invest this at the risk-free rate in EUR, and I get at time $T$ $(1+R_\text{EUR}) S_{\text{EUR}/\text{USD}} \cdot \frac{1}{1+R_\text{USD}}$ euros

What I wrote above means that:

$$F_{\text{EUR}/\text{USD}}= S_{\text{EUR}/\text{USD}} \cdot \frac{1+R_\text{EUR}}{1+R_\text{USD}}$$

That’s as simple as it sounds, we have determined the forward price of US dollars in euros at time $T$.

A very easy way of remembering the formula above is noticing that the rate in the numerator and in the denominator are from the same currency as is shown in the rate label: EUR/USD.

Also, recall from this post that in this case (EUR/USD), the US dollar is the asset being priced in euros; the US dollar is an asset like anything else.

Finally, we understand from the formula above that:

$$R_\text{EUR} > R_\text{USD}  \implies F_{\text{EUR}/\text{USD}}> S_{\text{EUR}/\text{USD}}$$

This is very useful because you very often have to say what currency is trading at premium or at discount in another currency. First I used to always get that wrong. In fact, it’s very easy.  The currency being traded is the one in the denominator of the label, here USD. Then, if the forward price is higher (lower) than the spot price, it is of course trading at premium (discount).

So, if we say that the USD is trading at premium in EUR, it means that we can have more EUR in the forward market than in the spot market for 1 USD.

Uncovered interest rate parity

This is in a sense an extension of the covered interest rate parity we just discussed which says that:

$$\mathbb{E}({S_{\text{EUR}/\text{USD}}}_T)= {S_{\text{EUR}/\text{USD}}}_0 \cdot \frac{1+R_\text{EUR}}{1+R_\text{USD}}$$

Notice that here the implication is different than previously, because we say that we expect that the spot rate at time $T$ will be equal to the forward price at today. This comes to says that the currency that has the higher (lower) interest rate is expected to depreciate (appreciate):

$$R_\text{EUR} > R_\text{USD}  \implies \mathbb{E}({S_{\text{EUR}/\text{USD}}}_T)> {S_{\text{EUR}/\text{USD}}}_0$$

Indeed, a higher spot rate in the future means that you would get more euros for the same amount of US dollars which means that the euro has depreciated!

A lot of traders disagree with that statement, and this comes to a very famous trading strategy called the carry trade. The idea is really simple as well: these traders do not think that the currency with the higher interest rate will depreciate. They hence short the currency with lower interest rate and invest in the currency with higher interest rate. In the curriculum, they say that this strategy tends to work most of the time, generating positive income. However, they say that, when for some reason, the interest rate goes in the expected direction, they tend to do so very violently and that it can lead to very large losses.

That’s it for today, I hope this little post will help you in mastering this concept, which is key to a lot of different topics at different levels of the CFA curriculum.