## Asian Options II: Monte Carlo

In a recent post, I introduced Asian options, an exotic option which pay the average of the underlying over a sequence of fixing dates.

The payoff of an Asian call is

$C(T)&space;=&space;\Big({1&space;\over&space;N}\sum^N_{i=0}&space;S_{t_i}&space;-&space;K&space;\Big)^+$

and to price the option at an earlier time via risk-neutral valuation requires us to solve the integral

$C(t)&space;=&space;P_{t,T}\&space;\big(&space;\iint\cdots\int&space;\big)&space;\Big({1&space;\over&space;N}\sum^N_{i=0}&space;S_{t_i}&space;-&space;K&space;\Big)^+&space;\phi(S_{t_1},S_{t_1},\cdots,S_{t_N})&space;dS_{t_1}dS_{t_2}\cdots&space;dS_{t_N}$

A simple way to do this is using Monte Carlo – we simulate a spot path drawn from the distribution $\inline&space;\phi(S_{t_1},S_{t_1},\cdots,S_{t_N})$ and evaluate the payoff at expiry of that path, then average over a large number of paths to get an estimate of C(t).

It’s particularly easy to do this in Black-Scholes, all we have to do is simulate N gaussian variables, and evolve the underlying according to a geometric brownian motion.

I’ve updated the C++ and Excel Monte Carlo pricer on the blog to be able to price asian puts and calls by Monte Carlo – have a go and see how they behave relative to vanilla options. One subtlety is that we can no longer input a single expiry date, we now need an array of dates as our function input. If you have a look in the code, you’ll see that I’ve adjusted the function optionPricer to take a datatype MyArray, which is the default array used by XLW (it won’t be happy if you tell it to take std::vector). This array can be entered as a row or column of excel cells, and should be the dates, expressed as years from the present date, to average over.

## The Dupire Local Vol Model

In this post I’m going to look at a further generalisation of the Black-Scholes model, which will allow us to re-price any arbitrary market-observed volatility surface, including those featuring a volatility smile.

I’ve previously looked at how we can produce different at-the-money vols at different times by using a piecewise constant volatility $\inline&space;\sigma(t)$, but we were still unable to produce smiley vol surfaces which are often observed in the market. We can go further by allowing vol to depend on both t and the value of the underlying S, so that the full BS model dynamics are given by the following SDE

$dS_t&space;=&space;S_t\cdot&space;\Big(\&space;r(t)&space;dt\&space;+\&space;\sigma(t,S_t)&space;dW_t\&space;\Big)$

Throughout this post we will make constant use of the probability distribution of the underlying implied by this SDE at future times, which I will denote $\inline&space;\phi(t,S_t)$. It can be shown [and I will show in a later post!] that the evolution of this distribution obeys the Kolmogorov Forward Equation (sometimes called the Fokker-Planck equation)

${\partial&space;\phi(t,S_t)&space;\over&space;\partial&space;t}&space;=&space;-{\partial&space;\over&space;\partial&space;S_t}\big(rS_t\phi(t,S_t)\big)&space;+&space;{1\over&space;2}{\partial^2&space;\over&space;\partial&space;S_t^2}\big(\sigma^2(t,S_t)&space;S_t^2&space;\phi(t,S_t)\big)$

This looks a mess, but it essentially tells us how the probability distribution changes with time – we can see that is looks very much like a heat equation with an additional driving term due to the SDE drift.

Vanilla call option prices are given by

$C(t,S_t)&space;=&space;P(0,t)\int_K^{\infty}&space;\big(S_t&space;-&space;K\big)\phi(t,&space;S_t)&space;dS_t$

Assuming the market provides vanilla call option prices at all times and strikes [or at least enough for us to interpolate across the region of interest], we can calculate the time derivative of the call price which is equal to

${\partial&space;C&space;\over&space;\partial&space;T}&space;=&space;-rC&space;+&space;P(0,T)\int_K^{\infty}\big(&space;S_T&space;-&space;K&space;\big)\&space;{\partial&space;\phi&space;\over&space;\partial&space;T}\&space;dS_T$

and we can substitute in the value of the time derivative of the probability distribution from the Kolmogorov equation above

