Package com.opengamma.analytics.financial.interestrate

Examples of com.opengamma.analytics.financial.interestrate.InstrumentDerivative.accept()


  /**
   * Tests the TodayPaymentCalculator for forex transactions.
   */
  public void forexTodayPaymentBeforeFarDate() {
    final InstrumentDerivative fx = FX_SWAP_DEFINITION.toDerivative(FAR_DATE.minusDays(1));
    final MultipleCurrencyAmount cash = fx.accept(TPC);
    assertEquals("TodayPaymentCalculator: forex", 0.0, cash.getAmount(FX_SWAP_DEFINITION.getFarLeg().getCurrency1()), TOLERANCE_PV);
    assertEquals("TodayPaymentCalculator: forex", 0.0, cash.getAmount(FX_SWAP_DEFINITION.getFarLeg().getCurrency2()), TOLERANCE_PV);
    assertEquals("TodayPaymentCalculator: forex", 2, cash.getCurrencyAmounts().length);
  }

View Full Code Here


  /**
   * Tests the TodayPaymentCalculator for forex transactions.
   */
  public void forexTodayPaymentOnFarDate() {
    final InstrumentDerivative fx = FX_SWAP_DEFINITION.toDerivative(FAR_DATE);
    final MultipleCurrencyAmount cash = fx.accept(TPC);
    assertEquals("TodayPaymentCalculator: forex", FX_SWAP_DEFINITION.getFarLeg().getPaymentCurrency1().getReferenceAmount(),
        cash.getAmount(FX_SWAP_DEFINITION.getFarLeg().getCurrency1()), TOLERANCE_PV);
    assertEquals("TodayPaymentCalculator: forex", FX_SWAP_DEFINITION.getFarLeg().getPaymentCurrency2().getReferenceAmount(),
        cash.getAmount(FX_SWAP_DEFINITION.getFarLeg().getCurrency2()), TOLERANCE_PV);
    assertEquals("TodayPaymentCalculator: forex", 2, cash.getCurrencyAmounts().length);
View Full Code Here

    final ValueSpecification resultSpec = new ValueSpecification(ValueRequirementNames.YIELD_CURVE_NODE_SENSITIVITIES, target.toSpecification(),
        createValueProperties(target, desiredValue).get());

    // 4. Compute sensitivity to the discount rate, then use chain rule to distribute sensitivity across the curve
    final DoubleMatrix1D sensVector = derivative.accept(getCalculator(), getFutureDataBundle(security, inputs, timeSeriesBundle, desiredValue));
    return YieldCurveNodeSensitivitiesHelper.getInstrumentLabelledSensitivitiesForCurve(fundingCurveName, curveBundle, sensVector, curveSpec, resultSpec);
  }
}
View Full Code Here

      if (_calcTypeParRate) {
        marketValues[i] = marketValue;
      }
      derivatives.add(derivative);
      initialRatesGuess[i] = marketValue;
      nodeTimes[i] = derivative.accept(LAST_DATE_CALCULATOR);
      i++;
    }
    ParallelArrayBinarySort.parallelBinarySort(nodeTimes, initialRatesGuess);
    final LinkedHashMap<String, double[]> curveKnots = new LinkedHashMap<>();
    curveKnots.put(curveName, nodeTimes);
