Package com.opengamma.analytics.financial.forex.calculator

Examples of com.opengamma.analytics.financial.forex.calculator.PresentValueCallSpreadBlackForexCalculator


  /**
   * Tests the present value. Method vs Calculator.
   */
  public void presentValueMethodVCalculator() {
    final MultipleCurrencyAmount pv1 = METHOD_DIGITAL_SPREAD.presentValue(FOREX_DIGITAL_CALL_DOM, SMILE_BUNDLE);
    final PresentValueCallSpreadBlackForexCalculator calculator = new PresentValueCallSpreadBlackForexCalculator(STANDARD_SPREAD);
    final MultipleCurrencyAmount pvCalculator = FOREX_DIGITAL_CALL_DOM.accept(calculator, SMILE_BUNDLE);
    assertEquals("Forex Digital option: call spread method - present value", pv1.getAmount(USD), pvCalculator.getAmount(USD), TOLERANCE_PV);
  }
View Full Code Here


  @Override
  protected Set<ComputedValue> getResult(final InstrumentDerivative fxDigital, final ForexOptionDataBundle<?> data, final ComputationTarget target,
      final Set<ValueRequirement> desiredValues, final FunctionInputs inputs, final ValueSpecification spec, final FunctionExecutionContext executionContext) {
    final String spreadName = Iterables.getOnlyElement(desiredValues).getConstraint(CalculationPropertyNamesAndValues.PROPERTY_CALL_SPREAD_VALUE);
    final double spread = Double.parseDouble(spreadName);
    final PresentValueCallSpreadBlackForexCalculator calculator = new PresentValueCallSpreadBlackForexCalculator(spread);
    final MultipleCurrencyAmount result = fxDigital.accept(calculator, data);
    final CurrencyAmount ca = result.getCurrencyAmounts()[0];
    final String expectedCurrency = spec.getProperty(ValuePropertyNames.CURRENCY);
    if (!expectedCurrency.equals(ca.getCurrency().getCode())) {
      throw new OpenGammaRuntimeException("Expected currency " + expectedCurrency + " does not equal result currency " + ca.getCurrency());
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.forex.calculator.PresentValueCallSpreadBlackForexCalculator

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.