$rC&space;+&space;{\partial&space;C&space;\over&space;\partial&space;T}&space;=&space;P(0,T)\int_K^{\infty}\big(&space;S_T&space;-&space;K&space;\big)\Big[&space;-{\partial&space;\over&space;\partial&space;S_T}\big(&space;rS_T\phi\big)&space;+&space;{1\over&space;2}{\partial^2&space;\over&space;\partial&space;S_T^2}\big(&space;\sigma^2S_T^2\phi\big)&space;\Big]dS_T$

These two integrals can be solved by integration by parts with a little care

\begin{align*}&space;-\int_K^{\infty}\big(&space;S_T&space;-&space;K&space;\big){\partial&space;\over&space;\partial&space;S_T}\big(&space;rS_T\phi\big)dS_T&space;&&space;=&space;-\Big[rS_T\phi&space;\big(&space;S_T&space;-&space;K&space;\big)\Big]^{\infty}_{K}&space;+&space;\int_K^{\infty}rS_T\phi\&space;dS_T&space;\\&space;&&space;=&space;r\int_K^{\infty}&space;(S_T\phi)\&space;dS_T&space;\end{align*}\begin{align*}&space;\int_K^{\infty}\big(&space;S_T&space;-&space;K&space;\big){\partial^2&space;\over&space;\partial&space;S_T^2}\big(&space;\sigma^2&space;S_T^2\phi\big)dS_T&space;&&space;=\Big[\big(&space;S_T&space;-&space;K&space;\big){\partial&space;\over&space;\partial&space;S_T}(\sigma^2&space;S_T^2\phi)&space;\Big]^{\infty}_{K}&space;-&space;\int_K^{\infty}{\partial&space;\over&space;\partial&space;S_T}(\sigma^2&space;S_T^2\phi)\&space;dS_T&space;\\&space;&&space;=&space;-\sigma^2&space;K^2\phi(K,T)&space;\end{align*}where in both cases, the boundary terms disappear at the upper limit due to the distribution $\inline&space;\phi(t,S_t)$ and its derivatives, which go to zero rapidly at high spot.

We already have an expression for $\inline&space;\phi(t,S_t)$ in terms of C and its derivatives from our survey of risk-neutral probabilities,

$\phi(t,S_t)&space;=&space;{1&space;\over&space;P(0,t)}{\partial^2&space;C&space;\over&space;\partial&space;K^2}$

and we can re-arrange the formula above for call option prices

\begin{align*}&space;P(0,T)\int_K^{\infty}&space;S_T\&space;\phi\&space;dS_T&space;&&space;=&space;C&space;+&space;P(0,T)\int_K^{\infty}&space;K\phi\&space;dS_T&space;\\&space;&&space;=&space;C&space;+&space;K&space;{\partial&space;C&space;\over&space;\partial&space;K}&space;\end{align*}and substituting these expressions for $\inline&space;\phi(t,S_t)$ and $\inline&space;\int^{\infty}_K&space;(S_T&space;\phi)\&space;dS_T$ into the equation above

\begin{align*}&space;rC&space;+&space;{\partial&space;C&space;\over&space;\partial&space;T}&space;&&space;=&space;P(0,T)\cdot&space;\Big[&space;r\int_K^{\infty}&space;(S_T\phi)\&space;dS_T&space;+&space;\sigma^2&space;K^2\phi(K,T)&space;\Big]\\&space;&&space;=&space;rC&space;+&space;rK&space;{\partial&space;C&space;\over&space;\partial&space;K}&space;+&space;\sigma^2&space;K^2{\partial^2&space;C&space;\over&space;\partial&space;K^2}&space;\end{align*}

and remember that $\inline&space;\sigma&space;=&space;\sigma(t,S_t)$, which is our Dupire local vol. Cancelling the rC terms from each side and re-arranging gives

$\sigma(T,K)&space;=&space;\sqrt{&space;{\partial&space;C&space;\over&space;\partial&space;T}&space;+&space;rK&space;{\partial&space;C&space;\over&space;\partial&space;K}&space;\over&space;K^2{\partial^2&space;C&space;\over&space;\partial&space;K^2}}$

It’s worth taking a moment to think what this means. From the market, we will have access to call prices at many strikes and expires. If we can choose a robust interpolation method across time and strike, we will be able to calculate the derivative of price with time and with strike, and plug those into the expression above to give us a Dupire local vol at each point on the time-price plane. If we are running a Monte-Carlo engine, this is the vol that we will need to plug in to evolve the spot from a particular spot level and at a particular time, in order to recover the vanilla prices observed on the market.

