Exemple #1
0
 public OptionletStripper1(CapFloorTermVolSurface parVolSurface, IborIndex index) : this(NQuantLibcPINVOKE.new_OptionletStripper1__SWIG_7(CapFloorTermVolSurface.getCPtr(parVolSurface), IborIndex.getCPtr(index)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemple #2
0
 public OptionletStripper1(CapFloorTermVolSurface parVolSurface, IborIndex index, double switchStrikes, double accuracy) : this(NQuantLibcPINVOKE.new_OptionletStripper1__SWIG_5(CapFloorTermVolSurface.getCPtr(parVolSurface), IborIndex.getCPtr(index), switchStrikes, accuracy), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemple #3
0
 public OptionletStripper1(CapFloorTermVolSurface parVolSurface, IborIndex index, double switchStrikes, double accuracy, uint maxIter, YieldTermStructureHandle discount) : this(NQuantLibcPINVOKE.new_OptionletStripper1__SWIG_3(CapFloorTermVolSurface.getCPtr(parVolSurface), IborIndex.getCPtr(index), switchStrikes, accuracy, maxIter, YieldTermStructureHandle.getCPtr(discount)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemple #4
0
            public void setCapFloorTermVolSurface()
            {
                setTermStructure();

                //cap volatility smile matrix
                optionTenors = new List <Period>();
                optionTenors.Add(new Period(1, TimeUnit.Years));
                optionTenors.Add(new Period(18, TimeUnit.Months));
                optionTenors.Add(new Period(2, TimeUnit.Years));
                optionTenors.Add(new Period(3, TimeUnit.Years));
                optionTenors.Add(new Period(4, TimeUnit.Years));
                optionTenors.Add(new Period(5, TimeUnit.Years));
                optionTenors.Add(new Period(6, TimeUnit.Years));
                optionTenors.Add(new Period(7, TimeUnit.Years));
                optionTenors.Add(new Period(8, TimeUnit.Years));
                optionTenors.Add(new Period(9, TimeUnit.Years));
                optionTenors.Add(new Period(10, TimeUnit.Years));
                optionTenors.Add(new Period(12, TimeUnit.Years));
                optionTenors.Add(new Period(15, TimeUnit.Years));
                optionTenors.Add(new Period(20, TimeUnit.Years));
                optionTenors.Add(new Period(25, TimeUnit.Years));
                optionTenors.Add(new Period(30, TimeUnit.Years));

                strikes = new List <double>();
                strikes.Add(0.015);
                strikes.Add(0.0175);
                strikes.Add(0.02);
                strikes.Add(0.0225);
                strikes.Add(0.025);
                strikes.Add(0.03);
                strikes.Add(0.035);
                strikes.Add(0.04);
                strikes.Add(0.05);
                strikes.Add(0.06);
                strikes.Add(0.07);
                strikes.Add(0.08);
                strikes.Add(0.1);

                termV        = new Matrix(optionTenors.Count, strikes.Count);
                termV[0, 0]  = 0.287;  termV[0, 1] = 0.274;  termV[0, 2] = 0.256;  termV[0, 3] = 0.245;  termV[0, 4] = 0.227;  termV[0, 5] = 0.148;  termV[0, 6] = 0.096;  termV[0, 7] = 0.09;   termV[0, 8] = 0.11;   termV[0, 9] = 0.139;  termV[0, 10] = 0.166;  termV[0, 11] = 0.19;   termV[0, 12] = 0.214;
                termV[1, 0]  = 0.303;  termV[1, 1] = 0.258;  termV[1, 2] = 0.22;   termV[1, 3] = 0.203;  termV[1, 4] = 0.19;   termV[1, 5] = 0.153;  termV[1, 6] = 0.126;  termV[1, 7] = 0.118;  termV[1, 8] = 0.147;  termV[1, 9] = 0.165;  termV[1, 10] = 0.18;   termV[1, 11] = 0.192;  termV[1, 12] = 0.212;
                termV[2, 0]  = 0.303;  termV[2, 1] = 0.257;  termV[2, 2] = 0.216;  termV[2, 3] = 0.196;  termV[2, 4] = 0.182;  termV[2, 5] = 0.154;  termV[2, 6] = 0.134;  termV[2, 7] = 0.127;  termV[2, 8] = 0.149;  termV[2, 9] = 0.166;  termV[2, 10] = 0.18;   termV[2, 11] = 0.192;  termV[2, 12] = 0.212;
                termV[3, 0]  = 0.305;  termV[3, 1] = 0.266;  termV[3, 2] = 0.226;  termV[3, 3] = 0.203;  termV[3, 4] = 0.19;   termV[3, 5] = 0.167;  termV[3, 6] = 0.151;  termV[3, 7] = 0.144;  termV[3, 8] = 0.16;   termV[3, 9] = 0.172;  termV[3, 10] = 0.183;  termV[3, 11] = 0.193;  termV[3, 12] = 0.209;
                termV[4, 0]  = 0.294;  termV[4, 1] = 0.261;  termV[4, 2] = 0.216;  termV[4, 3] = 0.201;  termV[4, 4] = 0.19;   termV[4, 5] = 0.171;  termV[4, 6] = 0.158;  termV[4, 7] = 0.151;  termV[4, 8] = 0.163;  termV[4, 9] = 0.172;  termV[4, 10] = 0.181;  termV[4, 11] = 0.188;  termV[4, 12] = 0.201;
                termV[5, 0]  = 0.276;  termV[5, 1] = 0.248;  termV[5, 2] = 0.212;  termV[5, 3] = 0.199;  termV[5, 4] = 0.189;  termV[5, 5] = 0.172;  termV[5, 6] = 0.16;   termV[5, 7] = 0.155;  termV[5, 8] = 0.162;  termV[5, 9] = 0.17;   termV[5, 10] = 0.177;  termV[5, 11] = 0.183;  termV[5, 12] = 0.195;
                termV[6, 0]  = 0.26;   termV[6, 1] = 0.237;  termV[6, 2] = 0.21;   termV[6, 3] = 0.198;  termV[6, 4] = 0.188;  termV[6, 5] = 0.172;  termV[6, 6] = 0.161;  termV[6, 7] = 0.156;  termV[6, 8] = 0.161;  termV[6, 9] = 0.167;  termV[6, 10] = 0.173;  termV[6, 11] = 0.179;  termV[6, 12] = 0.19;
                termV[7, 0]  = 0.25;   termV[7, 1] = 0.231;  termV[7, 2] = 0.208;  termV[7, 3] = 0.196;  termV[7, 4] = 0.187;  termV[7, 5] = 0.172;  termV[7, 6] = 0.162;  termV[7, 7] = 0.156;  termV[7, 8] = 0.16;   termV[7, 9] = 0.165;  termV[7, 10] = 0.17;   termV[7, 11] = 0.175;  termV[7, 12] = 0.185;
                termV[8, 0]  = 0.244;  termV[8, 1] = 0.226;  termV[8, 2] = 0.206;  termV[8, 3] = 0.195;  termV[8, 4] = 0.186;  termV[8, 5] = 0.171;  termV[8, 6] = 0.161;  termV[8, 7] = 0.156;  termV[8, 8] = 0.158;  termV[8, 9] = 0.162;  termV[8, 10] = 0.166;  termV[8, 11] = 0.171;  termV[8, 12] = 0.18;
                termV[9, 0]  = 0.239;  termV[9, 1] = 0.222;  termV[9, 2] = 0.204;  termV[9, 3] = 0.193;  termV[9, 4] = 0.185;  termV[9, 5] = 0.17;   termV[9, 6] = 0.16;   termV[9, 7] = 0.155;  termV[9, 8] = 0.156;  termV[9, 9] = 0.159;  termV[9, 10] = 0.163;  termV[9, 11] = 0.168;  termV[9, 12] = 0.177;
                termV[10, 0] = 0.235; termV[10, 1] = 0.219; termV[10, 2] = 0.202; termV[10, 3] = 0.192; termV[10, 4] = 0.183; termV[10, 5] = 0.169; termV[10, 6] = 0.159; termV[10, 7] = 0.154; termV[10, 8] = 0.154; termV[10, 9] = 0.156; termV[10, 10] = 0.16;  termV[10, 11] = 0.164; termV[10, 12] = 0.173;
                termV[11, 0] = 0.227; termV[11, 1] = 0.212; termV[11, 2] = 0.197; termV[11, 3] = 0.187; termV[11, 4] = 0.179; termV[11, 5] = 0.166; termV[11, 6] = 0.156; termV[11, 7] = 0.151; termV[11, 8] = 0.149; termV[11, 9] = 0.15;  termV[11, 10] = 0.153; termV[11, 11] = 0.157; termV[11, 12] = 0.165;
                termV[12, 0] = 0.22;  termV[12, 1] = 0.206; termV[12, 2] = 0.192; termV[12, 3] = 0.183; termV[12, 4] = 0.175; termV[12, 5] = 0.162; termV[12, 6] = 0.153; termV[12, 7] = 0.147; termV[12, 8] = 0.144; termV[12, 9] = 0.144; termV[12, 10] = 0.147; termV[12, 11] = 0.151; termV[12, 12] = 0.158;
                termV[13, 0] = 0.211; termV[13, 1] = 0.197; termV[13, 2] = 0.185; termV[13, 3] = 0.176; termV[13, 4] = 0.168; termV[13, 5] = 0.156; termV[13, 6] = 0.147; termV[13, 7] = 0.142; termV[13, 8] = 0.138; termV[13, 9] = 0.138; termV[13, 10] = 0.14;  termV[13, 11] = 0.144; termV[13, 12] = 0.151;
                termV[14, 0] = 0.204; termV[14, 1] = 0.192; termV[14, 2] = 0.18;  termV[14, 3] = 0.171; termV[14, 4] = 0.164; termV[14, 5] = 0.152; termV[14, 6] = 0.143; termV[14, 7] = 0.138; termV[14, 8] = 0.134; termV[14, 9] = 0.134; termV[14, 10] = 0.137; termV[14, 11] = 0.14;  termV[14, 12] = 0.148;
                termV[15, 0] = 0.2;   termV[15, 1] = 0.187; termV[15, 2] = 0.176; termV[15, 3] = 0.167; termV[15, 4] = 0.16;  termV[15, 5] = 0.148; termV[15, 6] = 0.14;  termV[15, 7] = 0.135; termV[15, 8] = 0.131; termV[15, 9] = 0.132; termV[15, 10] = 0.135; termV[15, 11] = 0.139; termV[15, 12] = 0.146;

                capFloorVolSurface = new CapFloorTermVolSurface(0, calendar, BusinessDayConvention.Following, optionTenors, strikes,
                                                                termV, dayCounter);
            }
Exemple #5
0
            public void setFlatTermVolSurface()
            {
                setTermStructure();

                optionTenors = new InitializedList <Period>(10);
                for (int i = 0; i < optionTenors.Count; ++i)
                {
                    optionTenors[i] = new Period(i + 1, TimeUnit.Years);
                }

                strikes = new InitializedList <double>(10);
                for (int j = 0; j < strikes.Count; ++j)
                {
                    strikes[j] = (double)(j + 1) / 100.0;
                }

                double flatVol = .18;

                termV = new Matrix(optionTenors.Count, strikes.Count, flatVol);
                flatTermVolSurface = new CapFloorTermVolSurface(0, calendar, BusinessDayConvention.Following,
                                                                optionTenors, strikes, termV, dayCounter);
            }
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CapFloorTermVolSurface obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }