Package com.opengamma.analytics.financial.provider.sensitivity.multicurve

Examples of com.opengamma.analytics.financial.provider.sensitivity.multicurve.MulticurveSensitivity


   * @param priceSensitivity The sensitivity of the futures price.
   * @return The present value rate sensitivity.
   */
  public MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final InterestRateFutureTransaction futures, final MulticurveSensitivity priceSensitivity) {
    Validate.notNull(futures, "Future");
    MulticurveSensitivity result = priceSensitivity.multipliedBy(futures.getPaymentAccrualFactor() * futures.getNotional() * futures.getQuantity());
    return MultipleCurrencyMulticurveSensitivity.of(futures.getCurrency(), result);
  }
View Full Code Here


      final DoublesPair dfSensi = new DoublesPair(cfe.getNthPayment(loopcf).getPaymentTime(), -cfe.getNthPayment(loopcf).getPaymentTime() * df[loopcf] * dfBar[loopcf]);
      listDfSensi.add(dfSensi);
    }
    final Map<String, List<DoublesPair>> pvsDF = new HashMap<>();
    pvsDF.put(multicurves.getName(ccy), listDfSensi);
    MulticurveSensitivity sensitivity = MulticurveSensitivity.ofYieldDiscounting(pvsDF);
    final Map<Double, MulticurveSensitivity> cfeCurveSensi = futures.getUnderlyingSwap().accept(CFECSC, multicurves);
    for (int loopcf = 0; loopcf < cfe.getNumberOfPayments(); loopcf++) {
      final MulticurveSensitivity sensiCfe = cfeCurveSensi.get(cfe.getNthPayment(loopcf).getPaymentTime());
      if (!(sensiCfe == null)) { // There is some sensitivity to that cfe.
        sensitivity = sensitivity.plus(sensiCfe.multipliedBy(cfeAmountBar[loopcf]));
      }
    }
    return sensitivity;
  }
View Full Code Here

  public MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final BondFutureOptionPremiumTransaction transaction, final BlackBondFuturesSmilePriceProviderInterface blackPrice) {
    ArgumentChecker.notNull(transaction, "transaction");
    ArgumentChecker.notNull(blackPrice, "Black parameters");
    final MultipleCurrencyMulticurveSensitivity premiumSensitivity = METHOD_PAY_FIXED.presentValueCurveSensitivity(transaction.getPremium(), blackPrice.getMulticurveProvider());
    final MulticurveSensitivity securitySensitivity = METHOD_SECURITY.priceCurveSensitivity(transaction.getUnderlyingOption(), blackPrice);
    return premiumSensitivity.plus(MultipleCurrencyMulticurveSensitivity.of(transaction.getCurrency(),
        securitySensitivity.multipliedBy(transaction.getQuantity() * transaction.getUnderlyingOption().getUnderlyingFuture().getNotional())));
  }
View Full Code Here

      if (priceFromBond[loopbasket] < priceMin) {
        priceMin = priceFromBond[loopbasket];
        indexCTD = loopbasket;
      }
    }
    MulticurveSensitivity result = BOND_METHOD.dirtyPriceCurveSensitivity(futures.getDeliveryBasket()[indexCTD], issuerMulticurves);
    return result.multipliedBy(1.0 / futures.getConversionFactor()[indexCTD]);
  }
View Full Code Here

   * @param multicurves The multi-curve provider.
   * @return The present value rate sensitivity.
   */
  public MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final FederalFundsFutureTransaction futures, final MulticurveProviderInterface multicurves) {
    ArgumentChecker.notNull(futures, "Futures");
    MulticurveSensitivity priceSensi = METHOD_FFFUT_SEC.priceCurveSensitivity(futures.getUnderlyingFuture(), multicurves);
    MulticurveSensitivity result = priceSensi.multipliedBy(futures.getUnderlyingFuture().getPaymentAccrualFactor() * futures.getUnderlyingFuture().getNotional() * futures.getQuantity());
    return MultipleCurrencyMulticurveSensitivity.of(futures.getUnderlyingFuture().getCurrency(), result);
  }