A nice property of the local vol model is that it can match uniquely any observed market call price surface. However, the model has weaknesses as well – by including only one source of uncertainty (the volatility), we are making too much of a simplification. Although vanilla prices match, exotics priced using local vol models typically have prices that are much lower than prices observed on the market. The local vol model tends to put most of the vol at early times, so that longer running exotics significantly underprice.

It is important to understand that this is NOT the implied vol used when calculating vanilla vol prices. The implied vol and the local vol are related along a spot path by the expression

$\Sigma^2&space;T&space;=&space;\oint_0^T\sigma^2(S_t,t)dt$

(where $\inline&space;\Sigma$ is the implied vol) and the two are quite different. Implied vol is the square root of the average variance per unit time, while the local vol gives the amount of additional variance being added at particular positions on the S-t plane. Since we have an expression for local vol in terms of the call price surface, and there is a 1-to-1 correspondence between call prices and implied vols, we can derive an expression to calculate local vols directly from an implied vol surface. The derivation is long and tedious but trivial mathematically so I don’t present it here, the result is that the local vol is given by (rates are excluded here for simplicity)

$\sigma(y,T)&space;=&space;\sqrt{{\partial&space;w&space;\over&space;\partial&space;T}&space;\over&space;\Big[&space;1&space;-&space;{y&space;\over&space;w}{\partial&space;w&space;\over&space;\partial&space;y}&space;+&space;{1\over&space;2}{\partial^2&space;w&space;\over&space;\partial&space;y^2}+&space;{1&space;\over&space;4}\Big(&space;-{1&space;\over&space;4}&space;-&space;{1&space;\over&space;w}+&space;{y^2&space;\over&space;w}\Big)\Big({\partial&space;w&space;\over&space;\partial&space;y}\Big)^2&space;\Big]}$

where $\inline&space;w&space;=&space;\Sigma^2&space;T$ is the total implied variance to a maturity and strike and $\inline&space;y&space;=&space;\ln{K&space;\over&space;F_T}$ is the log of ‘moneyness’.

This is probably about as far as Black-Scholes alone will take you. Although we can reprice any vanilla surface, we’re still not pricing exotics very well – to correct this we’re going to need to consider other sources of uncertainty in our models. There are a wide variety of ways of doing this, and I’ll being to look at more advanced models in future posts!

## Digital Options

Today I’m going to talk about the valuation of another type of option, the digital (or binary) option. This can be seen as a bit of a case study, as I’ll present the option payoff and the analytical price and greeks under BS assumptions, and give add-ons to allow pricing with the MONTE CARLO pricer. I’ve also updated the ANALYTICAL pricer to calculate the price and greeks of these options.

Digital options are very straight-forward, they are written on an underlying S and expire at a particular date t, at which point digital calls pay $1 if S is greater than a certain strike K or$0 if it is below that, and digital puts pay the reverse – ie. the payoff is

