/// <summary> /// Initializes a new instance of the <see cref="BondRepoBase"/> class. /// </summary> protected BondRepoBase() { Amortisation = new Amortisation(); Issuer = string.Empty; Survival_Probability = string.Empty; Recovery_Rate = string.Empty; }
/// <summary> /// Return an amortisation schedule with amortization payments allocated to the nearest payment date in the cashflow list. /// </summary> private static Amortisation AllocateAmortisationToPaymentDates <TCashflow>(Amortisation sourceAmortisation, List <TCashflow> cashflowList) where TCashflow : CFBase { if (sourceAmortisation == null || sourceAmortisation.Count == 0) { return(sourceAmortisation); } var payDates = new DateList(cashflowList.Select(cashflow => (double)cashflow.Payment_Date)); // Allocate amortisation amounts to nearest payment dates var amounts = new double[payDates.Count]; foreach (var payment in sourceAmortisation) { int i = payDates.IndexOfClosestDate(payment.Date); amounts[i] += payment.Amount; } var amortisation = new Amortisation(); for (int i = 0; i < amounts.Length; ++i) { if (amounts[i] != 0.0) { amortisation.Add(new AmountAtDate() { Amount = amounts[i], Date = payDates[i] }); } } return(amortisation); }
public BondOptionDeal() { Amortisation = new Amortisation(); Option_Type = OptionType.Call; Strike_Is_Clean = YesNo.Yes; Issuer = string.Empty; Survival_Probability = string.Empty; Recovery_Rate = string.Empty; }
public CallableBondForward() { Amortisation = new Amortisation(); Payment_Timing = PaymentTiming.End; Coupon_Rate_Schedule = new RateList(); Is_Defaultable = YesNo.No; Call_Prices = new RateList(); Issuer = string.Empty; Survival_Probability = string.Empty; Recovery_Rate = string.Empty; }
/// <summary> /// Validate deal properties. /// </summary> public override void Validate(ICalendarData calendar, ErrorList errors) { base.Validate(calendar, errors); if (Notional < CalcUtils.MinAssetPrice) { AddToErrors(errors, string.Format("Bond Notional must be at least {0}", CalcUtils.MinAssetPrice)); } CalcUtils.ValidateDates(errors, Issue_Date, Bond_Maturity_Date, First_Coupon_Date, Penultimate_Coupon_Date, false, "Issue", "bond maturity"); Coupon_Rate_Schedule.Validate(errors, false, "Fixed rate schedule"); Amortisation.Validate(errors); CalcUtils.ValidateDates(errors, Issue_Date, Bond_Maturity_Date, true, "Issue", "bond maturity"); if (Settlement_Date != 0.0) { CalcUtils.ValidateDates(errors, Settlement_Date, Bond_Maturity_Date, true, "Settlement", "bond maturity"); } CalcUtils.ValidateDates(errors, First_Call_Date, Last_Call_Date, false, "First call", "last call"); Call_Prices.Validate(errors, true, "Call prices"); if (IsForward()) { if (Settlement_Date == 0.0) { AddToErrors(errors, "Settlement_Date must be specified"); } if (Price == 0.0) { AddToErrors(errors, ErrorLevel.Info, "Settlement price (Price) is zero."); } } else { if (Price != 0.0 && Settlement_Date == 0.0) { AddToErrors(errors, ErrorLevel.Warning, "Settlement price (Price) is not zero but Settlement_Date is not specified so Price has been ignored."); } } }
/// <summary> /// Validate deal properties. /// </summary> public override void Validate(ICalendarData calendar, ErrorList errors) { base.Validate(calendar, errors); CalcUtils.ValidateDates(errors, Issue_Date, Bond_Maturity_Date, First_Coupon_Date, Penultimate_Coupon_Date, true, "issue", "bond maturity"); if (Coupon_Interval <= 0.0) { AddToErrors(errors, "Coupon interval must be greater than zero"); } if (Expiry_Date >= Bond_Maturity_Date) { AddToErrors(errors, "Expiry date must lie before bond maturity date: " + Bond_Maturity_Date.ToString()); } if (Strike_Price <= 0.0) { AddToErrors(errors, "Strike price must be positive"); } Amortisation.Validate(errors); }
public CommitmentDeal() : base() { Amortisation = new Amortisation(); }
/// <summary> /// Initializes a new instance of the <see cref="BondLendingBase"/> class. /// </summary> protected BondLendingBase() { Amortisation = new Amortisation(); Issuer = string.Empty; Survival_Probability = string.Empty; }