/** * Copyright (C) 2012 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.analytics.financial.provider.calculator.discounting; import com.opengamma.analytics.financial.interestrate.InstrumentDerivativeVisitorAdapter; import com.opengamma.analytics.financial.interestrate.swap.derivative.SwapFixedCoupon; import com.opengamma.analytics.financial.interestrate.swap.provider.SwapFixedCouponDiscountingMethod; import com.opengamma.analytics.financial.provider.description.interestrate.ParameterProviderInterface; /** * Compute the spread to be added to the market standard quote of the instrument for which the present value of the instrument is zero. * The notion of "market quote" will depend of each instrument. */ public final class PresentValueBasisPointDiscountingCalculator extends InstrumentDerivativeVisitorAdapter<ParameterProviderInterface, Double> { /** * The unique instance of the calculator. */ private static final PresentValueBasisPointDiscountingCalculator INSTANCE = new PresentValueBasisPointDiscountingCalculator(); /** * Gets the calculator instance. * @return The calculator. */ public static PresentValueBasisPointDiscountingCalculator getInstance() { return INSTANCE; } /** * Constructor. */ private PresentValueBasisPointDiscountingCalculator() { } /** * The methods and calculators. */ private static final SwapFixedCouponDiscountingMethod METHOD_SWAP = SwapFixedCouponDiscountingMethod.getInstance(); @Override public Double visitFixedCouponSwap(final SwapFixedCoupon<?> swap, final ParameterProviderInterface multicurve) { return METHOD_SWAP.presentValueBasisPoint(swap, multicurve.getMulticurveProvider()); } }