Skip to main content
1 of 3
Alexey Golyshev
  • 9.6k
  • 2
  • 27
  • 58

I also use Mathematica for calculating derivatives prices. As I understand FinancialDerivative[(*option params*),"GridSize"->{}] is equivalent to Finite Differences method. And FinancialDerivative[(*option params*), "Paths"->] is equivalent to Monte-Carlo method. By default Mathematica chooses optimal method depending of option type and time to expiration.

Also I think it may be interesting that naive realization of Black-Sholes can be 16X faster. An example for the case with rate = 0:

call[strike_, spot_, time_, vola_] := Module[
  {
   d1 = (Log[spot/strike] + vola^2/2*time/365)/(vola*Sqrt[time/365]),
   d2 = (Log[spot/strike] - vola^2/2*time/365)/(vola*Sqrt[time/365]),
   cdf = .5 Erfc[-#/Sqrt[2]] &,
   dtcdf = Exp[-#^2/2]/Sqrt[2*Pi] &
   },
  {
   spot*cdf[d1] - strike*cdf[d2],
   (*delta*)cdf[d1],
   (*gamma*)dtcdf[d1]/(spot*vola*Sqrt[time/365]),
   (*vega*)spot*dtcdf[d1]*Sqrt[time/365]/100,
   (*theta*)-spot*dtcdf[d1]*vola/(2*Sqrt[time/365])/365
   }
  ]

put[strike_, spot_, time_, vola_] := Module[
  {
   d1 = (Log[spot/strike] + vola^2/2*time/365)/(vola*Sqrt[time/365]),
   d2 = (Log[spot/strike] - vola^2/2*time/365)/(vola*Sqrt[time/365]),
   cdf = .5 Erfc[-#/Sqrt[2]] &,
   dtcdf = Exp[-#^2/2]/Sqrt[2*Pi] &
   },
  {
   strike*cdf[-d2] - spot*cdf[-d1],
   (*delta*)cdf[d1] - 1,
   (*gamma*)dtcdf[d1]/(spot*vola*Sqrt[time/365]),
   (*vega*)spot*dtcdf[d1]*Sqrt[time/365]/100,
   (*theta*)-spot*dtcdf[d1]*vola/(2*Sqrt[time/365])/365
   }
  ]
Alexey Golyshev
  • 9.6k
  • 2
  • 27
  • 58