예제 #1
0
        public SwapIndex clone(YieldTermStructureHandle forwarding, YieldTermStructureHandle discounting)
        {
            SwapIndex ret = new SwapIndex(NQuantLibcPINVOKE.SwapIndex_clone__SWIG_1(swigCPtr, YieldTermStructureHandle.getCPtr(forwarding), YieldTermStructureHandle.getCPtr(discounting)), true);

            if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
            {
                throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #2
0
        public static Leg CmsLeg(DoubleVector nominals, Schedule schedule, SwapIndex index, DayCounter paymentDayCounter, BusinessDayConvention paymentConvention, UnsignedIntVector fixingDays, DoubleVector gearings)
        {
            Leg ret = new Leg(NQuantLibcPINVOKE.CmsLeg__SWIG_4(DoubleVector.getCPtr(nominals), Schedule.getCPtr(schedule), SwapIndex.getCPtr(index), DayCounter.getCPtr(paymentDayCounter), (int)paymentConvention, UnsignedIntVector.getCPtr(fixingDays), DoubleVector.getCPtr(gearings)), true);

            if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
            {
                throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #3
0
        public SwapIndex clone(Period tenor)
        {
            SwapIndex ret = new SwapIndex(NQuantLibcPINVOKE.SwapIndex_clone__SWIG_2(swigCPtr, Period.getCPtr(tenor)), true);

            if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
            {
                throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #4
0
        public static Leg CmsZeroLeg(DoubleVector nominals, Schedule schedule, SwapIndex index)
        {
            Leg ret = new Leg(NQuantLibcPINVOKE.CmsZeroLeg__SWIG_7(DoubleVector.getCPtr(nominals), Schedule.getCPtr(schedule), SwapIndex.getCPtr(index)), true);

            if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
            {
                throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #5
0
        public SwapIndex clone(Period tenor)
        {
            global::System.IntPtr cPtr = NQuantLibcPINVOKE.SwapIndex_clone__SWIG_2(swigCPtr, Period.getCPtr(tenor));
            SwapIndex             ret  = (cPtr == global::System.IntPtr.Zero) ? null : new SwapIndex(cPtr, true);

            if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
            {
                throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #6
0
        public SwapIndex clone(YieldTermStructureHandle forwarding, YieldTermStructureHandle discounting)
        {
            global::System.IntPtr cPtr = NQuantLibcPINVOKE.SwapIndex_clone__SWIG_1(swigCPtr, YieldTermStructureHandle.getCPtr(forwarding), YieldTermStructureHandle.getCPtr(discounting));
            SwapIndex             ret  = (cPtr == global::System.IntPtr.Zero) ? null : new SwapIndex(cPtr, true);

            if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
            {
                throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
        public SwapIndex swapIndex1()
        {
            global::System.IntPtr cPtr = NQuantLibcPINVOKE.SwapSpreadIndex_swapIndex1(swigCPtr);
            SwapIndex             ret  = (cPtr == global::System.IntPtr.Zero) ? null : new SwapIndex(cPtr, true);

            if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
            {
                throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #8
0
        /// <summary>
        /// Best Alignments
        /// </summary>
        /// <param name="swapPossibilities"> Value swap in DB </param>
        /// <param name="DB"> Data Base if sequence </param>
        /// <returns>Key Value Pair contains maxvalue (i.e. best alignment), DBIndex, SwapIndex, SeqPosIndex </returns>
        public KeyValuePair <int, List <List <int> > > ProvideBestSwapBulkAlignments(List <List <int[]> > swapPossibilities, List <FastaItem> DB)
        {
            int maxValue = int.MinValue;


            List <int> DBIndex     = new List <int>();
            List <int> SwapIndex   = new List <int>();
            List <int> SeqPosIndex = new List <int>();


            int counter = 0;

            for (int i = 0; i < swapPossibilities.Count; i++) //
            {
                counter++;
                Console.WriteLine("Verifying swap " + counter + " of " + swapPossibilities.Count);
                List <int[]> swapOptions = swapPossibilities[i];

                for (int j = 0; j < swapOptions.Count; j++) //SwappedOptions
                {
                    for (int k = 0; k < swapOptions[j].Length; k++)
                    {
                        if (swapOptions[j][k] > maxValue)
                        {
                            maxValue = swapOptions[j][k];

                            DBIndex = new List <int>()
                            {
                                i
                            };
                            SwapIndex = new List <int>()
                            {
                                j
                            };
                            SeqPosIndex = new List <int>()
                            {
                                k
                            };
                        }
                        else if (swapOptions[j][k] == maxValue)
                        {
                            DBIndex.Add(i);
                            SwapIndex.Add(j);
                            SeqPosIndex.Add(k);
                        }
                    }
                }
            }
            Console.WriteLine();
            return(new KeyValuePair <int, List <List <int> > >(maxValue, new List <List <int> >()
            {
                DBIndex, SwapIndex, SeqPosIndex
            }));
        }
예제 #9
0
 public MakeSwaption(SwapIndex swapIndex,
                     Date fixingDate,
                     double?strike = null)
 {
     swapIndex_        = swapIndex;
     delivery_         = Settlement.Type.Physical;
     settlementMethod_ = Settlement.Method.PhysicalOTC;
     optionConvention_ = BusinessDayConvention.ModifiedFollowing;
     fixingDate_       = fixingDate;
     strike_           = strike;
     underlyingType_   = VanillaSwap.Type.Payer;
     nominal_          = 1.0;
 }
예제 #10
0
	public void SwapColor (SwapIndex index, Color32 color32)
	{
		Color color = (Color)color32;
		mSpriteColors [(int)index] = color;
		mColorSwapTex.SetPixel ((int)index, 0, color);

		//For fixing mistakes with the sprite
		if (index == SwapIndex.LightSkin) {
			mSpriteColors [(int)SwapIndex.DarkSkin] = color;
			mColorSwapTex.SetPixel ((int)SwapIndex.DarkSkin, 0, color);
			mSpriteColors [(int)SwapIndex.LightSkinOff] = color;
			mColorSwapTex.SetPixel ((int)SwapIndex.LightSkinOff, 0, color);
		}
	}
예제 #11
0
    public void SwapColor(SwapIndex index, Color32 color32)
    {
        Color color = (Color)color32;

        mSpriteColors [(int)index] = color;
        mColorSwapTex.SetPixel((int)index, 0, color);

        //For fixing mistakes with the sprite
        if (index == SwapIndex.LightSkin)
        {
            mSpriteColors [(int)SwapIndex.DarkSkin] = color;
            mColorSwapTex.SetPixel((int)SwapIndex.DarkSkin, 0, color);
            mSpriteColors [(int)SwapIndex.LightSkinOff] = color;
            mColorSwapTex.SetPixel((int)SwapIndex.LightSkinOff, 0, color);
        }
    }
예제 #12
0
 public CappedFlooredCmsCoupon(double nominal,
                               Date paymentDate,
                               Date startDate,
                               Date endDate,
                               int fixingDays,
                               SwapIndex index,
                               double gearing        = 1.0,
                               double spread         = 0.0,
                               double?cap            = null,
                               double?floor          = null,
                               Date refPeriodStart   = null,
                               Date refPeriodEnd     = null,
                               DayCounter dayCounter = null,
                               bool isInArrears      = false)
     : base(new CmsCoupon(nominal, paymentDate, startDate, endDate, fixingDays, index, gearing, spread, refPeriodStart, refPeriodEnd, dayCounter, isInArrears) as FloatingRateCoupon, cap, floor)
 {
 }
예제 #13
0
            public CommonVars()
            {
                Settings.setEvaluationDate(new Date(16, Month.September, 2015));
                conventions.setConventions();

                // ATM swaptionvolmatrix
                atm.setMarketData();

                atmVolMatrix = new RelinkableHandle <SwaptionVolatilityStructure>(
                    new SwaptionVolatilityMatrix(conventions.calendar, conventions.optionBdc, atm.tenors.options,
                                                 atm.tenors.swaps, atm.volsHandle, conventions.dayCounter));
                // Swaptionvolcube
                cube.setMarketData();

                termStructure.linkTo(Utilities.flatRate(0.05, new Actual365Fixed()));

                swapIndexBase      = new EuriborSwapIsdaFixA(new Period(2, TimeUnit.Years), termStructure);
                shortSwapIndexBase = new EuriborSwapIsdaFixA(new Period(1, TimeUnit.Years), termStructure);

                vegaWeighedSmileFit = false;
            }
예제 #14
0
        public SwapRateHelper(Handle <Quote> rate,
                              SwapIndex swapIndex,
                              Handle <Quote> spread = null,
                              Period fwdStart       = null,
                              // exogenous discounting curve
                              Handle <YieldTermStructure> discount = null,
                              Pillar.Choice pillarChoice           = Pillar.Choice.LastRelevantDate,
                              Date customPillarDate = null)
            : base(rate)
        {
            spread_   = spread ?? new Handle <Quote>();
            fwdStart_ = fwdStart ?? new Period(0, TimeUnit.Days);

            settlementDays_  = swapIndex.fixingDays();
            tenor_           = swapIndex.tenor();
            pillarChoice_    = pillarChoice;
            calendar_        = swapIndex.fixingCalendar();
            fixedConvention_ = swapIndex.fixedLegConvention();
            fixedFrequency_  = swapIndex.fixedLegTenor().frequency();
            fixedDayCount_   = swapIndex.dayCounter();
            iborIndex_       = swapIndex.iborIndex();
            fwdStart_        = fwdStart;
            discountHandle_  = discount ?? new Handle <YieldTermStructure>();

            // take fixing into account
            iborIndex_ = swapIndex.iborIndex().clone(termStructureHandle_);
            // We want to be notified of changes of fixings, but we don't
            // want notifications from termStructureHandle_ (they would
            // interfere with bootstrapping.)
            iborIndex_.registerWith(update);
            spread_.registerWith(update);
            discountHandle_.registerWith(update);
            pillarDate_ = customPillarDate;

            initializeDates();
        }
예제 #15
0
 public SwapRateHelper(double rate, SwapIndex index, QuoteHandle spread, Period fwdStart) : this(NQuantLibcPINVOKE.new_SwapRateHelper__SWIG_23(rate, SwapIndex.getCPtr(index), QuoteHandle.getCPtr(spread), Period.getCPtr(fwdStart)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #16
0
 public SwapRateHelper(double rate, SwapIndex index, QuoteHandle spread, Period fwdStart, YieldTermStructureHandle discountingCurve) : this(NQuantLibcPINVOKE.new_SwapRateHelper__SWIG_22(rate, SwapIndex.getCPtr(index), QuoteHandle.getCPtr(spread), Period.getCPtr(fwdStart), YieldTermStructureHandle.getCPtr(discountingCurve)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #17
0
파일: CmsCoupon.cs 프로젝트: minikie/test
 public CmsCoupon(Date paymentDate, double nominal, Date startDate, Date endDate, int fixingDays, SwapIndex index, double gearing, double spread, Date refPeriodStart, Date refPeriodEnd, DayCounter dayCounter, bool isInArrears) : this(NQuantLibcPINVOKE.new_CmsCoupon__SWIG_0(Date.getCPtr(paymentDate), nominal, Date.getCPtr(startDate), Date.getCPtr(endDate), fixingDays, SwapIndex.getCPtr(index), gearing, spread, Date.getCPtr(refPeriodStart), Date.getCPtr(refPeriodEnd), DayCounter.getCPtr(dayCounter), isInArrears), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #18
0
 public CmsCoupon(Date paymentDate, double nominal, Date startDate, Date endDate, int fixingDays, SwapIndex index) : this(NQuantLibcPINVOKE.new_CmsCoupon__SWIG_6(Date.getCPtr(paymentDate), nominal, Date.getCPtr(startDate), Date.getCPtr(endDate), fixingDays, SwapIndex.getCPtr(index)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #19
0
파일: CmsRateBond.cs 프로젝트: minikie/test
 public CmsRateBond(uint settlementDays, double faceAmount, Schedule schedule, SwapIndex index, DayCounter paymentDayCounter, BusinessDayConvention paymentConvention, uint fixingDays, DoubleVector gearings, DoubleVector spreads, DoubleVector caps, DoubleVector floors) : this(NQuantLibcPINVOKE.new_CmsRateBond__SWIG_3(settlementDays, faceAmount, Schedule.getCPtr(schedule), SwapIndex.getCPtr(index), DayCounter.getCPtr(paymentDayCounter), (int)paymentConvention, fixingDays, DoubleVector.getCPtr(gearings), DoubleVector.getCPtr(spreads), DoubleVector.getCPtr(caps), DoubleVector.getCPtr(floors)), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #20
0
 public void SwapColor(SwapIndex index, Color color)
 {
     mSpriteColors [(int)index] = color;
     mColorSwapTex.SetPixel((int)index, 0, color);
     mColorSwapTex.Apply();
 }
예제 #21
0
 public SwaptionVolCube1(SwaptionVolatilityStructureHandle atmVolStructure, PeriodVector optionTenors, PeriodVector swapTenors, DoubleVector strikeSpreads, QuoteHandleVectorVector volSpreads, SwapIndex swapIndex, SwapIndex shortSwapIndex, bool vegaWeightedSmileFit, QuoteHandleVectorVector parametersGuess, BoolVector isParameterFixed, bool isAtmCalibrated, SWIGTYPE_p_boost__shared_ptrT_EndCriteria_t endCriteria, double maxErrorTolerance, OptimizationMethod optMethod) : this(NQuantLibcPINVOKE.new_SwaptionVolCube1__SWIG_0(SwaptionVolatilityStructureHandle.getCPtr(atmVolStructure), PeriodVector.getCPtr(optionTenors), PeriodVector.getCPtr(swapTenors), DoubleVector.getCPtr(strikeSpreads), QuoteHandleVectorVector.getCPtr(volSpreads), SwapIndex.getCPtr(swapIndex), SwapIndex.getCPtr(shortSwapIndex), vegaWeightedSmileFit, QuoteHandleVectorVector.getCPtr(parametersGuess), BoolVector.getCPtr(isParameterFixed), isAtmCalibrated, SWIGTYPE_p_boost__shared_ptrT_EndCriteria_t.getCPtr(endCriteria), maxErrorTolerance, OptimizationMethod.getCPtr(optMethod)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #22
0
 public SwapRateHelper(double rate, SwapIndex index, QuoteHandle spread, Period fwdStart, YieldTermStructureHandle discountingCurve) : this(NQuantLibcPINVOKE.new_SwapRateHelper__SWIG_12(rate, SwapIndex.getCPtr(index), QuoteHandle.getCPtr(spread), Period.getCPtr(fwdStart), YieldTermStructureHandle.getCPtr(discountingCurve)), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #23
0
파일: NQuantLibc.cs 프로젝트: minikie/test
 public static Leg CmsZeroLeg(DoubleVector nominals, Schedule schedule, SwapIndex index, DayCounter paymentDayCounter, BusinessDayConvention paymentConvention, UnsignedIntVector fixingDays, DoubleVector gearings, DoubleVector spreads, DoubleVector caps) {
   Leg ret = new Leg(NQuantLibcPINVOKE.CmsZeroLeg__SWIG_1(DoubleVector.getCPtr(nominals), Schedule.getCPtr(schedule), SwapIndex.getCPtr(index), DayCounter.getCPtr(paymentDayCounter), (int)paymentConvention, UnsignedIntVector.getCPtr(fixingDays), DoubleVector.getCPtr(gearings), DoubleVector.getCPtr(spreads), DoubleVector.getCPtr(caps)), true);
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
예제 #24
0
파일: NQuantLibc.cs 프로젝트: minikie/test
 public static Leg CmsZeroLeg(DoubleVector nominals, Schedule schedule, SwapIndex index, DayCounter paymentDayCounter, BusinessDayConvention paymentConvention) {
   Leg ret = new Leg(NQuantLibcPINVOKE.CmsZeroLeg__SWIG_5(DoubleVector.getCPtr(nominals), Schedule.getCPtr(schedule), SwapIndex.getCPtr(index), DayCounter.getCPtr(paymentDayCounter), (int)paymentConvention), true);
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
예제 #25
0
파일: NQuantLibc.cs 프로젝트: minikie/test
 public static Leg CmsZeroLeg(DoubleVector nominals, Schedule schedule, SwapIndex index) {
   Leg ret = new Leg(NQuantLibcPINVOKE.CmsZeroLeg__SWIG_7(DoubleVector.getCPtr(nominals), Schedule.getCPtr(schedule), SwapIndex.getCPtr(index)), true);
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
예제 #26
0
파일: SwapIndex.cs 프로젝트: minikie/test
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SwapIndex obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }
예제 #27
0
 public SwapRateHelper(double rate, SwapIndex index) : this(NQuantLibcPINVOKE.new_SwapRateHelper__SWIG_25(rate, SwapIndex.getCPtr(index)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #28
0
 private void SwapColor(SwapIndex index, Color color)
 {
     mSpriteColors[(int)index] = color;
     mColorSwapTex.SetPixel((int)index, 0, color);
 }
예제 #29
0
 public SwapRateHelper(double rate, SwapIndex index) : this(NQuantLibcPINVOKE.new_SwapRateHelper__SWIG_15(rate, SwapIndex.getCPtr(index)), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #30
0
 public SwaptionVolCube1(SwaptionVolatilityStructureHandle atmVolStructure, PeriodVector optionTenors, PeriodVector swapTenors, DoubleVector strikeSpreads, QuoteHandleVectorVector volSpreads, SwapIndex swapIndex, SwapIndex shortSwapIndex, bool vegaWeightedSmileFit, QuoteHandleVectorVector parametersGuess, BoolVector isParameterFixed, bool isAtmCalibrated) : this(NQuantLibcPINVOKE.new_SwaptionVolCube1__SWIG_3(SwaptionVolatilityStructureHandle.getCPtr(atmVolStructure), PeriodVector.getCPtr(optionTenors), PeriodVector.getCPtr(swapTenors), DoubleVector.getCPtr(strikeSpreads), QuoteHandleVectorVector.getCPtr(volSpreads), SwapIndex.getCPtr(swapIndex), SwapIndex.getCPtr(shortSwapIndex), vegaWeightedSmileFit, QuoteHandleVectorVector.getCPtr(parametersGuess), BoolVector.getCPtr(isParameterFixed), isAtmCalibrated), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #31
0
 public SwaptionVolCube2(SwaptionVolatilityStructureHandle atmVolStructure, PeriodVector optionTenors, PeriodVector swapTenors, DoubleVector strikeSpreads, QuoteHandleVectorVector volSpreads, SwapIndex swapIndexBase, SwapIndex shortSwapIndexBase, bool vegaWeightedSmileFit) : this(NQuantLibcPINVOKE.new_SwaptionVolCube2(SwaptionVolatilityStructureHandle.getCPtr(atmVolStructure), PeriodVector.getCPtr(optionTenors), PeriodVector.getCPtr(swapTenors), DoubleVector.getCPtr(strikeSpreads), QuoteHandleVectorVector.getCPtr(volSpreads), SwapIndex.getCPtr(swapIndexBase), SwapIndex.getCPtr(shortSwapIndexBase), vegaWeightedSmileFit), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #32
0
 public CappedFlooredCmsCoupon(Date paymentDate, double nominal, Date startDate, Date endDate, uint fixingDays, SwapIndex index, double gearing, double spread) : this(NQuantLibcPINVOKE.new_CappedFlooredCmsCoupon__SWIG_6(Date.getCPtr(paymentDate), nominal, Date.getCPtr(startDate), Date.getCPtr(endDate), fixingDays, SwapIndex.getCPtr(index), gearing, spread), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #33
0
        public void testFairRate()
        {
            // Testing Hagan-pricer flat-vol equivalence for coupons
            CommonVars vars = new CommonVars();

            SwapIndex swapIndex = new SwapIndex("EuriborSwapIsdaFixA",
                                                new Period(10, TimeUnit.Years),
                                                vars.iborIndex.fixingDays(),
                                                vars.iborIndex.currency(),
                                                vars.iborIndex.fixingCalendar(),
                                                new Period(1, TimeUnit.Years),
                                                BusinessDayConvention.Unadjusted,
                                                vars.iborIndex.dayCounter(),//??
                                                vars.iborIndex);

            // FIXME
            //shared_ptr<SwapIndex> swapIndex(new
            //    EuriborSwapIsdaFixA(10*Years, vars.iborIndex->termStructure()));
            Date   startDate              = vars.termStructure.link.referenceDate() + new Period(20, TimeUnit.Years);
            Date   paymentDate            = startDate + new Period(1, TimeUnit.Years);
            Date   endDate                = paymentDate;
            double nominal                = 1.0;
            double?infiniteCap            = null;
            double?infiniteFloor          = null;
            double gearing                = 1.0;
            double spread                 = 0.0;
            CappedFlooredCmsCoupon coupon = new CappedFlooredCmsCoupon(nominal, paymentDate,
                                                                       startDate, endDate,
                                                                       swapIndex.fixingDays(), swapIndex,
                                                                       gearing, spread,
                                                                       infiniteCap, infiniteFloor,
                                                                       startDate, endDate,
                                                                       vars.iborIndex.dayCounter());

            for (int j = 0; j < vars.yieldCurveModels.Count; ++j)
            {
                vars.numericalPricers[j].setSwaptionVolatility(vars.atmVol);
                coupon.setPricer(vars.numericalPricers[j]);
                double rate0 = coupon.rate();

                vars.analyticPricers[j].setSwaptionVolatility(vars.atmVol);
                coupon.setPricer(vars.analyticPricers[j]);
                double rate1 = coupon.rate();

                double difference = Math.Abs(rate1 - rate0);
                double tol        = 2.0e-4;
                bool   linearTsr  = j == vars.yieldCurveModels.Count - 1;

                if (difference > tol)
                {
                    QAssert.Fail("\nCoupon payment date: " + paymentDate +
                                 "\nCoupon start date:   " + startDate +
                                 "\nCoupon floor:        " + (infiniteFloor) +
                                 "\nCoupon gearing:      " + (gearing) +
                                 "\nCoupon swap index:   " + swapIndex.name() +
                                 "\nCoupon spread:       " + (spread) +
                                 "\nCoupon cap:          " + (infiniteCap) +
                                 "\nCoupon DayCounter:   " + vars.iborIndex.dayCounter() +
                                 "\nYieldCurve Model:    " + vars.yieldCurveModels[j] +
                                 "\nNumerical Pricer:    " + (rate0) + (linearTsr ? " (Linear TSR Model)" : "") +
                                 "\nAnalytic Pricer:     " + (rate1) +
                                 "\ndifference:          " + (difference) +
                                 "\ntolerance:           " + (tol));
                }
            }
        }
예제 #34
0
 public CmsCoupon(Date paymentDate, double nominal, Date startDate, Date endDate, int fixingDays, SwapIndex index, double gearing, double spread, Date refPeriodStart, Date refPeriodEnd) : this(NQuantLibcPINVOKE.new_CmsCoupon__SWIG_2(Date.getCPtr(paymentDate), nominal, Date.getCPtr(startDate), Date.getCPtr(endDate), fixingDays, SwapIndex.getCPtr(index), gearing, spread, Date.getCPtr(refPeriodStart), Date.getCPtr(refPeriodEnd)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public void ClearColor(SwapIndex index)
 {
     Color c = new Color(0.0f, 0.0f, 0.0f, 0.0f);
     mSpriteColors[(int)index] = c;
     mColorSwapTex.SetPixel((int)index, 0, c);
 }
예제 #36
0
 public SwaptionVolCube1(SwaptionVolatilityStructureHandle atmVolStructure, PeriodVector optionTenors, PeriodVector swapTenors, DoubleVector strikeSpreads, QuoteHandleVectorVector volSpreads, SwapIndex swapIndexBase, SwapIndex shortSwapIndexBase, bool vegaWeightedSmileFit, QuoteHandleVectorVector parametersGuess, BoolVector isParameterFixed, bool isAtmCalibrated, SWIGTYPE_p_boost__shared_ptrT_EndCriteria_t endCriteria, double maxErrorTolerance, SWIGTYPE_p_boost__shared_ptrT_OptimizationMethod_t optMethod) : this(NQuantLibcPINVOKE.new_SwaptionVolCube1__SWIG_0(SwaptionVolatilityStructureHandle.getCPtr(atmVolStructure), PeriodVector.getCPtr(optionTenors), PeriodVector.getCPtr(swapTenors), DoubleVector.getCPtr(strikeSpreads), QuoteHandleVectorVector.getCPtr(volSpreads), SwapIndex.getCPtr(swapIndexBase), SwapIndex.getCPtr(shortSwapIndexBase), vegaWeightedSmileFit, QuoteHandleVectorVector.getCPtr(parametersGuess), BoolVector.getCPtr(isParameterFixed), isAtmCalibrated, SWIGTYPE_p_boost__shared_ptrT_EndCriteria_t.getCPtr(endCriteria), maxErrorTolerance, SWIGTYPE_p_boost__shared_ptrT_OptimizationMethod_t.getCPtr(optMethod)), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #37
0
파일: CmsCoupon.cs 프로젝트: minikie/test
 public CmsCoupon(Date paymentDate, double nominal, Date startDate, Date endDate, int fixingDays, SwapIndex index, double gearing, double spread) : this(NQuantLibcPINVOKE.new_CmsCoupon__SWIG_4(Date.getCPtr(paymentDate), nominal, Date.getCPtr(startDate), Date.getCPtr(endDate), fixingDays, SwapIndex.getCPtr(index), gearing, spread), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #38
0
 public SwapRateHelper(QuoteHandle rate, SwapIndex index, QuoteHandle spread) : this(NQuantLibcPINVOKE.new_SwapRateHelper__SWIG_10(QuoteHandle.getCPtr(rate), SwapIndex.getCPtr(index), QuoteHandle.getCPtr(spread)), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #39
0
 public SwaptionVolCube1(SwaptionVolatilityStructureHandle atmVolStructure, PeriodVector optionTenors, PeriodVector swapTenors, DoubleVector strikeSpreads, QuoteHandleVectorVector volSpreads, SwapIndex swapIndexBase, SwapIndex shortSwapIndexBase, bool vegaWeightedSmileFit, QuoteHandleVectorVector parametersGuess, BoolVector isParameterFixed, bool isAtmCalibrated) : this(NQuantLibcPINVOKE.new_SwaptionVolCube1__SWIG_3(SwaptionVolatilityStructureHandle.getCPtr(atmVolStructure), PeriodVector.getCPtr(optionTenors), PeriodVector.getCPtr(swapTenors), DoubleVector.getCPtr(strikeSpreads), QuoteHandleVectorVector.getCPtr(volSpreads), SwapIndex.getCPtr(swapIndexBase), SwapIndex.getCPtr(shortSwapIndexBase), vegaWeightedSmileFit, QuoteHandleVectorVector.getCPtr(parametersGuess), BoolVector.getCPtr(isParameterFixed), isAtmCalibrated), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #40
0
 public SwapRateHelper(double rate, SwapIndex index, QuoteHandle spread, Period fwdStart) : this(NQuantLibcPINVOKE.new_SwapRateHelper__SWIG_13(rate, SwapIndex.getCPtr(index), QuoteHandle.getCPtr(spread), Period.getCPtr(fwdStart)), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #41
0
 public CappedFlooredCmsCoupon(Date paymentDate, double nominal, Date startDate, Date endDate, uint fixingDays, SwapIndex index, double gearing, double spread, double cap, double floor, Date refPeriodStart) : this(NQuantLibcPINVOKE.new_CappedFlooredCmsCoupon__SWIG_3(Date.getCPtr(paymentDate), nominal, Date.getCPtr(startDate), Date.getCPtr(endDate), fixingDays, SwapIndex.getCPtr(index), gearing, spread, cap, floor, Date.getCPtr(refPeriodStart)), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
 public SwapSpreadIndex(string familyName, SwapIndex swapIndex1, SwapIndex swapIndex2) : this(NQuantLibcPINVOKE.new_SwapSpreadIndex__SWIG_2(familyName, SwapIndex.getCPtr(swapIndex1), SwapIndex.getCPtr(swapIndex2)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #43
0
 public CappedFlooredCmsCoupon(Date paymentDate, double nominal, Date startDate, Date endDate, uint fixingDays, SwapIndex index) : this(NQuantLibcPINVOKE.new_CappedFlooredCmsCoupon__SWIG_8(Date.getCPtr(paymentDate), nominal, Date.getCPtr(startDate), Date.getCPtr(endDate), fixingDays, SwapIndex.getCPtr(index)), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #44
0
 public CappedFlooredCmsCoupon(Date paymentDate, double nominal, Date startDate, Date endDate, uint fixingDays, SwapIndex index, double gearing, double spread, double cap, double floor, Date refPeriodStart, Date refPeriodEnd, DayCounter dayCounter) : this(NQuantLibcPINVOKE.new_CappedFlooredCmsCoupon__SWIG_1(Date.getCPtr(paymentDate), nominal, Date.getCPtr(startDate), Date.getCPtr(endDate), fixingDays, SwapIndex.getCPtr(index), gearing, spread, cap, floor, Date.getCPtr(refPeriodStart), Date.getCPtr(refPeriodEnd), DayCounter.getCPtr(dayCounter)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #45
0
 public void ColorSwap(SwapIndex index, Color32 color)
 {
     mSpriteColors[(int)index] = color;
     mColorSwapTex.SetPixel((int)index, 0, color);
 }
예제 #46
0
 public SwapRateHelper(QuoteHandle rate, SwapIndex index, QuoteHandle spread, Period fwdStart, YieldTermStructureHandle discountingCurve, Pillar.Choice pillar, Date customPillarDate) : this(NQuantLibcPINVOKE.new_SwapRateHelper__SWIG_14(QuoteHandle.getCPtr(rate), SwapIndex.getCPtr(index), QuoteHandle.getCPtr(spread), Period.getCPtr(fwdStart), YieldTermStructureHandle.getCPtr(discountingCurve), (int)pillar, Date.getCPtr(customPillarDate)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #47
0
 public SwapRateHelper(QuoteHandle rate, SwapIndex index, QuoteHandle spread) : this(NQuantLibcPINVOKE.new_SwapRateHelper__SWIG_18(QuoteHandle.getCPtr(rate), SwapIndex.getCPtr(index), QuoteHandle.getCPtr(spread)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #48
0
        public void testCmsSwap()
        {
            // Testing Hagan-pricer flat-vol equivalence for swaps
            CommonVars vars = new CommonVars();

            SwapIndex swapIndex = new SwapIndex("EuriborSwapIsdaFixA",
                                                new Period(10, TimeUnit.Years),
                                                vars.iborIndex.fixingDays(),
                                                vars.iborIndex.currency(),
                                                vars.iborIndex.fixingCalendar(),
                                                new Period(1, TimeUnit.Years),
                                                BusinessDayConvention.Unadjusted,
                                                vars.iborIndex.dayCounter(),//??
                                                vars.iborIndex);
            // FIXME
            //shared_ptr<SwapIndex> swapIndex(new
            //    EuriborSwapIsdaFixA(10*Years, vars.iborIndex->termStructure()));
            double     spread      = 0.0;
            List <int> swapLengths = new List <int>();

            swapLengths.Add(1);
            swapLengths.Add(5);
            swapLengths.Add(6);
            swapLengths.Add(10);
            int         n   = swapLengths.Count;
            List <Swap> cms = new List <Swap>(n);

            for (int i = 0; i < n; ++i)
            {
                // no cap, floor
                // no gearing, spread
                cms.Add(new MakeCms(new Period(swapLengths[i], TimeUnit.Years),
                                    swapIndex,
                                    vars.iborIndex, spread,
                                    new Period(10, TimeUnit.Days)).value());
            }

            for (int j = 0; j < vars.yieldCurveModels.Count; ++j)
            {
                vars.numericalPricers[j].setSwaptionVolatility(vars.atmVol);
                vars.analyticPricers[j].setSwaptionVolatility(vars.atmVol);
                for (int sl = 0; sl < n; ++sl)
                {
                    Utils.setCouponPricer(cms[sl].leg(0), vars.numericalPricers[j]);
                    double priceNum = cms[sl].NPV();
                    Utils.setCouponPricer(cms[sl].leg(0), vars.analyticPricers[j]);
                    double priceAn = cms[sl].NPV();

                    double difference = Math.Abs(priceNum - priceAn);
                    double tol        = 2.0e-4;
                    bool   linearTsr  = j == vars.yieldCurveModels.Count - 1;
                    if (difference > tol)
                    {
                        QAssert.Fail("\nLength in Years:  " + swapLengths[sl] +
                                     "\nswap index:       " + swapIndex.name() +
                                     "\nibor index:       " + vars.iborIndex.name() +
                                     "\nspread:           " + (spread) +
                                     "\nYieldCurve Model: " + vars.yieldCurveModels[j] +
                                     "\nNumerical Pricer: " + (priceNum) + (linearTsr ? " (Linear TSR Model)" : "") +
                                     "\nAnalytic Pricer:  " + (priceAn) +
                                     "\ndifference:       " + (difference) +
                                     "\ntolerance:        " + (tol));
                    }
                }
            }
        }
 public void SwapColor(SwapIndex index, Color color)
 {
     mSpriteColors[(int)index] = color;
     mColorSwapTex.SetPixel((int)index, 0, color);
 }