Using Period with referenceDate to allow for time-abolute valuation.
package net.finmath.montecarlo.interestrate.products;
+import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.ArrayList;
@@ -48,6 +49,8 @@ public class SwapLeg extends AbstractLIBORMonteCarloProduct {
public SwapLeg(Schedule legSchedule, AbstractNotional notional, AbstractIndex index, double spread, boolean couponFlow, boolean isNotionalExchanged, boolean isNotionalAccruing) {
super();
+ LocalDateTime referenceDate = legSchedule.getReferenceDate().atStartOfDay();
+
/*
* Create components.
*
@@ -82,7 +85,7 @@ public class SwapLeg extends AbstractLIBORMonteCarloProduct {
coupon = new FixedCoupon(spread);
}
- Period period = new Period(fixingDate, paymentDate, fixingDate, paymentDate, notional, coupon, periodLength, couponFlow, isNotionalExchanged, false);
+ Period period = new Period(referenceDate, fixingDate, paymentDate, fixingDate, paymentDate, notional, coupon, periodLength, couponFlow, isNotionalExchanged, false, false);
periods.add(period);
if(isNotionalAccruing) {
