Posted by
Toyin Akin-4 on
URL: http://quantlib.414.s1.nabble.com/Least-Square-Monte-Carlo-tp2617p2623.html
Hi all,
As there are quite a few requests for this already here is the VB code of
the SABR model, extracted from the SABR FORUM on the wilmott site.
I have also adding a "what is a SWAP?" link on the web site so that users
can have a better idea of what and how this contract and it's various
derivatives are used for.
############################################################################
#######
Public Function sabr(alpha As Double, forward As Double, k As
Double, beta As Double, volvol As Double, rho As Double, time As Double) As
Double
'// sabr model from Managing Smile Risk by Patrick Hagan,
Deep Kumar, Andrew Lesniewski and Diana Woodward
' This will return vols which can be used in Black Scholes
formula
'alpha=volatility, volvol controls smile, rho controls skew
Dim sabr1 As Double, sabr2 As Double, sabr3 As Double, sabrz
As Double, sabrxofz As Double
Dim a1 As Double, a2 As Double, a3 As Double, a4 As Double
a1 = (volvol / alpha)
a2 = (forward * k)
a3 = (1 - beta)
sabrz = a1 * a2 ^ (a3 / 2) * WorksheetFunction.Ln(forward /
k)
sabrxofz = WorksheetFunction.Ln(((1 - 2 * rho * sabrz +
sabrz ^ 2) ^ 0.5 + sabrz - rho) / (1 - rho))
sabr1 = alpha / (forward * k) ^ (a3 / 2) * (1 + ((a3 ^ 2) /
24) * (WorksheetFunction.Ln(forward / k) ^ 2) + ((1 - beta) ^ 4 / 1920) *
(WorksheetFunction.Ln(forward / k) ^ 4))
sabr2 = sabrz / sabrxofz
sabr3 = 1 + (((a3 ^ 2 / 24) * alpha ^ 2 / (forward * k) ^
a3) + 0.25 * rho * beta * volvol * alpha / ((forward * k) ^ a3 / 2) + (2 - 3
* rho ^ 2) * volvol ^ 2 / 24) * time
sabr = sabr1 * sabr2 * sabr3
End Function
############################################################################
###########
I have not modified it and take no responsibility as to it's accuracy.
Best Regards,
Toyin Akin.
----- Original Message -----
From: "Sad" <
[hidden email]>
To: <
[hidden email]>
Sent: Thursday, July 24, 2003 7:57 AM
Subject: Re: [Quantlib-users] CapeTools.net web site containing QuantLib
based calculations
> Hi Toyin,
>
> > The initial result is hosted at : www.capetools.net, and for now this is
> > simply a hobby project!!
>
> Wonderful! QuantLib definitely needed this kind of online "demo"
application.
>
> Thanks a lot for this great work,
> Sad
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET sites including
> Data Reports, E-commerce, Portals, and Forums are available now.
> Download today and enter to win an XBOX or Visual Studio .NET.
>
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01> _______________________________________________
> Quantlib-users mailing list
>
[hidden email]
>
https://lists.sourceforge.net/lists/listinfo/quantlib-users