Package com.opengamma.analytics.financial.horizon

Source Code of com.opengamma.analytics.financial.horizon.ConstantSpreadVolatilitySurfaceRolldownFunction

/**
* Copyright (C) 2012 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.analytics.financial.horizon;

import com.opengamma.analytics.financial.model.volatility.surface.VolatilitySurface;
import com.opengamma.analytics.math.function.Function;
import com.opengamma.analytics.math.surface.FunctionalDoublesSurface;
import com.opengamma.analytics.math.surface.Surface;

/**
*
*/
public class ConstantSpreadVolatilitySurfaceRolldownFunction implements RolldownFunction<VolatilitySurface> {

  @Override
  public VolatilitySurface rollDown(final VolatilitySurface volatilitySurface, final double time) {
    final Surface<Double, Double, Double> surface = volatilitySurface.getSurface();
    final Function<Double, Double> shiftedFunction = new Function<Double, Double>() {

      @Override
      public Double evaluate(final Double... x) {
        return surface.getZValue(x[0] + time, x[1]);
      }

    };
    return new VolatilitySurface(FunctionalDoublesSurface.from(shiftedFunction));
  }

}
TOP

Related Classes of com.opengamma.analytics.financial.horizon.ConstantSpreadVolatilitySurfaceRolldownFunction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.