Package com.opengamma.financial.analytics.volatility.cube

Examples of com.opengamma.financial.analytics.volatility.cube.SyntheticSwaptionVolatilityCubeDefinitionSource


  }

  @Override
  public CompiledFunctionDefinition compile(final FunctionCompilationContext compilationContext, final Instant atInstant) {
    final ConfigSource configSource = OpenGammaCompilationContext.getConfigSource(compilationContext);
    final SyntheticSwaptionVolatilityCubeDefinitionSource definitionSource = new SyntheticSwaptionVolatilityCubeDefinitionSource(configSource);
    final ConfigDBSwaptionVolatilityCubeSpecificationSource specificationSource = new ConfigDBSwaptionVolatilityCubeSpecificationSource(configSource);
    final ZonedDateTime atZDT = ZonedDateTime.ofInstant(atInstant, ZoneOffset.UTC);
    return new AbstractInvokingCompiledFunction() {

      @SuppressWarnings("synthetic-access")
      @Override
      public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
        final ValueRequirement desiredValue = desiredValues.iterator().next();
        final String cubeName = desiredValue.getConstraint(ValuePropertyNames.CUBE);
        final String definitionName = desiredValue.getConstraint(SurfaceAndCubePropertyNames.PROPERTY_CUBE_DEFINITION);
        final String specificationName = desiredValue.getConstraint(SurfaceAndCubePropertyNames.PROPERTY_CUBE_SPECIFICATION);
        final Currency currency = target.getValue(PrimitiveComputationTargetType.CURRENCY);
        final String fullSpecificationName = specificationName + "_" + currency.getCode();
        final String fullDefinitionName = definitionName + "_" + currency.getCode();
        final SwaptionVolatilityCubeSpecification specification = specificationSource.getSpecification(fullSpecificationName);
        if (specification == null) {
          throw new OpenGammaRuntimeException("Could not get swaption volatility cube specification named " + fullSpecificationName);
        }
        final VolatilityCubeDefinition definition = definitionSource.getDefinition(currency, fullDefinitionName);
        if (definition == null) {
          throw new OpenGammaRuntimeException("Could not get swaption volatility cube definition named " + fullDefinitionName);
        }
        final CubeInstrumentProvider<Tenor, Tenor, Double> provider = (CubeInstrumentProvider<Tenor, Tenor, Double>) specification.getCubeInstrumentProvider();
        final Map<VolatilityPoint, Double> data = new HashMap<VolatilityPoint, Double>();
View Full Code Here

TOP

Related Classes of com.opengamma.financial.analytics.volatility.cube.SyntheticSwaptionVolatilityCubeDefinitionSource

Copyright © 2018 www.massapicom. 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.