Closed NiklasRodi closed 7 years ago
Is this
double firstPeriodStartDate = legSchedule.getPeriodStart(0);
for(int periodIndex=0; periodIndex<legSchedule.getNumberOfPeriods(); periodIndex++) {
(...)
double notional = (discountCurveForNotionalReset.getDiscountFactor(model,periodStart)/discountCurveForNotionalReset.getDiscountFactor(model,firstPeriodStartDate)) / (discountCurve.getDiscountFactor(model,periodStart)/discountCurve.getDiscountFactor(model,firstPeriodStartDate));
really what we want? Note that the lib supports running swaps. So firstPeriodStartDate < 0 and firstPeriodStartDate < evaluationTime.
I have to think a bit about this, but I assume that firstPeriodStartDate should be replaced by either evaluationTime or the largest periodStart smaller than evaluationTime.
Yes your are right. Using firstPeriodStartDate only works in a special case (standard CCY swap that was traded in t=0). I think one should replace firstPeriodStartDate with the spotOffset of the corresponding FX which is usually t+2bd using the union of the businessday calendars of the 2 involved currencies and further rolled Forward if this is a USD holiday. There are also exceptions to that, e.g. USD/CAD settles t+1bd. As I do not have that information available (at on point one may have to think about adding an fxSpot object to the model and a currency to every SwapLeg and other product) I would use t+2bd using the calendar of the SwapLeg as an Approximation.
What do you think about that?
Are you ok with using t+2bd using the calendar of the SwapLeg as an approximation of the spotDate of the FX? However, this would leave me with the issue of identifying the date that corresponds to the given evaluationTime which is imO impossible in the current set-up.
I (still) think that an AnalyticalModel should have a referenceDate which is the common (!) referenceDate of all curves and volatilitySurfaces it contains. In that case I could calculate the
See Integration of SwapLegWithResetting into SwapLeg v2
What is this PR for?
SwapLeg: Added member discountCurveForNotionalResetName (if set to discountCurveName then there is no notional reset)
What type of PR is it?
Refactoring, Bug Fix