Group Abstract Group Abstract

Message Boards Message Boards

0
|
12.3K Views
|
7 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Avoid problems with a triple integration? (Pricing of exotic options)

Posted 9 years ago

Hi,

I'm a new user of Mathematica and I'm writing a thesis on financial models to price options. I'm currently trying to calculate a triple integral in order to price an exotic call european option (basket option) on a basket of 3 financial assets (S1,S2 and S3) with weights of w1, w2 and w3. So my basket is w1.S1+w2.S2+w3.S3. Here is the formula :enter image description here

And this is the code that I tried (attached), but it finds a price that makes no sense... (with Rf the risk free rate, dt the maturity, n the number of assets, Sigma1 the volatility of the 1st asset, K the strike of my option, ?T.? = VCV the variance-covariance 3x3 matrix of the assets)

Thank you for your help ! Best regards, Nicolas

Attachments:
POSTED BY: Nicolas BADUEL
7 Replies
Posted 9 years ago

Thanks a lot Emerson, it works just fine !

POSTED BY: Nicolas BADUEL
Attachments:
POSTED BY: Emerson Willard
Posted 9 years ago
POSTED BY: Nicolas BADUEL
POSTED BY: Daniel Lichtblau
Posted 9 years ago

Hi, sorry about the rules, here is my code (i hope the format is okay now). Please find also attached the two excel files I used in the code (Omega and InvOmegaTOmega)

Rf = 0.0092

0.0092

dt = 0.25

0.25

n = 3

3

w1 = 1/3

1/3

w2 = 1/3

1/3

w3 = 1/3

1/3

S1 = 5101.11

5101.11

S2 = 2343.06

2343.06

S3 = 18552.61

18552.6

Sigma1 = 5.05615635/100

0.0505616

Sigma2 = 18.18926835/100

0.181893

Sigma3 = 15.25262228/100

0.152526

s1 = Import[
  "/Users/nicolasbaduel/Documents/Wolfram Mathematica/Omega.xlsx"]

{{{0.0506, 0.130786, 0.06893}, {0., 0.126422, 0.0671455}, {0., 0., 
   0.118306}}}

s1 = Import[
  "/Users/nicolasbaduel/Documents/Wolfram Mathematica/Omega.xlsx", \
{"Data", 1, {1, 2, 3}}]

{{0.0506, 0.130786, 0.06893}, {0., 0.126422, 0.0671455}, {0., 0., 
  0.118306}}

s2 = Import[
  "/Users/nicolasbaduel/Documents/Wolfram \
Mathematica/InvOmegaTOmega.xlsx", {"Data", 1, {1, 2, 3}}]

{{808.576, -162.12, 0.752924}, {-162.12, 
  82.7225, -37.947}, {0.752924, -37.947, 71.447}}

Omega = s1

{{0.0506, 0.130786, 0.06893}, {0., 0.126422, 0.0671455}, {0., 0., 
  0.118306}}

InvOmegaTOmega = s2


{{808.576, -162.12, 0.752924}, {-162.12, 
  82.7225, -37.947}, {0.752924, -37.947, 71.447}}

Omega

{{0.0506, 0.130786, 0.06893}, {0., 0.126422, 0.0671455}, {0., 0., 
  0.118306}}

Zeta1 = Log[x1/(w1*S1)] - (Rf - ((Sigma1)^2)/2)*dt

-0.00198044 + Log[0.000588107 x1]

Zeta2 = Log[x2/(w2*S2)] - (Rf - ((Sigma2)^2)/2)*dt

0.00183562 + Log[0.00128038 x2]

Zeta3 = Log[x3/(w3*S3)] - (Rf - ((Sigma3)^2)/2)*dt

0.000608031 + Log[0.000161702 x3]

VectZeta = {{Zeta1}, {Zeta2}, {Zeta3}};

K = 8665.59

8665.59



Transpose[VectZeta].InvOmegaTOmega.VectZeta

{{(0.00183562 + 
      Log[0.00128038 x2]) (-162.12 (-0.00198044 + 
         Log[0.000588107 x1]) + 
      82.7225 (0.00183562 + Log[0.00128038 x2]) - 
      37.947 (0.000608031 + Log[0.000161702 x3])) + (-0.00198044 + 
      Log[0.000588107 x1]) (808.576 (-0.00198044 + 
         Log[0.000588107 x1]) - 
      162.12 (0.00183562 + Log[0.00128038 x2]) + 
      0.752924 (0.000608031 + Log[0.000161702 x3])) + (0.000608031 + 
      Log[
       0.000161702 x3]) (0.752924 (-0.00198044 + 
         Log[0.000588107 x1]) - 
      37.947 (0.00183562 + Log[0.00128038 x2]) + 
      71.447 (0.000608031 + Log[0.000161702 x3]))}}



g := Function[{x1, x2, x3}, 
  Max[x1 + x2 + x3 - K, 
    0]*((Exp[(-0.5/dt)*(0.00183562 + 
           Log[0.00128038 x2]) (-162.12 (-0.00198044 + 
              Log[0.000588107 x1]) + 
           82.7225 (0.00183562 + Log[0.00128038 x2]) - 
           37.947 (0.000608031 + 
              Log[0.000161702 x3])) + (-0.00198044 + 
           Log[0.000588107 x1]) (808.576 (-0.00198044 + 
              Log[0.000588107 x1]) - 
           162.12 (0.00183562 + Log[0.00128038 x2]) + 
           0.752924 (0.000608031 + 
              Log[0.000161702 x3])) + (0.000608031 + 
           Log[0.000161702 x3]) (0.752924 (-0.00198044 + 
              Log[0.000588107 x1]) - 
           37.947 (0.00183562 + Log[0.00128038 x2]) + 
           71.447 (0.000608031 + Log[0.000161702 x3]))])/(Omega[[1, 
        1]] Omega[[2, 2]] Omega[[3, 3]]*x1*x2*x3*((2*Pi*dt)^(n/2))))]

NIntegrate[
 g[x1, x2, x3], {x1, 0, Infinity}, {x2, 0, Infinity}, {x3, 0, 
  Infinity}]

3.570889416597262*10^300946
Attachments:
POSTED BY: Nicolas BADUEL
POSTED BY: EDITORIAL BOARD

I'm not able to run that notebook (n access to the xlsx files).

POSTED BY: Daniel Lichtblau
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard