Tabnine Logo
ConstantSurface
Code IndexAdd Tabnine to your IDE (free)

How to use
ConstantSurface
in
com.opengamma.strata.market.surface

Best Java code snippets using com.opengamma.strata.market.surface.ConstantSurface (Showing top 20 results out of 315)

origin: OpenGamma/Strata

public void test_of_String() {
 ConstantSurface test = ConstantSurface.of(NAME, VALUE);
 assertThat(test.getName()).isEqualTo(SURFACE_NAME);
 assertThat(test.getZValue()).isEqualTo(VALUE);
 assertThat(test.getParameterCount()).isEqualTo(1);
 assertThat(test.getParameter(0)).isEqualTo(VALUE);
 assertThat(test.getParameterMetadata(0)).isEqualTo(ParameterMetadata.empty());
 assertThat(test.withParameter(0, 2d)).isEqualTo(ConstantSurface.of(NAME, 2d));
 assertThat(test.withPerturbation((i, v, m) -> v + 1d)).isEqualTo(ConstantSurface.of(NAME, VALUE + 1d));
 assertThat(test.getMetadata()).isEqualTo(METADATA);
 assertThat(test.withMetadata(METADATA2)).isEqualTo(ConstantSurface.of(METADATA2, VALUE));
}
origin: OpenGamma/Strata

@Override
public ConstantSurface withPerturbation(ParameterPerturbation perturbation) {
 return new ConstantSurface(metadata, perturbation.perturbParameter(0, zValue, getParameterMetadata(0)));
}
origin: OpenGamma/Strata

@Override
public UnitParameterSensitivity zValueParameterSensitivity(double x, double y) {
 return createParameterSensitivity(SENSITIVITY);
}
origin: OpenGamma/Strata

@Override
protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
 switch (propertyName.hashCode()) {
  case -450004177:  // metadata
   return ((ConstantSurface) bean).getMetadata();
  case -719790825:  // zValue
   return ((ConstantSurface) bean).getZValue();
 }
 return super.propertyGet(bean, propertyName, quiet);
}
origin: OpenGamma/Strata

/**
 * Creates a constant surface with a specific value.
 * 
 * @param name  the surface name
 * @param zValue  the constant z-value
 * @return the surface
 */
public static ConstantSurface of(String name, double zValue) {
 return of(SurfaceName.of(name), zValue);
}
origin: OpenGamma/Strata

