com.opengamma.strata.pricer.swap.SwapPaymentEventPricer Maven / Gradle / Ivy
/*
* Copyright (C) 2014 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.strata.pricer.swap;
import com.opengamma.strata.basics.currency.MultiCurrencyAmount;
import com.opengamma.strata.market.explain.ExplainMapBuilder;
import com.opengamma.strata.market.sensitivity.PointSensitivityBuilder;
import com.opengamma.strata.pricer.impl.swap.DispatchingSwapPaymentEventPricer;
import com.opengamma.strata.pricer.rate.RatesProvider;
import com.opengamma.strata.product.swap.SwapPaymentEvent;
/**
* Pricer for payment events.
*
* This function provides the ability to price a {@link SwapPaymentEvent}.
*
* Implementations must be immutable and thread-safe functions.
*
* @param the type of event
*/
public interface SwapPaymentEventPricer {
/**
* Returns the standard instance of the function.
*
* Use this method to avoid a direct dependency on the implementation.
*
* @return the payment event pricer
*/
public static SwapPaymentEventPricer standard() {
return DispatchingSwapPaymentEventPricer.DEFAULT;
}
//-------------------------------------------------------------------------
/**
* Calculates the present value of a single payment event.
*
* The amount is expressed in the currency of the event.
* This returns the value of the event with discounting.
*
* The payment date of the event should not be in the past.
* The result of this method for payment dates in the past is undefined.
*
* @param event the event
* @param provider the rates provider
* @return the present value of the event
*/
public abstract double presentValue(T event, RatesProvider provider);
/**
* Calculates the present value sensitivity of a single payment event.
*
* The present value sensitivity of the event is the sensitivity of the present value to
* the underlying curves.
*
* @param event the event
* @param provider the rates provider
* @return the present value curve sensitivity of the event
*/
public abstract PointSensitivityBuilder presentValueSensitivity(T event, RatesProvider provider);
//-------------------------------------------------------------------------
/**
* Calculates the forecast value of a single payment event.
*
* The amount is expressed in the currency of the event.
* This returns the value of the event without discounting.
*
* The payment date of the event should not be in the past.
* The result of this method for payment dates in the past is undefined.
*
* @param event the event
* @param provider the rates provider
* @return the forecast value of the event
*/
public abstract double forecastValue(T event, RatesProvider provider);
/**
* Calculates the forecast value sensitivity of a single payment event.
*
* The forecast value sensitivity of the event is the sensitivity of the forecast value to
* the underlying curves.
*
* @param event the event
* @param provider the rates provider
* @return the forecast value curve sensitivity of the event
*/
public abstract PointSensitivityBuilder forecastValueSensitivity(T event, RatesProvider provider);
//-------------------------------------------------------------------------
/**
* Explains the present value of a single payment event.
*
* This adds information to the {@link ExplainMapBuilder} to aid understanding of the calculation.
*
* @param event the event
* @param provider the rates provider
* @param builder the builder to populate
*/
public abstract void explainPresentValue(
T event,
RatesProvider provider,
ExplainMapBuilder builder);
//-------------------------------------------------------------------------
/**
* Calculates the currency exposure of a single payment event.
*
* @param event the event
* @param provider the rates provider
* @return the currency exposure
*/
public abstract MultiCurrencyAmount currencyExposure(T event, RatesProvider provider);
/**
* Calculates the current cash of a single payment event.
*
* @param event the event
* @param provider the rates provider
* @return the current cash
*/
public abstract double currentCash(T event, RatesProvider provider);
}