Exemple #1
0
 public CatBond(int settlementDays,
                Calendar calendar,
                Date issueDate,
                NotionalRisk notionalRisk)
     : base(settlementDays, calendar, issueDate)
 {
     notionalRisk_ = notionalRisk;
 }
Exemple #2
0
        public FloatingCatBond(int settlementDays,
                               double faceAmount,
                               Schedule schedule,
                               IborIndex iborIndex,
                               DayCounter paymentDayCounter,
                               NotionalRisk notionalRisk,
                               BusinessDayConvention paymentConvention = QLCore.BusinessDayConvention.Following,
                               int fixingDays         = 0,
                               List <double> gearings = null,
                               List <double> spreads  = null,
                               List <double?> caps    = null,
                               List <double?> floors  = null,
                               bool inArrears         = false,
                               double redemption      = 100.0,
                               Date issueDate         = null)
            : base(settlementDays, schedule.calendar(), issueDate, notionalRisk)
        {
            maturityDate_ = schedule.endDate();

            cashflows_ = new IborLeg(schedule, iborIndex)
                         .withFixingDays(fixingDays)
                         .withGearings(gearings)
                         .withSpreads(spreads)
                         .withCaps(caps)
                         .withFloors(floors)
                         .inArrears(inArrears)
                         .withPaymentDayCounter(paymentDayCounter)
                         .withNotionals(faceAmount)
                         .withPaymentAdjustment(paymentConvention);

            addRedemptionsToCashflows(new InitializedList <double>(1, redemption));

            Utils.QL_REQUIRE(!cashflows().empty(), () => "bond with no cashflows!");
            Utils.QL_REQUIRE(redemptions_.Count == 1, () => "multiple redemptions created");

            iborIndex.registerWith(update);
        }
Exemple #3
0
        public FloatingCatBond(int settlementDays,
                               double faceAmount,
                               Date startDate,
                               Date maturityDate,
                               Frequency couponFrequency,
                               Calendar calendar,
                               IborIndex iborIndex,
                               DayCounter accrualDayCounter,
                               NotionalRisk notionalRisk,
                               BusinessDayConvention accrualConvention = BusinessDayConvention.Following,
                               BusinessDayConvention paymentConvention = BusinessDayConvention.Following,
                               int fixingDays           = 0,
                               List <double> gearings   = null,
                               List <double> spreads    = null,
                               List <double?> caps      = null,
                               List <double?> floors    = null,
                               bool inArrears           = false,
                               double redemption        = 100.0,
                               Date issueDate           = null,
                               Date stubDate            = null,
                               DateGeneration.Rule rule = DateGeneration.Rule.Backward,
                               bool endOfMonth          = false)
            : base(settlementDays, calendar, issueDate, notionalRisk)
        {
            maturityDate_ = maturityDate;

            Date firstDate = null, nextToLastDate = null;

            switch (rule)
            {
            case DateGeneration.Rule.Backward:
                firstDate      = new Date();
                nextToLastDate = stubDate;
                break;

            case DateGeneration.Rule.Forward:
                firstDate      = stubDate;
                nextToLastDate = new Date();
                break;

            case DateGeneration.Rule.Zero:
            case DateGeneration.Rule.ThirdWednesday:
            case DateGeneration.Rule.Twentieth:
            case DateGeneration.Rule.TwentiethIMM:
                Utils.QL_FAIL("stub date (" + stubDate + ") not allowed with " +
                              rule + " DateGeneration.Rule");
                break;

            default:
                Utils.QL_FAIL("unknown DateGeneration::Rule (" + rule + ")");
                break;
            }

            Schedule schedule = new Schedule(startDate, maturityDate_, new Period(couponFrequency),
                                             calendar_, accrualConvention, accrualConvention,
                                             rule, endOfMonth, firstDate, nextToLastDate);

            cashflows_ = new IborLeg(schedule, iborIndex)
                         .withFixingDays(fixingDays)
                         .withGearings(gearings)
                         .withSpreads(spreads)
                         .withCaps(caps)
                         .withFloors(floors)
                         .inArrears(inArrears)
                         .withPaymentDayCounter(accrualDayCounter)
                         .withPaymentAdjustment(paymentConvention)
                         .withNotionals(faceAmount);

            addRedemptionsToCashflows(new InitializedList <double>(1, redemption));

            Utils.QL_REQUIRE(!cashflows().empty(), () => "bond with no cashflows!");
            Utils.QL_REQUIRE(redemptions_.Count == 1, () => "multiple redemptions created");

            iborIndex.registerWith(update);
        }