View Full Code Here

    final BlackFunctionData dataBlack = new BlackFunctionData(priceFuture, 1.0, volatility);
    final double[] priceAdjoint = BLACK_FUNCTION.getPriceAdjoint(option, dataBlack);
    // Backward sweep
    final double priceBar = 1.0;
    final double priceFutureBar = priceAdjoint[1] * priceBar;
    final MulticurveSensitivity priceFutureDerivative = METHOD_FUTURE.priceCurveSensitivity(security.getUnderlyingFuture(), blackPrice.getIssuerProvider());
    return priceFutureDerivative.multipliedBy(priceFutureBar);
  }
View Full Code Here

   * @return The present value curve sensitivity.
   */
  public MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final InterestRateFutureOptionMarginTransaction transaction, final DATA_TYPE data) {
    ArgumentChecker.notNull(transaction, "Transaction on option on STIR futures");
    ArgumentChecker.notNull(data, "data provider");
    MulticurveSensitivity securitySensitivity = _methodSecurity.priceCurveSensitivity(transaction.getUnderlyingOption(), data);
    return MultipleCurrencyMulticurveSensitivity.of(
        transaction.getCurrency(),
        securitySensitivity.multipliedBy(transaction.getQuantity() * transaction.getUnderlyingOption().getUnderlyingFuture().getNotional()
            * transaction.getUnderlyingOption().getUnderlyingFuture().getPaymentAccrualFactor()));
  }
View Full Code Here

    ArgumentChecker.notNull(black, "Black provider");
    final MulticurveProviderInterface multicurve = black.getMulticurveProvider();
    final EuropeanVanillaOption option = new EuropeanVanillaOption(cap.getStrike(), cap.getFixingTime(), cap.isCap());
    final double forward = multicurve.getForwardRate(cap.getIndex(), cap.getFixingPeriodStartTime(), cap.getFixingPeriodEndTime(), cap.getFixingAccrualFactor());
    final double df = multicurve.getDiscountFactor(cap.getCurrency(), cap.getPaymentTime());
    final MulticurveSensitivity forwardDr = MulticurveSensitivity.ofForward(multicurve.getName(cap.getIndex()),
        new ForwardSensitivity(cap.getFixingPeriodStartTime(), cap.getFixingPeriodEndTime(), cap.getFixingAccrualFactor(), 1.0));
    final double dfDr = -cap.getPaymentTime() * df;
    final double volatility = black.getBlackParameters().getVolatility(cap.getFixingTime(), cap.getStrike());
    final BlackFunctionData dataBlack = new BlackFunctionData(forward, 1.0, volatility);
    final double[] bsAdjoint = BLACK_FUNCTION.getPriceAdjoint(option, dataBlack);
    final List<DoublesPair> list = new ArrayList<>();
    list.add(new DoublesPair(cap.getPaymentTime(), dfDr));
    final Map<String, List<DoublesPair>> resultMap = new HashMap<>();
    resultMap.put(multicurve.getName(cap.getCurrency()), list);
    MulticurveSensitivity result = MulticurveSensitivity.ofYieldDiscounting(resultMap);
    result = result.multipliedBy(bsAdjoint[0]);
    result = result.plus(forwardDr.multipliedBy(df * bsAdjoint[1]));
    result = result.multipliedBy(cap.getNotional() * cap.getPaymentYearFraction());
    return MultipleCurrencyMulticurveSensitivity.of(cap.getCurrency(), result);
  }
View Full Code Here

  /**
   * Default constructor, creating an empty HashMap for the sensitivity.
   */
  public InflationSensitivity() {
    _multicurveSensitivity = new MulticurveSensitivity();
    _sensitivityPriceCurve = new HashMap<>();
  }
View Full Code Here

   * @param other The sensitivity to add.
   * @return The total sensitivity.
   */
  public InflationSensitivity plus(final InflationSensitivity other) {
    ArgumentChecker.notNull(other, "sensitivity");
    final MulticurveSensitivity resultMulticurve = _multicurveSensitivity.plus(other._multicurveSensitivity);
    final Map<String, List<DoublesPair>> resultPrice = MulticurveSensitivityUtils.plus(_sensitivityPriceCurve, other._sensitivityPriceCurve);
    return new InflationSensitivity(resultMulticurve, resultPrice);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.provider.sensitivity.multicurve.MulticurveSensitivity

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.