/// <summary>
 /// Will use the discount factors to obtain the forward rates after the curve's anchor date and the fixing curve before that date.
 /// </summary>
 /// <param name="discountCurve"></param>
 /// <param name="index"></param>
 /// <param name="fixingCurve"></param>
 public ForecastCurveFromDiscount(IDiscountingSource discountCurve, FloatingIndex index,
                                  IFloatingRateSource fixingCurve)
 {
     this.discountCurve = discountCurve;
     this.index         = index;
     this.fixingCurve   = fixingCurve;
 }
Exemple #2
0
        /// <summary>
        /// Create a floating rate loan from a loan profile.  The first date in the profile is the disbursment date and
        /// the last date is the final repayment date.  Interest will due on all but the first profile date.
        ///
        /// </summary>
        /// <remarks>
        ///
        /// </remarks>
        /// <param name="balanceDates">A date must be given for each interest date and this original disbursement date
        /// even if the balances remain constant.</param>
        /// <param name="simpleFixedRate">Interest will be calculated simple </param>
        /// <returns></returns>
        public static LoanFloatingRate CreateSimple(Date[] balanceDates, double[] balances, FloatingIndex index,
                                                    double spread, Currency ccy)
        {
            LoanFloatingRate loan = new LoanFloatingRate();

            loan.valueDate     = null;
            loan.ccy           = ccy;
            loan.spread        = spread;
            loan.notionalFlows = new List <Cashflow>();
            loan.notionalFlows.Add(new Cashflow(balanceDates[0], -balances[0], ccy));

            // Set the details for the FloatLeg
            loan.paymentDates     = new Date[balanceDates.Length - 1];
            loan.resetDates       = new Date[balanceDates.Length - 1];
            loan.floatingIndices  = new FloatingIndex[balanceDates.Length - 1];
            loan.spreads          = new double[balanceDates.Length - 1];
            loan.notionals        = new double[balanceDates.Length - 1];
            loan.accrualFractions = new double[balanceDates.Length - 1];

            for (int i = 1; i < balances.Length; i++)
            {
                loan.paymentDates[i - 1]     = balanceDates[i];
                loan.resetDates[i - 1]       = balanceDates[i - 1];
                loan.floatingIndices[i - 1]  = index;
                loan.spreads[i - 1]          = spread;
                loan.notionals[i - 1]        = balances[i - 1];
                loan.accrualFractions[i - 1] = (balanceDates[i] - balanceDates[i - 1]) / 365.0;

                double notionalFlow = balances[i - 1] - balances[i];
                loan.notionalFlows.Add(new Cashflow(balanceDates[i], notionalFlow, ccy));
            }

            loan.type  = "LoanFloatingRate";
            loan.index = index;
            return(loan);
        }
 public ForwardRatesCurveForStripping(Date anchorDate, FloatingIndex index, IFloatingRateSource underlyingCurve)
 {
     this.anchorDate      = anchorDate;
     this.index           = index;
     this.underlyingCurve = underlyingCurve;
 }
Exemple #4
0
 /// <summary>
 /// Create a curve that linearly interpolates the provided forward rates.  Rates are not used to get discount factors.
 /// </summary>
 /// <remarks>
 /// If you want to obtain discount factors from the provided rates rather use: <see cref="DatesAndRates"/></remarks>
 /// <param name="anchorDate"></param>
 /// <param name="index"></param>
 /// <param name="dates"></param>
 /// <param name="rates"></param>
 /// <param name="maximumDate"></param>
 public ForecastCurve(Date anchorDate, FloatingIndex index, Date[] dates, double[] rates,
                      Date maximumDate = null)
 {
     this.index   = index;
     dateAndRates = new DatesAndRates(Currency.ANY, anchorDate, dates, rates, maximumDate);
 }
 public ForwardRatesCurveForStripping(Date anchorDate, FloatingIndex index, IDiscountingSource underlyingCurve)
 {
     this.anchorDate      = anchorDate;
     this.index           = index;
     this.underlyingCurve = new DiscountBasedFloatingRates(index, underlyingCurve);
 }
 public ForwardRatesCurveForStripping(Date anchorDate, FloatingIndex index)
 {
     this.anchorDate = anchorDate;
     this.index      = index;
     underlyingCurve = new ZeroFloatingRates(index);
 }
 public DiscountBasedFloatingRates(FloatingIndex index, IDiscountingSource discountingSource)
 {
     this.index             = index;
     this.discountingSource = discountingSource;
 }
 public ZeroFloatingRates(FloatingIndex index)
 {
     this.index = index;
 }
 public FloatingRateFixingCurve1Rate(double rate, FloatingIndex index)
 {
     this.rate  = rate;
     this.index = index;
 }