Bocconi University                                        Fall 2011                       Applied Numerical Finance - code...
generic nature, spread options are used in various …nancial markets such ascurrency and foreign exchange markets, commodit...
Indeed, if S1 is greater than S2 at maturity, option intrinsic value is greaterthan zeros and reaches the peak as the di¤e...
4
Part IIOption pricing: main issuesGenerally there are several methods for pricing options; all of them are basedon evaluat...
3    The change of numeraireChange of numeraire is a useful tool being used to price both …xed incomeinstruments and exoti...
4    Monte Carlo simulation and variance reduc-     tion techniquesInstead of using only a closed formula to price this ki...
The second technique is the control variate and it consists of exploiting theinformation about the error in the estimate o...
The last sheet, named ListTypesOption, is the one used to insert the     possible option type available when we call the m...
6     Convention used and Internal set upIn this section we will go through the code and we will o¤er a detail justi…catio...
with the accessory forth point. We have tried to use String variable as cleareras possible. In fact the Variable Output ha...
We have used the Static10 function Clock to track the simulation duration.      The function precision is up to seconds   ...
Part IVGraphs and resultsWe performed a Monte Carlo (MC) simulation of the price of the Margrabeoption and compared it to ...
Confidence Interval at 95% converges to closed formula price                12               11.5                11       ...
Upcoming SlideShare
Loading in …5
×

Margrabe option

3,285 views
3,110 views

Published on