$P_{\rm&space;dig\&space;call}&space;=&space;\Big\{&space;\&space;\begin{matrix}&space;\1&space;\quad&space;S&space;\geq&space;K\\&space;\0&space;\quad&space;S&space;<&space;K\end{matrix}$

We can calculate the price exactly in the BS approximation using the same method that I used to calculate vanilla option prices by risk-neutral valuation as follows

$C_{\rm&space;dig\&space;call}(0)&space;=&space;\delta(0,t)\&space;{\mathbb&space;E}[&space;C_{\rm&space;dig\&space;call}(t)&space;]$

where $\inline&space;C_{\rm&space;dig\&space;call}(t')$ is the price of the option at time $\inline&space;t'$, and we know that this must converge to the payoff as $\inline&space;t&space;\to&space;t'$, so $\inline&space;C_{\rm&space;dig\&space;call}(t)&space;=&space;P_{\rm&space;dig\&space;call}$

$=&space;\delta(0,t)\&space;\int^{\infty}_{-\infty}&space;P_{\rm&space;dig\&space;call}&space;\cdot&space;e^{-{1\over&space;2}x^2}&space;dx$

$\inline&space;P_{\rm&space;dig\&space;call}$ is zero if $\inline&space;S&space;=&space;S_0&space;e^{(r&space;-&space;{1\over&space;2}\sigma^2)t&space;+&space;\sigma&space;\sqrt{t}&space;x}&space;<&space;K$ which corresponds to $\inline&space;x&space;<&space;{\ln{K&space;\over&space;S_0}&space;-&space;(r-{1\over&space;2}\sigma^2)t&space;\over&space;\sigma&space;\sqrt{t}}&space;=&space;-d_2$

$=&space;\delta(0,t)\&space;\cdot&space;\1&space;\cdot&space;\int^{\infty}_{-d_2}&space;e^{-{1\over&space;2}x^2}&space;dx$

$=&space;\&space;\delta(0,t)\cdot&space;\Phi(d_2)$

where

$d_1&space;=&space;{\ln{S\over&space;K}+(r+{1\over&space;2}\sigma^2)t&space;\over&space;\sigma&space;\sqrt{t}}&space;\quad&space;;\quad&space;d_2&space;=&space;{\ln{S\over&space;K}+(r-{1\over&space;2}\sigma^2)t&space;\over&space;\sigma&space;\sqrt{t}}$

Since we have an analytical price, we can also calculate an expression for the GREEKS of this option by differentiating by the various parameters that appear in the price. Analytical expressions for a digital call’s greeks are:

$\Delta&space;=&space;{\partial&space;C&space;\over&space;\partial&space;S}&space;=&space;e^{-rt}\cdot&space;{\phi(d_2)\over&space;S\sigma&space;\sqrt{t}}$

$\nu&space;=&space;{\partial&space;C&space;\over&space;\partial&space;\sigma}&space;=&space;-e^{-rt}\cdot&space;{d_1&space;\&space;\phi(d_2)\over&space;\sigma}$

$\gamma&space;=&space;{\partial^2&space;C\over&space;\partial&space;S^2}&space;=&space;-e^{-rt}\cdot&space;{d_1&space;\&space;\phi(d_2)\over&space;S^2&space;\sigma^2&space;t}&space;=&space;-e^{-rt}\cdot&space;{d_1\&space;\phi(d_1)\over&space;S&space;K&space;\sigma^2&space;t}$

${\rm&space;Vanna}&space;=&space;{\partial^2&space;C&space;\over&space;\partial&space;S&space;\partial&space;\sigma}&space;=e^{-rt}\cdot&space;{\phi(d_2)\over&space;S&space;\sigma^2&space;\sqrt{t}}\Big(&space;d_1&space;d_2&space;-&space;1&space;\Big)$

${\rm&space;Volga}&space;=&space;{\partial^2&space;C&space;\over&space;\partial&space;\sigma^2}&space;=&space;e^{-rt}\cdot&space;{\phi(d_2)\over&space;\sigma^2}\cdot&space;\Big(&space;d_1&space;+&space;d_2&space;-&space;d_1^2&space;d_2&space;\Big)$

where

$\phi(d_1)&space;=&space;{1\over&space;\sqrt{2&space;\pi}}\&space;{e^{-{1\over&space;2}d_1^2}&space;}$

Holding a binary put and a binary call with the same strike is just the same as holding a zero-coupon bond, since we are guaranteed to receive \$1 wherever the spot ends up, so the price of a binary put must be

$e^{-rt}&space;=&space;e^{-rt}\cdot&space;\Phi(d_2)&space;+&space;C_{\rm&space;dig\&space;put}(t'=0)\quad&space;\quad&space;\quad&space;\quad&space;[1]$

$C_{\rm&space;dig\&space;put}(0)&space;=&space;e^{-rt}&space;\cdot&space;\Phi(-d_2)$

Moreover, differentiating equation [1] above shows that the greeks of a digital put are simply the negative of the greeks of a digital call with the same strike.

Graphs of these are shown for a typical binary option in the following graphs. Unlike vanilla options, these option prices aren’t monotonic in volatility: if they’re in-the-money, increasing vol will actually DECREASE the price since it makes them more likely to end out-of-the-money!

One final point on pricing, note that the payoff of a digital call is the negative of the derivative of a vanilla call payoff wrt. strike; and the payoff of a digital put is the positive of the derivative of a vanilla put payoff wrt. strike. This means that any binary greek can be calculated from the corresponding vanilla greek as follows

$\Omega_{\rm&space;dig\&space;call}&space;=&space;-{\partial&space;\Omega_{\rm&space;call}\over&space;\partial&space;K}$

$\Omega_{\rm&space;dig\&space;put}&space;=&space;{\partial&space;\Omega_{\rm&space;put}\over&space;\partial&space;K}$

where here $\inline&space;\Omega$ represents a general greek.

If you haven’t yet installed the MONTE CARLO pricer, you can find some instructions for doing so in a previous post. The following links give the header and source files for binary calls and puts which can be dropped in to the project in your C++ development environment

These will register the option types with the option factory and allow monte carlo pricing of the options (so far, all of the options in the factory also have analytical expressions, but I’ll soon present some options that can only be priced by Monte Carlo).

## BS from Delta-Hedging

Today I’m going to look at another method of getting to the BS equations, by constructing a delta-hedge. This is the way that the equation was in fact first reached historically, and it’s a nice illustration of the principle of hedging. All of the same assumptions are made as in the post that derived the BS equation via Risk Neutral Valuation.

The principle is that because the price of some derivative is a function of the stochastic underlying , then all of the uncertainty in comes from the same source as the uncertainty in . We try to construct a risk-free portfolio made up of the two of these that perfectly cancels out all of the risk. If the portfolio is risk-free, we know it must grow at the risk free rate or else we have an arbitrage opportunity.

Our model for S is the geometric brownian motion, note that we allow the rate of growth in general to be different from

We can express in terms of its derivatives with respect to and using Ito’s lemma, which I discussed in a previous post,

Our portfolio is made up of one derivative worth and a fraction  of the underlying stock, worth ; so the net price is . We combine the above two results to give

We are trying to find a portfolio that is risk-free, which means we would like the stochastic term to cancel. We see immediately that this happens for , which gives

Since this portfolio is risk-free, to prevent arbitrage it must grow deterministically at the risk free rate

and so

This is the BS partial differential equation (pde). Note that despite the fact that the constant growth term for the underlying had a rate , this has totally disappeared in the pde above – we might disagree with someone else about the expected rate of growth of the stock, but no-arbitrage still demands that we agree with them about the price of the option [as long as we agree about , that is!]

As for any pde, we can only solve for a specific situation if we have boundary conditions – in this case, given by the payoff at expiry . At that point we know the exact form the value that must take

Our job is to use the pdf to evolve the value of backwards to . In the case of vanilla options this can be done exactly, while for more complicated payoffs we would need to discretise and solve numerically. This gives us another way of valuing options that is complementary (and equivalent) to the expectations approach discussed previously.

To solve the equation above, it is useful to first make some substitutions. As we are interested in time-to-expiry only, we make the change of variables  which yields

We can eliminate the terms by considering change-of-variables . This means that

Combining these the BS equation becomes

The linear term in can be removed by another transformation  so that

The exponential terms cancel throughout, and we are left with

One final transformation will be needed before putting in boundary conditions. The transformation will be

But unlike the other transformations I’ve suggested so far, this one mixes the two variables that we are using, so a bit of care is required about what we mean. When I most recently wrote the BS equation, was a function of and  – this means that the partial differentials with respect to  were implicitly holding constant and vise versa. I’m now going to write as a function of and instead, and because the relationship features all three variables we need to take a bit of care with our partial derivatives:

where vertical lines indicate the variable that is being held constant during evaluation. Now, to move from to , we expand out the term in the same way as we did for above

We can compare these last two equations to give expressions for the derivatives that we need after the transformation by comparing the coefficients of  and

Computing and inserting these derivatives [I’ve given a graphical representation of the first of these equations below, because the derivation is a little dry at present!] into the BS equation gives

This is the well-known Heat Equation in physics. For the sake of brevity I won’t solve it here, but the solution is well known – see for example the wikipedia page – which gives the general solution:

Where is the payoff condition (it’s now an initial condition, as expiry is at  = 0). The algebra is quite involved so I give the solution its own post, and you can show by substitution that the BS option formulae given previously is a solution to the equation.

As an aside, what was the portfolio that I was considering all of the way through? Comparing to the vanilla greeks, we recognise it as the option delta – the hedging portfolio is just the portfolio of the option with just enough stock to hedge out the local delta risk. Of course, as time goes by this value will change, and we need to constantly adjust our hedge to account for this. This shows the breakdown caused by one of our assumptions – that we could trade whenever we want and without transaction costs. In fact, because we need to re-hedge at every moment to enforce this portfolio’s risk free nature, in the presence of transaction costs the hedging costs in this strategy will be infinite! This demonstrates a significant failing of one of our assumptions, I’ll come back again to the effect of this in the real world in future posts.