View Full Code Here

      int ii = 0;
      final String[] curveNames = new String[] {curveName, curveName };
      final YieldAndDiscountCurve[] curves = new YieldAndDiscountCurve[] {curve, curve };
      final YieldCurveBundle curveBundle = new YieldCurveBundle(curveNames, curves);
      for (final InstrumentDerivative derivative : derivatives) {
        couponSensitivities[ii++] = derivative.accept(getCouponSensitivityCalculator(), curveBundle);
      }
      result.add(new ComputedValue(new ValueSpecification(ValueRequirementNames.PRESENT_VALUE_COUPON_SENSITIVITY, targetSpec, properties.get()), new DoubleMatrix1D(couponSensitivities)));
    }
    if (createYieldCurve) {
      result.add(new ComputedValue(new ValueSpecification(ValueRequirementNames.YIELD_CURVE, targetSpec, properties.with(ValuePropertyNames.CURVE, curveName).get()), curve));
View Full Code Here

      } // else PV, leave at 0

      derivatives.add(derivative);
      initialRatesGuess[i] = marketValue;
      i++;
      fundingNodeTimes[fundingIndex] = derivative.accept(LAST_DATE_CALCULATOR);
      fundingIndex++;
    }
    for (final FixedIncomeStripWithSecurity strip : forwardCurveSpecificationWithSecurities.getStrips()) {
      final Double forwardMarketValue = forwardMarketData.getDataPoint(strip.getSecurityIdentifier());
      if (forwardMarketValue == null) {
View Full Code Here

        marketValues[i] = marketValue;
      }
      derivatives.add(derivative);
      initialRatesGuess[i] = marketValue;
      i++;
      forwardNodeTimes[forwardIndex] = derivative.accept(LAST_DATE_CALCULATOR);
      forwardIndex++;
    }
    final LinkedHashMap<String, double[]> curveNodes = new LinkedHashMap<>();
    final LinkedHashMap<String, Interpolator1D> interpolators = new LinkedHashMap<>();
    curveNodes.put(fundingCurveName, fundingNodeTimes);
View Full Code Here

      int ii = 0;
      final String[] curveNames = new String[] {forwardCurveName, fundingCurveName };
      final YieldAndDiscountCurve[] curves = new YieldAndDiscountCurve[] {forwardCurve, fundingCurve };
      final YieldCurveBundle curveBundle = new YieldCurveBundle(curveNames, curves);
      for (final InstrumentDerivative derivative : derivatives) {
        couponSensitivities[ii++] = derivative.accept(getCouponSensitivityCalculator(), curveBundle);
      }
      final ValueProperties couponProperties = createValueProperties().with(YieldCurveFunction.PROPERTY_FORWARD_CURVE, forwardCurveName)
          .with(YieldCurveFunction.PROPERTY_FUNDING_CURVE, fundingCurveName).get();
      result.add(new ComputedValue(new ValueSpecification(ValueRequirementNames.PRESENT_VALUE_COUPON_SENSITIVITY, targetSpec, couponProperties), new DoubleMatrix1D(couponSensitivities)));
    }
View Full Code Here

  @Override
  protected Set<ComputedValue> getResult(final InstrumentDerivative irFutureOptionTransaction, final YieldCurveWithBlackCubeBundle curveBundle, final ValueSpecification spec, final Set<ValueRequirement> desiredValues) {
    ArgumentChecker.isTrue(irFutureOptionTransaction instanceof InterestRateFutureOptionMarginTransaction,
        "InterestRateFutureOptionMarginTransaction expected. " + irFutureOptionTransaction.getClass().toString() + " found.");
    final InstrumentDerivative irFutureOptionSecurity = ((InterestRateFutureOptionMarginTransaction) irFutureOptionTransaction).getUnderlyingOption();
    final double delta = irFutureOptionSecurity.accept(CALCULATOR, curveBundle);
    return Collections.singleton(new ComputedValue(spec, delta));
  }
}
View Full Code Here

      throw new OpenGammaRuntimeException("Could not find curve calculation configuration named " + curveCalculationConfigName);
    }
    final String[] curveNames = curveCalculationConfig.getYieldCurveNames();
    final YieldCurveBundle curves = YieldCurveFunctionUtils.getYieldCurves(inputs, curveCalculationConfig);
    final InstrumentDerivative irFutureOption = _dataConverter.convert(target.getTrade().getSecurity(), irFutureOptionDefinition, now, curveNames, timeSeries);
    final double price = irFutureOption.accept(new MyDerivativeVisitor(target, inputs, curves));
    final ValueSpecification valueSpecification = new ValueSpecification(ValueRequirementNames.PRESENT_VALUE, target.toSpecification(), createValueProperties()
        .with(ValuePropertyNames.CURRENCY, FinancialSecurityUtils.getCurrency(target.getTrade().getSecurity()).getCode())
        .with(ValuePropertyNames.CURVE_CALCULATION_CONFIG, curveCalculationConfigName)
        .with(ValuePropertyNames.SURFACE, surfaceName)
        .with(ValuePropertyNames.SMILE_FITTING_METHOD, "Heston")
View Full Code Here

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.