Mathematica 8 – FinancialDerivative American options issue

Again while testing my routines (Java code to implement the binomial tree to price American options) I came across an issue with the FinancialDerivative command of Mathematica 8 (I am working with the linux version). The default algorithm chosen by Mathematica for American style options seem to converge to a wrong result. To get the correct result  one must manually set the option  “Method” -> “Binomial”. As a simple example of the issue I post here the code to compute the price of a European and American call option with zero dividends. The two prices should be the same in this case. Here what I get instead:

In[1]:= $Version
Out[1]= "8.0 for Linux x86 (32-bit) (October 10, 2011)"

In[2]:= FinancialDerivative[{"American", "Call"}, {"StrikePrice" -> 110.00, "Expiration" -> 1},  {"InterestRate" -> 0.08, "Volatility" -> 0.,"CurrentPrice" -> 100, "Dividend" -> 0.0}]

Out[2]= 7.10517

In[3]:= FinancialDerivative[{"European","Call"}, {"StrikePrice" -> 110.00,"Expiration" -> 1},  {"InterestRate" -> 0.08, "Volatility" -> 0.2,"CurrentPrice" -> 100, "Dividend" -> 0.0}]

Out[3]= 7.27904

the two results are different. To get the correct price also for the American option try this

In[4]:= FinancialDerivative[{"American","Call"}, {"StrikePrice" -> 110.00,Expiration" -> 1},  {"InterestRate" -> 0.08, "Volatility" -> 0.2,"CurrentPrice" -> 100, "Dividend" -> 0.0}, "Method" -> "Binomial"]

Out[4]= 7.27904

I reported the issue to Wolfram support also asking what is the default method for American options and how to get the full list of available methods. By now I just received a short answer saying

[…] I have
forwarded your example to our developers so that they can take a look into
this and resolve the issue for a future version of Mathematica.

so let’s hope that this will be fixed in Mathematica v9. If I will get more information I’ll modify the post, by now just use the Binomial method to get the correct price for American options.


Wanna be a quant: job interview books reviews

Just updated my Books page with a few lines of review about some popular “Quant job interviews” books.

Well written and useful, as the other Joshi’s books. Many non-trivial questions and original solutions. Interesting and unusual the section about C++ programming.
The classic reference for quant job interviews. On top of the probability-statistics and math finance problems, there is big section on “brainteasers” (I don’t like them…) and a chapter on non-technical questions.
A more mathematical tone with respect the other interview books. Even the brainteasers are non-irritating. Each section of questions is introduced by a quick and clever review of the math that should be used to solve the problems.
Different from all the other interviews books: the FAQ are a good opportunity to jump through different interesting topics. The answers and the references given in the book are the starting point for a further study.

Mathematica v8 – Linux 32-bit – FinancialDerivative issues

– fixed in Mathematica 9 –

Some problems with FinancialDerivative in Mathematica 8? Wait for v9 (should be released in a couple of months) or try the the Finance Platform.

While testing my app European Options, I used as a cross-check the excellent FinancialDerivative function of Mathematica 8. FinancialDerivative gives price and greeks for a wide choice of financial products, European and American style. Nevertheless at some point I came across some problems:

    • For the “Out” BarrierOptions the “Rebate” term is not implemented. So you get the following wrong result by typing
      In[2]:= FinancialDerivative[{"BarrierUpOut", "European",
        "Call"}, {"StrikePrice" -> 110.00, "Expiration" -> 0.5,
        "Barrier" -> 105, "Rebate" -> 3}, {"InterestRate" -> 0.08,
        "Volatility" -> 0.25, "CurrentPrice" -> 100,
        "Dividend" -> 0.04}, {"Value", "Greeks"}]
      Out[2]= {0., {"Delta" -> 0., "Gamma" -> 0., "Rho" -> 0.,
        "Theta" -> 0., "Vega" -> 0.}}

      Which is correct with a zero rebate, while in this case the correct result should be

    • The “Gamma” (the sensitivity of Delta with respect the spot price) for all the financial products I tested so far is surprisingly inaccurate. As an example I show here what we get for simple vanilla call and put for which it easily derived by call-put paritythat the Gamma should be the same.
      In[3]:= FinancialDerivative[{"Vanilla", "European",
        "Put"}, {"StrikePrice" -> 110.00,
        "Expiration" -> 0.5}, {"InterestRate" -> 0.08, "Volatility" -> 0.25,
         "CurrentPrice" -> 100, "Dividend" -> 0.04}, {"Value", "Greeks"}]
      Out[3]= {11.6465, {"Delta" -> -0.619661, "Gamma" -> 0.020876,
        "Rho" -> -36.8063, "Theta" -> -3.11937, "Vega" -> 26.1189}}
      In[4]:= FinancialDerivative[{"Vanilla", "European",
        "Call"}, {"StrikePrice" -> 110.00,
        "Expiration" -> 0.5}, {"InterestRate" -> 0.08, "Volatility" -> 0.25,
         "CurrentPrice" -> 100, "Dividend" -> 0.04}, {"Value", "Greeks"}]
      Out[4]= {3.97952, {"Delta" -> 0.360538, "Gamma" -> 0.0208805,
        "Rho" -> 16.0371, "Theta" -> -7.65352, "Vega" -> 26.1189}}

      The two Gamma are different from each other and different from the correct result which is in this case Gamma = 0.0208952.

I reported the bug to the Wolphram Support and after few days I received a first answer. The guy at support was very kind, but told me that the problem was not showing up on his version (Windows and Finance Platform). After a few try the final answer has been the following:
Hi Stefano

I have carried out the same evaluations as you mentioned for FinancialDerivative for BarrierDownOut and BarrierUpOut options under Linux and have been able to replicate your problems. Thank you for bringing this to our attention. It has now been fixed for version 9 of Mathematica which will be released in a couple of months. Also the problems with the inaccuracy of Gamma were not showing up in my version because I was running it on the Finance Platform, which had fixed that bug. All these errors have been resolved in version 9 of Mathematica. Thanks again for sending in your emails about this as they help to improve our product.

So… keep waiting for v9.

– fixed in Mathematica 9 –


Pricing on Trees notes

Just added to the Notes page a few pages about option pricing on trees. We explicitly show the equivalence of replicating, hedging or using a risk-neutral approach to price options on a binomial tree. A Mathematica implementation of binomial and trinomial tree will be added soon, with discussion on convergence issues.

European Options on Google Play

Just uploaded to the market European Options:

Easily compute price and greeks of european-style option derivatives. European Options is an handy app to compute price and greeks of Vanilla, Digital and Barrier european-style options (for definitions we refer to the standard book “Hull – Options, futures and other derivatives”). It is planned to add more exotic options. Price and greeks are computed via analytical formulas.

The source code is available at my GitHub repo.

Get it on Google Play

European options App – source code

Pushed to my GitHub repo a first version of European Options: an handy Android app which computes price and greeks for Vanilla, Digital and Barrier european-style options. Basically it is the Java translation of some of the C++ code I wrote this summer following Joshi books. In a few days I will upload to the market the app.