Published in: Business, Economy & Finance
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,285
On SlideShare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Margrabe option

  1. 1. Bocconi University Fall 2011 Applied Numerical Finance - code 20247 Monte Carlo for the Margrabe option Giulio Laudani 1256809 Francesco Manenti 1260827 Michele Mazzoni 1262799 Luca Scollo 1244847 Gabriele Giovanni Vecchio 1259910Part IWhat is Margrabe option?A Margrabe option, known also as exchange option, gives to the owner theright, but not the obligation, to exchange one asset into another asset at aspeci…c maturity date T; we consider only options of the european type, forwhich the buyer has the right to be paid, at the maturity date T, the di¤erenceS1 (T ) S2 (T ), i.e. it is a claim with payo¤ X (T ) = max fS1 (T ) S2 (T ) ; 0gat time t. The Margrabe Option can be viewed as a Spread option1 where the strikeis set equal to zero. The use of this kind of options is widespread. Due to their 1 A spread option is an option written on the di¤erence of two underlying assets, whosevalues at time t we denote by S1 (t) and S2 (t). To exercise the option, the buyer must pay atmaturity a pre-speci…ed price K, known as the strike, or the exercise price of the option. Inother words, the payo¤ of a spread option at maturity T is (S1 (T ) S2 (T ) K)+ . Besidesthe fact that the case K = 0 leads to a solution in closed form, it has also a practical appealto the market participants. Indeed, it can be viewed as an option to exchange one productfor another at no cost. 1
  2. 2. generic nature, spread options are used in various …nancial markets such ascurrency and foreign exchange markets, commodity futures markets, and …xedincome markets.These options can be traded on an exchange, but the bulk ofthe volume comes from over-the-counter trades. Here we are going to describe a possible example to give a better insight.Let us suppose that an investor wants to buy one of two stocks S1 or S2 , butis not quite sure of his pick. Therefore he might buy an option to exchange S2for S1 in case S1 outperforms S2 at time T . In this way his investment is thebetter of the two stocks at time T . So if one would like to own either one ofthe underlyings at time T , one could simply buy the …rst one and purchase theabove Margrabe option. This will guarantee that, short of the premium of theoption, we do as well as if we had bought the one ending up being the cheaperof the two in all cases.1 Margrabe’ closed formula sFollowing Margrabe’ work (1978), it is possible to derive the closed formula, susing the change of numeraire approach, taking asset S_2 as numeraire. In thisway the option to exchange asset two for asset one is a call option on asset one,with exercise price equal to unity and interest rate equal to zero2 . Let us suppose the capital market is perfect, of course, and let S1 and S2 bethe price of assets one and two, where and S1 and S2 are log-normal. Thus q1 T q2 T Sm argrab e = S1 (0) e N (d1 ) S2 (0) e N (d2 )where S1 (0) ln S2 (0) + q2 q1 + 2 T d1 = p T p d2 = d1 T 2 2 2 = 1 + 2 2 1 22 Option sensitivity analysisIn this paragraph we are going to highlight the option sensitivity with respect tothe Margrabe option input parameter. So we created a Matlab code that allowsto …gure out how the option value changes as the option parameters change.Therefore the program using function mesh creates the graphs, reported below.As we can see in the …rst graph, the option is worth at least zero, and no morethan S1 , if assets one and two are worth at least zero. It’ easy to see that sMargrabe option is increasing with respect to S1 . 2 W.Margrabe, The value o fan option to exchange one asset for another, The Journal ofFinance March 1978, pag. 177-186 2
  3. 3. Indeed, if S1 is greater than S2 at maturity, option intrinsic value is greaterthan zeros and reaches the peak as the di¤erence between assets one and two isthe highest. Moreover, we are going to consider how option worth as asset volatilitychanges. As we can see in the graph 2a Margrabe option behave in the sameway both for the …rst asset and for the second one. As the matter of factthat, such as for a call option, as the volatility increases, the probability thatoption will be in the money at maturity increases. On the other hand the graph2b shows how option value varies as correlation between the two underlyingasset and time change. Therefore, ceteris paribus, option value increase as thecorrelation between asset one and two decrease. The Margrabe option goes upin value if security one and two are negatively correlated. Finally we are going to show how Margrabe option price changes as contin-uous dividend yield changes. How we can see in the third …gure the option has negative Epsilon, pricesensitivity with respect to the dividend yield, computed for the S1 and a positiveEpsilon for S2 . So given asset one’ dividend yield equals to zero, Margrabe soption price goes up when asset two’ dividend yield increases. s 3
  4. 4. 4
  5. 5. Part IIOption pricing: main issuesGenerally there are several methods for pricing options; all of them are basedon evaluate an expectation. Depending on the payo¤ we can solve it by: Explicit solution Numerical integration (for instance Monte Carlo simulations) Converting to a PDE and solving with boundary conditions (full blown PDE methods or approximate solutions by simplifying the PDE) Approximate the underlying state variable (lattice methods) In our report we focus on two of these methods: explicit solution, introducingthe idea behind the change of numeraire approach, and Monte Carlo methodtogether with its feasible variance reduction techniques. 5
  6. 6. 3 The change of numeraireChange of numeraire is a useful tool being used to price both …xed incomeinstruments and exotic derivatives on several underlying assets. Speci…cally thismethodology can be applied on Margrabe option, which is an option written ontwo underlying assets and this approach can simplify the computation of theprice. Numeraire is a positive traded asset, and it must be self …nancing; someexamples of numeraire are the money market account, a zero coupon bond, anon dividend paying asset . If there are no arbitrage opportunities in the market,then (Harrison and Kreps, 1979) relative prices (i.e. discounted numerarires)are martingales under risk adjusted probabilities. We recall that Riesz representation theorem allows us to make a bridgebetween pricing functions and numeraires and that di¤erent numeraires implydi¤erent probability measures and hence di¤erent expectations. If we de…ne Pas the equivalent martingale measure for numeraire pt and Q as the equivalentmartingale measure for a numeraire qt , then P pt Q qt vt = Et vT = Et vT pT qTIn this way we can move from one measure to another. If P and Q are equiva- dPlent, then there exists a function L = dQ , called likelihood function or Radon-Nikodym derivative, such that dP dPt = (t) dQt dQRadon-Nikodym derivative is also the ratio of the numeraires, hence we have Z Z Z Z pt pt dP pt pT q t qt vt = vT dPt = vT (t) dQt = vT dQt = vT dQt pT pT dQ pT pt q T qTso to change measure it is necessary to multiply by the Radon-Nikodym deriva-tive. In pricing put or call european options the numeraire is the money marketaccount but if we want to price an option on two underlying assets like the Mar-grabe one, we may choose as numeraire one of the underlying assets in order tohave a nice distribution under the new measure. We set as discounted numeraire e (t)eq2 tN (t) = S2B(t) , we change from the risk neutral measure to the new QN andafter some algebra we get " # h i S1 (t) + Q rT + QN q2 T price = E e (S1 (t) S2 (t)) = S2 (0) E e 1 S2 (t) S1Applying Ito formula to compute d S2 (t) and then Girsanov theorem to havethe distribution under the new measure we …nally get q1 T q2 T price = S1 (0) e N (d1 ) S2 (0) e N (d2 )that is the closed formula for pricing exchange options. 6
  7. 7. 4 Monte Carlo simulation and variance reduc- tion techniquesInstead of using only a closed formula to price this kind of option, we developalso a Monte Carlo simulation. Let n 1X b n := f (Xi ) n i=1be the Monte Carlo estimate of E [f (X)]. This estimate is consistent by theStrong Law of Large Numebers and it is also unbiased. Generally Monte Carlo 1has a rate of convergence O n 2 , while the error in a trapezoidal rule for d 2dimensional integrals is O n d . Hence Monte Carlo methods are attractive inevaluating integrals when d > 4. Margrabe option pricing requires to evaluatea two dimensional integral since its price can be viewed as h i ZZ + + E e rT (S1 (T ) S2 (T )) = e rT (s1 s2 ) T (s1 ; s2 ) ds1 ds2where (s1 ; s2 ) is the joint density between the two underlying assets.You cannotice that d = 2 and for this option Monte Carlo is not a so attractive method.However it is interesting to compare the price got from the closed formula withthe one given by MC estimate and analyze the con…dence interval, the absoluteerror and the convergence. To simulate the …nal payo¤ of the exchange option we have to simulate twocorrelated Wiener processes, thus we …rst simulate two independent standardnormal variates and and then we use "1 = Z1 p "2 = Z1 + 1 2Z 2to drive path. Moreover we de…ne the absolute error as jb j and the con…dence binterval as b z pn .In the next paragraphs we will describe the main steps n 2for writing a VBA and a Matlab code that compute these quantities and thenwe will show our numerical and graphical results. To improve the Monte Carloestimante we introduced also two variance reduction techniques: antithetic variate technique control variate technique The …rst one exploits the negative correlation between pair of replicationsbecause it reduces the variance of the estimation if the correlation of the pairsis negative; this method can be applied if we have a monotone function f of arandom variable Z. In our case f N (0; 1), then we sample Z1 and we setZ2 = Z1 , obtaining negative dependence. The estimate will be n 1X1 b AV = [f (Zi ) + f ( Zi )] n i=1 2 7
  8. 8. The second technique is the control variate and it consists of exploiting theinformation about the error in the estimate of known quantities to reduce theerror of the unkonwn quantities. Suppose we have the expected value of anotherfunction g of Z. We set f as the discounted payo¤ of the Margrabe option andthe control variate g as the di¤erence of the two underlying assets at maturity.Thus the control variate estimate is n 1X b CV = f (Zi ) + b [g (Zi ) E [g (Z)]] n i=1where b is chosen in such a way that it minimizes the variance of the estimator.It can be shown that the optimal parameter is given by Cov (f (Z) ; g (Z)) b = V ar (g (Z))algorithm we …rst run a fast Monte Carlo simulation to compute the covari-ance and the variance in order to get the value of b and then a Monte Carlosimulation to compute the price of the option.Part IIIThe VBA code5 Program functionalityOur assignment is divided into two parts: one entirely dedicated to the userusage and the second used only for tracking purpose and for simplifying theproduction of some speci…c plots3 . This decision is motivated by our acknowl-edge of the VBA superiority regarding the User-friendly interface and, on theother hand, of the higher power and of the higher sophistication of MatLab. Our general aim is to o¤er a good Interface to price Option (speci…cally itis provided a pricing program for Margrabe option) and a plot generator totrack down the di¤erent computation e¢ ciency techniques provided within theprogram itself. The Excel …le “Margrabe_project” is divided into three sheet: The …rst one is the Main, where there are the Print out of the Pricing procedure (in the ListBox), the two plots and the Starting Button. The second sheet, named DataSet, is a service sheet used to save the input inserted in the main UserMask to allow recalling them. It was initially used to print the result of each simulation, but in the released version this functionality has been disabled for saving time. 3 Those plots has been used mainly for the presentation, even if they will o¤er an usefulprospective to discuss about some interesting topic such as the dependency of the pricingformula to change of main input 8
  9. 9. The last sheet, named ListTypesOption, is the one used to insert the possible option type available when we call the main UserMask (both in the ComboBox and in the page name within the multipage control). This functionality allow to easily add new pricing formula section, however those sections must be …ll with controls in the code, in fact the program will automatically add just a Label warning the user. The …rst part has been produced relying on VBA and it consists on a MainMask (called “Insert Option Elements” where is requested to provide the main ),input4 by the user, and a Second Mask (called “Settings”and available from the…rst one), where the user is allowed to change both some accessory variables5and to choose the reduction techniques within the available one6 . Both themasks are available from the Button “Option Price Manual “in the “Foglio1”sheet. The user can decide two di¤erent outcomes: The Standard by clicking on the button “Pricing” it consist on printing , out into the ListBox a summary of what has been asked, if there has been any problem or wired/fuzzy outcome and the …nal output. We have chosen the ListBox instead of the Textbox since is it is easier in coding appending new line of info, depending of the pricing. The print out is divided into three/four section: 1. The …rst will communicate if something went wrong or not and then will show the closed formula price and Monte Carlo one and their absolute di¤erence 2. The second will provide some info on the Simulation 3. The third will provide the IC of the simulation 4. The fourth section is activate only if the program has revealed some fuzzy input, meaning numbers that have overcome the error checking, but might be too big. The Plot generator, by clicking on the button “Plot” that will produce , two di¤erent plot in the “Main” Sheet on the right to the ListBox, We have decided to print them in the sheet instead of creating a new sheet for each graph since we have wanted to present all the outcome in one single page, than the user can resize the plots: 1. The …rst represents the price level of the Closed Formula, the Anti- thetic, the Standard and the Control variate Technique 2. The second one represents the IC of all the pricing formula provided, we have decided to color the pair of line with the some color to ease the readability. 4 Those inputs must be express with an annual frequency 5 The risk free rate used and the number of iteration, as well as the level of con…dence 6 The program o¤ers the Antithetic and the Control Variate methods 9
  10. 10. 6 Convention used and Internal set upIn this section we will go through the code and we will o¤er a detail justi…cationand explanation. At …rst the naming convention used is to name the variableswith combination of words as clear as possible, divided with the Upper case;in some routines there are some service variables which are usually named withfuzzy or dummy name. For further details we remand to the comments on thecode, where each functionality has been described7 . There are some functionsthat are not needed any more in the released version, but we have decided toleave them to allow the professor to track how we have built the program. Thesefunctions are mainly in the module “Output_Sheet” which has been used to ,print in the spreadsheet the simulation results. The VBA code is divided into di¤erent modules; when describes their fea-tures I’ group them into categories and I’ de…ne them in the subsequent ll llsubtitle:6.1 Error handlerAs a preliminary introduction we will spend some words on the general frame-work: since the program is structured as a cascade we have preferred to putall the error check at the highest level, which is when the user is inserting therequired input. This procedure has been done in the “ErrorControl” module,where there are four routines, two for each mask. Those routine share the same structure the …rst dealt with the “type” ofinput insert, meaning will check if the input is a number while the second willcheck that the input is inside an acceptable range. Those routines will handlethe correction procedure as well. Note that we have created a sort of loop bycalling each of the routines by themselves to ensure that the program is able tosolve any problems till its …nal solution. The …rst task is performed with the trick: to force the program to convertthe input into a number together with the function “on error goto” In case of .error we have used a dummy variable “count”to control where the error has happened, so that to properly informthe user what went wrong and how the program is expecting to receive data.The second task is structured as the …rst one. Note that there are other errorhandlers in some secondary routine to check for any residual problem. This twosteps approach should grant the maximum consistency to the program.6.2 Output CodingThis section is about the ListBox …ll-in and the Sheet anchorage. The ListBoxmodule is divided into two routines, the …rst is the main one and it dealt withthe …rst three outputs as described in the introduction, while the second dealt 7 As …nal remark the code has been written with the 2010 Excel version, we have checkedfor compatibility issues with older version, however for any function/runtime problem pleasecontact: giulio.laudani@fastwebnet.it 10
  11. 11. with the accessory forth point. We have tried to use String variable as cleareras possible. In fact the Variable Output has been …lled in separately from theListBox …ll-in loop. Besides this main string we have created two other of them“AddIn” and “MyString” which are used to de…ne the clock functionality and ,the variance reduction technique used. The second routine dealt with any possible fuzzy inputs meaning those inputsthat are in the acceptance region, but too big relative to the other variable,suggesting a possible typo. In this version we have decided to control just for thetime and volatility variable, but it might be extended with more sophisticatedalgorithms. Note that in this case the output variable instead of being predeterminate, it is …lled up case by case and contextually used to …ll-in theListBox.6.3 Plot codingIn this module there are all the routines needed to transform array into series8and the setup of the two plots, meaning the placement in the spreadsheet andother secondary features. There are two plot generators, very similar in the structure, although the…rst one (“PlotCV” is more sophisticated9 in one way, it has a max and min in )the “y” axis speci…cally de…ned to increase the series visibility. As mentionedin the comment in the VBA code the need of two functions to convert thearray into series depends on the di¤erent format of the incoming input, one isa Double while the other is Variant. This di¤erence is due to the di¤erent needfor storing information from the function “PricingForPlot” and “ICForPlot” ,we will discuss about this later on. The last routine has been registered, that’ why it is longer than needed, we shaven’ modi…ed it since we want to show that some task are better and quickly tperformed without spending tons of time in coding, what matter is just the …nalresult. Furthermore we have disabled some of the functionality since they arenot compatible with older VBA version.6.4 Pricing formulaIn this module there are both the pricing formula need to produce the ListBoxOutcome and the Plot one. The …rst task is quite straight forward: We have use the “select case” structure to manage the possible outcome and the Monte Carlo simulation tools are the one presented in the class or in the lab. We have initialized the simulation with the function Randomize 8 Since the Excel plot function need those kind of format to work 9 The"PlotCV” has two variables more than the “PlotIC”, that are the max and mincomputed form the original array containing the series 11
  12. 12. We have used the Static10 function Clock to track the simulation duration. The function precision is up to seconds The payo¤ for each cycle has been saved in an array “payo¤()” that is re-sized at inception Note that the function “MC_MargrabeOption” is set as variant since we need to pass more than one set of results, speci…cally two: the price and the variance needed to compute the IC in later stage. The second task is achieved using two routine: the …rst to compute the priceand equivalent variance, while the second will compute the IC using the resultsof the …rst function. It is important to point out that the function output is nota matrix, but a sort of box with two di¤erent elements: the …rst is the matrixwith all the price level, the other the equivalent variance matrix11 .6.5 Mask FeatureWe create two speci…c modules one for each user mask to ease the readabilityof the program. In those modules we have inserted all the anchorage and openfeatures, meaning the default value, if any, and the style for each Textbox.However most of the mask functions have been inserted inside the mask itself.Both the UserMask, as mentioned early, have lots of code to deal with somespeci…c event, such as the selection of a Textbox to grant to erase all the numbersalready …lled-in to ease their change or to deal with the exit event to ensurethat the input format is always the correct one. Some further details on themain User mask: The Multipage control is linked with the Combobox, in fact it is possible to change the page both by clicking in the ComboBox menu or on the Multipage Page controls We have created a speci…c program to add to any new pages, which are not de…ned by the programmer, a new Label warning the user. Just few world on the Checkbox in the “UserMask” which is the main one. ,This command allows to price the option with inverted Stock. We have thoughtthat it may be useful to add this functionality. 1 0 The type static was needed to save the starting point and make the di¤erence with theending value when call back 1 1 We pointed out this di¤erence because when we will call the resulting matrix we need touse the notation “answer(0) (. . . )” or “answer(1)(. . . )” depending on which elements we wantto use and within that element which speci…c value we need 12
  13. 13. Part IVGraphs and resultsWe performed a Monte Carlo (MC) simulation of the price of the Margrabeoption and compared it to the closed formula price. We repeated the processinputting an increasing number of simulations parameter (n) and obtained theerror of our MC simulation as a function of n. We did this for a standard MonteCarlo simulation, for a MC simulation with Antithetic Variates and for a MCSimulation with Control Variates. As you can see from …gure [MC001], the Control Variate MC has the lowestlevel of standard error at all levels of n. Also, after roughly 200 thousand simu-lations the error stabilizes around its “structural”value. As the theory suggests,the Antithetic Variates and the standard MC simulations are respectively thesecond and third best techniques. Note how the result is neatly plotted in thegraph, with standard MC error dominating Antithetic Variates at all levels ofn. Effects of variance reduction tecniques 0.7 0.6 Standard MC Control Variates MC 0.5 Antithetic Variates MC 0.4 Sam ple variance 0.3 0.2 0.1 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 Number of simulations 5 x 10 In …gure [MC002], we plotted the actual closed formula price and the sim-ulated price as a function of n. As previously pointed out, the error clearlystabilizes around two hundred thousand simulations. 13
  14. 14. Confidence Interval at 95% converges to closed formula price 12 11.5 11 10.5 P rice 10 9.5 9 8.5 8 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 Number of simulations x 10 5Part VReferences Arbitrage theory in continuous time; Bjork T.; Oxford University Press, New York, 3rd ed., 2009 Interest rate modelling; James J., Webber N.; Wiley, Chichester, 2000 Martingales and arbitrage in multiperiod securities markets; Harrison J.M., Kreps D.M., Journal of Economic Theory, 1979 Monte Carlo methods in …nancial engineering; Glasserman P.; Springer, New York, 2003 Numerical methods in …nance and economics; Brandimarte P.; Wiley, Hoboken, 2006 Options, futures and other derivatives; Hull J.C.; Pearson International, Upper Suddle River, 2006 The value of an option to exchange one asset for another; Margrabe W.; The Journal of Finance, vol XXXIII, March 1978 14

×