@Test(enabled = true)
public void log_normal_atm() {
 double beta = 0.50;
 Surface betaSurface = ConstantSurface.of("Beta", beta)
   .withMetadata(DefaultSurfaceMetadata.builder()
     .xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.YEAR_FRACTION)
     .zValueType(ValueType.SABR_BETA).surfaceName("Beta").build());
 double shift = 0.0000;
 Surface shiftSurface = ConstantSurface.of("Shift", shift)
   .withMetadata(DefaultSurfaceMetadata.builder()
     .xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.YEAR_FRACTION).surfaceName("Shift").build());
 SabrParametersSwaptionVolatilities calibratedSmile = SABR_CALIBRATION.calibrateWithFixedBetaAndShift(
origin: OpenGamma/Strata

public void test_lookup() {
 ConstantSurface test = ConstantSurface.of(SURFACE_NAME, VALUE);
 assertThat(test.zValue(0d, 0d)).isEqualTo(VALUE);
 assertThat(test.zValue(-10d, 10d)).isEqualTo(VALUE);
 assertThat(test.zValue(100d, -100d)).isEqualTo(VALUE);
 assertThat(test.zValueParameterSensitivity(0d, 0d).getSensitivity().get(0)).isEqualTo(1d);
 assertThat(test.zValueParameterSensitivity(-10d, 10d).getSensitivity().get(0)).isEqualTo(1d);
 assertThat(test.zValueParameterSensitivity(100d, -100d).getSensitivity().get(0)).isEqualTo(1d);
}
origin: OpenGamma/Strata

@Override
public ConstantSurface build() {
 return new ConstantSurface(
   metadata,
   zValue);
}
origin: OpenGamma/Strata

public void coverage() {
 ConstantSurface test = ConstantSurface.of(SURFACE_NAME, VALUE);
 coverImmutableBean(test);
 ConstantSurface test2 = ConstantSurface.of("Coverage", 9d);
 coverBeanEquals(test, test2);
}
origin: OpenGamma/Strata

public void normal_atm() {
 double beta = 0.50;
 Surface betaSurface = ConstantSurface.of("Beta", beta)
   .withMetadata(DefaultSurfaceMetadata.builder()
     .xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.YEAR_FRACTION)
     .zValueType(ValueType.SABR_BETA).surfaceName("Beta").build());
 double shift = 0.0300;
 Surface shiftSurface = ConstantSurface.of("Shift", shift)
   .withMetadata(DefaultSurfaceMetadata.builder()
     .xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.YEAR_FRACTION).surfaceName("Shift").build());
 SabrParametersSwaptionVolatilities calibratedSmile = SABR_CALIBRATION.calibrateWithFixedBetaAndShift(
origin: OpenGamma/Strata

public void test_lookup_byPair() {
 ConstantSurface test = ConstantSurface.of(SURFACE_NAME, VALUE);
 assertThat(test.zValue(DoublesPair.of(0d, 0d))).isEqualTo(VALUE);
 assertThat(test.zValue(DoublesPair.of(-10d, 10d))).isEqualTo(VALUE);
 assertThat(test.zValue(DoublesPair.of(100d, -100d))).isEqualTo(VALUE);
 assertThat(test.zValueParameterSensitivity(DoublesPair.of(0d, 0d)).getSensitivity().get(0)).isEqualTo(1d);
 assertThat(test.zValueParameterSensitivity(DoublesPair.of(-10d, 10d)).getSensitivity().get(0)).isEqualTo(1d);
 assertThat(test.zValueParameterSensitivity(DoublesPair.of(100d, -100d)).getSensitivity().get(0)).isEqualTo(1d);
}
origin: OpenGamma/Strata

/**
 * Creates a constant surface with a specific value.
 * 
 * @param metadata  the surface metadata
 * @param zValue  the constant z-value
 * @return the surface
 */
public static ConstantSurface of(SurfaceMetadata metadata, double zValue) {
 return new ConstantSurface(metadata, zValue);
}
origin: OpenGamma/Strata

public void test_of_SurfaceName() {
 ConstantSurface test = ConstantSurface.of(SURFACE_NAME, VALUE);
 assertThat(test.getName()).isEqualTo(SURFACE_NAME);
 assertThat(test.getZValue()).isEqualTo(VALUE);
 assertThat(test.getParameterCount()).isEqualTo(1);
 assertThat(test.getParameter(0)).isEqualTo(VALUE);
 assertThat(test.getParameterMetadata(0)).isEqualTo(ParameterMetadata.empty());
 assertThat(test.withParameter(0, 2d)).isEqualTo(ConstantSurface.of(NAME, 2d));
 assertThat(test.withPerturbation((i, v, m) -> v + 1d)).isEqualTo(ConstantSurface.of(NAME, VALUE + 1d));
 assertThat(test.getMetadata()).isEqualTo(METADATA);
 assertThat(test.withMetadata(METADATA2)).isEqualTo(ConstantSurface.of(METADATA2, VALUE));
}
origin: OpenGamma/Strata

public void test_serialization() {
 ConstantSurface test = ConstantSurface.of(SURFACE_NAME, VALUE);
 assertSerialization(test);
}
origin: OpenGamma/Strata

@Test
public void log_normal_cube() {
 double beta = 0.50;
 Surface betaSurface = ConstantSurface.of("Beta", beta)
   .withMetadata(DefaultSurfaceMetadata.builder()
     .xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.YEAR_FRACTION)
     .zValueType(ValueType.SABR_BETA).surfaceName("Beta").build());
 double shift = 0.0300;
 Surface shiftSurface = ConstantSurface.of("Shift", shift)
   .withMetadata(DefaultSurfaceMetadata.builder()
     .xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.YEAR_FRACTION).surfaceName("Shift").build());
 SabrParametersSwaptionVolatilities calibrated = SABR_CALIBRATION.calibrateWithFixedBetaAndShift(
origin: OpenGamma/Strata

private Object readResolve() {
 return new ConstantSurface(metadata, zValue);
}
origin: OpenGamma/Strata

public void test_of_SurfaceMetadata() {
 ConstantSurface test = ConstantSurface.of(METADATA, VALUE);
 assertThat(test.getName()).isEqualTo(SURFACE_NAME);
 assertThat(test.getZValue()).isEqualTo(VALUE);
 assertThat(test.getParameterCount()).isEqualTo(1);
 assertThat(test.getParameter(0)).isEqualTo(VALUE);
 assertThat(test.getParameterMetadata(0)).isEqualTo(ParameterMetadata.empty());
 assertThat(test.withParameter(0, 2d)).isEqualTo(ConstantSurface.of(NAME, 2d));
 assertThat(test.withPerturbation((i, v, m) -> v + 1d)).isEqualTo(ConstantSurface.of(NAME, VALUE + 1d));
 assertThat(test.getMetadata()).isEqualTo(METADATA);
 assertThat(test.withMetadata(METADATA2)).isEqualTo(ConstantSurface.of(METADATA2, VALUE));
}
origin: OpenGamma/Strata

strikeList.add(strikes.get(i));
volList.add(volatilityData.get(i));
ConstantSurface constVolSurface = ConstantSurface.of(metadata, volatilityData.get(i));
IborCapletFloorletVolatilities vols = volatilityFunction.apply(constVolSurface);
timeList.add(vols.relativeTime(capFloor.getFinalFixingDateTime()));
origin: OpenGamma/Strata

@Test
public void normal_cube() {
 double beta = 0.50;
 Surface betaSurface = ConstantSurface.of("Beta", beta)
   .withMetadata(DefaultSurfaceMetadata.builder()
     .xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.YEAR_FRACTION)
     .zValueType(ValueType.SABR_BETA).surfaceName("Beta").build());
 double shift = 0.0300;
 Surface shiftSurface = ConstantSurface.of("Shift", shift)
   .withMetadata(DefaultSurfaceMetadata.builder()
     .xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.YEAR_FRACTION).surfaceName("Shift").build());
 SabrParametersSwaptionVolatilities calibrated = SABR_CALIBRATION.calibrateWithFixedBetaAndShift(
origin: OpenGamma/Strata

@Override
public ConstantSurface withParameter(int parameterIndex, double newValue) {
 Preconditions.checkElementIndex(parameterIndex, 1);
 return new ConstantSurface(metadata, newValue);
}
com.opengamma.strata.market.surfaceConstantSurface

Javadoc

A surface based on a single constant value.

This class defines a surface in terms of a single parameter, the constant value. When queried, #zValue(double,double) always returns the constant value. The sensitivity is 1 and the first derivative is 0.

The surface has one parameter, the value of the constant.

Most used methods

  • of
    Creates a constant surface with a specific value.
  • getMetadata
    Gets the surface metadata. The metadata will have not have parameter metadata.
  • getParameterMetadata
  • getZValue
    Gets the single z-value.
  • withMetadata
  • <init>
  • createParameterSensitivity
  • getName
  • getParameter
  • getParameterCount
  • withParameter
  • withPerturbation
  • withParameter,
  • withPerturbation,
  • zValue,
  • zValueParameterSensitivity

Popular in Java

  • Reactive rest calls using spring rest template
  • setRequestProperty (URLConnection)
  • getExternalFilesDir (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Kernel (java.awt.image)
  • Socket (java.net)
    Provides a client-side TCP socket.
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • JTextField (javax.swing)
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now