public void testFairRate() { Calendar calendar = new TARGET(); Date settlementDate = new Date(10, Month.Mar, 2010); /********************* * LOAN TO BE PRICED * **********************/ // constant nominal 1,000,000 Euro double nominal = 1000000.0; // fixed leg Frequency fixedLegFrequency = Frequency.Monthly; BusinessDayConvention fixedLegConvention = BusinessDayConvention.Unadjusted; BusinessDayConvention principalLegConvention = BusinessDayConvention.ModifiedFollowing; DayCounter fixedLegDayCounter = new Thirty360(Thirty360.Thirty360Convention.European); double fixedRate = 0.04; // Principal leg Frequency pricipalLegFrequency = Frequency.Annual; int lenghtInMonths = 3; Loan.Type loanType = Loan.Type.Payer; Date maturity = settlementDate + new Period(lenghtInMonths, TimeUnit.Years); Schedule fixedSchedule = new Schedule(settlementDate, maturity, new Period(fixedLegFrequency), calendar, fixedLegConvention, fixedLegConvention, DateGeneration.Rule.Forward, false); Schedule principalSchedule = new Schedule(settlementDate, maturity, new Period(pricipalLegFrequency), calendar, principalLegConvention, principalLegConvention, DateGeneration.Rule.Forward, false); Loan testLoan = new FixedLoan(loanType, nominal, fixedSchedule, fixedRate, fixedLegDayCounter, principalSchedule, principalLegConvention); }
public FixedLoan value() { Schedule fixedSchedule = new Schedule(startDate_, endDate_, new Period(frequency_), calendar_, convention_, convention_, rule_, endOfMonth_); Period principalPeriod = amortising_ == Loan.Amortising.Bullet ? new Period(Frequency.Once) : new Period(frequency_); Schedule principalSchedule = new Schedule(startDate_, endDate_, principalPeriod, calendar_, convention_, convention_, rule_, endOfMonth_); FixedLoan fl = new FixedLoan(type_, nominal_, fixedSchedule, fixedRate_, dayCounter_, principalSchedule, convention_); return fl; }