Example #1
0
        public BasisSwap value()
        {
            Date startDate;

            if (effectiveDate_ != null)
            {
                startDate = effectiveDate_;
            }
            else
            {
                int  fixingDays    = iborIndex1_.fixingDays();
                Date referenceDate = Settings.evaluationDate();
                Date spotDate      = float1Calendar_.advance(referenceDate, new Period(fixingDays, TimeUnit.Days));
                startDate = spotDate + forwardStart_;
            }

            Date endDate;

            if (terminationDate_ != null)
            {
                endDate = terminationDate_;
            }
            else
            {
                endDate = startDate + swapTenor_;
            }


            Schedule float1Schedule = new Schedule(startDate, endDate,
                                                   float1Tenor_, float1Calendar_,
                                                   float1Convention_, float1TerminationDateConvention_,
                                                   float1Rule_, float1EndOfMonth_,
                                                   float1FirstDate_, float1NextToLastDate_);

            Schedule float2Schedule = new Schedule(startDate, endDate,
                                                   float2Tenor_, float2Calendar_,
                                                   float2Convention_, float2TerminationDateConvention_,
                                                   float2Rule_, float2EndOfMonth_,
                                                   float2FirstDate_, float2NextToLastDate_);


            BasisSwap swap = new BasisSwap(type_, nominal_,
                                           float1Schedule, iborIndex1_, float1Spread_, float1DayCount_,
                                           float2Schedule, iborIndex2_, float2Spread_, float2DayCount_);

            swap.setPricingEngine(engine_);
            return(swap);
        }
Example #2
0
 public MakeBasisSwap withType(BasisSwap.Type type)
 {
     type_ = type;
      return this;
 }
Example #3
0
        public BasisSwap value()
        {
            Date startDate;

             if (effectiveDate_ != null)
            startDate = effectiveDate_;
             else
             {
            int fixingDays = iborIndex1_.fixingDays();
            Date referenceDate = Settings.evaluationDate();
            Date spotDate = float1Calendar_.advance(referenceDate, new Period(fixingDays, TimeUnit.Days));
            startDate = spotDate + forwardStart_;
             }

             Date endDate;
             if (terminationDate_ != null)
            endDate = terminationDate_;
             else
            endDate = startDate + swapTenor_;

             Schedule float1Schedule = new Schedule(startDate, endDate,
                                float1Tenor_, float1Calendar_,
                                float1Convention_, float1TerminationDateConvention_,
                                float1Rule_, float1EndOfMonth_,
                                float1FirstDate_, float1NextToLastDate_);

             Schedule float2Schedule = new Schedule(startDate, endDate,
                                float2Tenor_, float2Calendar_,
                                float2Convention_, float2TerminationDateConvention_,
                                float2Rule_, float2EndOfMonth_,
                                float2FirstDate_, float2NextToLastDate_);

             BasisSwap swap = new BasisSwap(type_, nominal_,
                                        float1Schedule, iborIndex1_, float1Spread_,float1DayCount_,
                                        float2Schedule, iborIndex2_, float2Spread_, float2DayCount_);
             swap.setPricingEngine(engine_);
             return swap;
        }