//------------------------------------------------------------------------- /// <summary> /// Explain present value builder used to build large explain map from the individual legs. /// </summary> /// <param name="leg"> the swap log </param> /// <param name="provider"> the rates provider </param> /// <param name="builder"> the explain map builder which will be populated but the leg </param> internal virtual void explainPresentValueInternal(ResolvedSwapLeg leg, RatesProvider provider, ExplainMapBuilder builder) { builder.put(ExplainKey.ENTRY_TYPE, "Leg"); builder.put(ExplainKey.PAY_RECEIVE, leg.PayReceive); builder.put(ExplainKey.LEG_TYPE, leg.Type.ToString()); foreach (SwapPaymentPeriod period in leg.PaymentPeriods) { builder.addListEntry(ExplainKey.PAYMENT_PERIODS, child => paymentPeriodPricer.explainPresentValue(period, provider, child)); } foreach (SwapPaymentEvent @event in leg.PaymentEvents) { builder.addListEntry(ExplainKey.PAYMENT_EVENTS, child => paymentEventPricer.explainPresentValue(@event, provider, child)); } builder.put(ExplainKey.FORECAST_VALUE, forecastValue(leg, provider)); builder.put(ExplainKey.PRESENT_VALUE, presentValue(leg, provider)); }