public SABRInterpolation(List <double> xBegin, // x = strikes
                                 int xEnd,
                                 List <double> yBegin, // y = volatilities
                                 double t,             // option expiry
                                 double forward,
                                 double?alpha,
                                 double?beta,
                                 double?nu,
                                 double?rho,
                                 bool alphaIsFixed,
                                 bool betaIsFixed,
                                 bool nuIsFixed,
                                 bool rhoIsFixed,
                                 bool vegaWeighted            = true,
                                 EndCriteria endCriteria      = null,
                                 OptimizationMethod optMethod = null,
                                 double errorAccept           = 0.0020,
                                 bool useMaxError             = false,
                                 int maxGuesses = 50,
                                 double shift   = 0.0,
                                 VolatilityType volatilityType             = VolatilityType.ShiftedLognormal,
                                 SabrApproximationModel approximationModel = SabrApproximationModel.Hagan2002)
        {
            List <double?> addParams = new List <double?>();

            addParams.Add(shift);
            addParams.Add(volatilityType == VolatilityType.ShiftedLognormal ? 0.0 : 1.0);
            addParams.Add((double?)approximationModel);

            impl_ = new XABRInterpolationImpl <SABRSpecs>(
                xBegin, xEnd, yBegin, t, forward,
                new List <double?>()
            {
                alpha, beta, nu, rho
            },
                //boost::assign::list_of(alpha)(beta)(nu)(rho),
                new List <bool>()
            {
                alphaIsFixed, betaIsFixed, nuIsFixed, rhoIsFixed
            },
                //boost::assign::list_of(alphaIsFixed)(betaIsFixed)(nuIsFixed)(rhoIsFixed),
                vegaWeighted, endCriteria, optMethod, errorAccept, useMaxError,
                maxGuesses, addParams);
            coeffs_ = (impl_ as XABRInterpolationImpl <SABRSpecs>).coeff_;
        }
示例#2
0
 public SviInterpolation(List <double> xBegin, // x = strikes
                         int size,
                         List <double> yBegin, // y = volatilities
                         double t,             // option expiry
                         double forward,
                         double?a,
                         double?b,
                         double?sigma,
                         double?rho,
                         double?m,
                         bool aIsFixed,
                         bool bIsFixed,
                         bool sigmaIsFixed,
                         bool rhoIsFixed,
                         bool mIsFixed, bool vegaWeighted = true,
                         EndCriteria endCriteria          = null,
                         OptimizationMethod optMethod     = null,
                         double errorAccept       = 0.0020,
                         bool useMaxError         = false,
                         int maxGuesses           = 50,
                         List <double?> addParams = null)
 {
     impl_ = new XABRInterpolationImpl <SVISpecs>(
         xBegin, size, yBegin, t, forward,
         new List <double?>()
     {
         a, b, sigma, rho, m
     },
         new List <bool>()
     {
         aIsFixed, bIsFixed, sigmaIsFixed, rhoIsFixed, mIsFixed
     },
         vegaWeighted, endCriteria, optMethod, errorAccept, useMaxError,
         maxGuesses, addParams);
     coeffs_ = (impl_ as XABRInterpolationImpl <SVISpecs>).coeff_;
 }
示例#3
0
 public XABRError(XABRInterpolationImpl <Model> xabr)
 {
     xabr_ = xabr;
 }