Examples of accept()


Examples of com.opengamma.analytics.financial.interestrate.bond.definition.BondFixedSecurity.accept()

    final AnnuityPaymentFixed nominal = new AnnuityPaymentFixed(new PaymentFixed[] {new PaymentFixed(CUR, tau * n, 1, FIVE_PC_CURVE_NAME)});
    final BondFixedSecurity bond = new BondFixedSecurity(nominal, new AnnuityCouponFixed(coupons), 0, 0, 0.5, SimpleYieldConvention.TRUE, 2, FIVE_PC_CURVE_NAME, "S");
    final BondFixedSecurity bondUp = new BondFixedSecurity(nominal, new AnnuityCouponFixed(couponsUp), 0, 0, 0.5, SimpleYieldConvention.TRUE, 2, FIVE_PC_CURVE_NAME, "S");
    final BondFixedSecurity bondDown = new BondFixedSecurity(nominal, new AnnuityCouponFixed(couponsDown), 0, 0, 0.5, SimpleYieldConvention.TRUE, 2, FIVE_PC_CURVE_NAME, "S");
    final double pvUp = bondUp.accept(PVC, CURVES);
    final double pvDown = bondDown.accept(PVC, CURVES);
    final double temp = (pvUp - pvDown) / 2 / DELTA;
    assertEquals(temp, bond.accept(PVCSC, CURVES), 1e-10);
  }

}
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.cash.derivative.Cash.accept()

  public static void parRateDemo(final PrintStream out) {
    final Cash loan = new Cash(ccy, 0.0, t, notional, r, t, yieldCurveName);
    final YieldCurveBundle bundle = getBundle();

    final ParRateCalculator parRateCalculator = ParRateCalculator.getInstance();
    final double parRate = loan.accept(parRateCalculator, bundle);
    out.println(parRate);
  }

  public static void presentValueDemo(final PrintStream out) {
    final Cash loan = new Cash(ccy, 0.0, t, notional, r, t, yieldCurveName);
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.cash.derivative.DepositCounterpart.accept()

   */
  public void presentValueMethodVsCalculator() {
    final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 12, 12);
    final DepositCounterpart deposit = DEPOSIT_CPTY_DEFINITION.toDerivative(referenceDate);
    final MultipleCurrencyAmount pvMethod = METHOD_DEPOSIT.presentValue(deposit, PROVIDER_ISSUER);
    final MultipleCurrencyAmount pvCalculator = deposit.accept(PVC, PROVIDER_ISSUER);
    assertEquals("DepositCounterpartDiscountingMethod: present value", pvMethod, pvCalculator);
  }

  @Test
  /**
 
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.cash.derivative.DepositIbor.accept()

   */
  public void presentValueMethodVsCalculator() {
    final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 12, 12);
    final DepositIbor deposit = DEPOSIT_IBOR_DEFINITION.toDerivative(referenceDate);
    final MultipleCurrencyAmount pvMethod = METHOD_DEPOSIT.presentValue(deposit, PROVIDER_MULTICURVES);
    final MultipleCurrencyAmount pvCalculator = deposit.accept(PVC, PROVIDER_MULTICURVES);
    assertEquals("DepositCounterpartDiscountingMethod: present value", pvMethod, pvCalculator);
  }

  @Test
  /**
 
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.cash.derivative.DepositZero.accept()

    final CurrencyAmount pvMethod = METHOD_DEPOSIT.presentValue(deposit, CURVES);
    final double dfEnd = CURVES.getCurve(CURVES_NAME[0]).getDiscountFactor(deposit.getEndTime());
    final double dfStart = CURVES.getCurve(CURVES_NAME[0]).getDiscountFactor(deposit.getStartTime());
    final double pvExpected = (NOTIONAL + deposit.getInterestAmount()) * dfEnd - NOTIONAL * dfStart;
    assertEquals("DepositDefinition: present value", pvExpected, pvMethod.getAmount(), TOLERANCE_PRICE);
    final double pvCalculator = deposit.accept(PVC, CURVES);
    assertEquals("DepositDefinition: present value", pvMethod.getAmount(), pvCalculator, TOLERANCE_PRICE);
  }

  @Test
  /**
 
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.fra.derivative.ForwardRateAgreement.accept()

    final ForwardRateAgreement fra2 = (ForwardRateAgreement) FRA_DEFINITION.toDerivative(REFERENCE_DATE, CURVE_NAME_2);
    final double parSpread = FRA_METHOD.parSpread(fra2, CURVES_2);
    final ForwardRateAgreementDefinition fra0Definition = new ForwardRateAgreementDefinition(CUR, PAYMENT_DATE, ACCRUAL_START_DATE, ACCRUAL_END_DATE, ACCRUAL_FACTOR_PAYMENT, NOTIONAL, FIXING_DATE,
        INDEX, FRA_RATE + parSpread, CALENDAR);
    final ForwardRateAgreement fra0 = (ForwardRateAgreement) fra0Definition.toDerivative(REFERENCE_DATE, CURVE_NAME_2);
    final double pv0 = fra0.accept(PVC, CURVES_2);
    assertEquals("FRA discounting: par spread", pv0, 0, TOLERANCE_PV);
  }

  @Test
  public void parSpreadMethodVsCalculator() {
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.future.derivative.InterestRateFutureOptionMarginSecurity.accept()

  @Override
  protected Set<ComputedValue> getResult(final InstrumentDerivative irFutureOptionTransaction, final YieldCurveWithBlackCubeBundle data, final ValueSpecification spec, Set<ValueRequirement> desiredValues) {
    Double gamma = null;
    if (irFutureOptionTransaction instanceof InterestRateFutureOptionMarginTransaction) {
      final InterestRateFutureOptionMarginSecurity irFutureOptionSecurity = ((InterestRateFutureOptionMarginTransaction) irFutureOptionTransaction).getUnderlyingOption();
      gamma = irFutureOptionSecurity.accept(CALCULATOR, data);
    } else {
      s_logger.error("Unexpected security type! {}", irFutureOptionTransaction.getClass());
    }
    return Collections.singleton(new ComputedValue(spec, gamma));
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.future.derivative.InterestRateFutureOptionMarginTransaction.accept()

    final MultipleCurrencyAmount theta1_0 = CALC.getTheta(OPTION_TRANSACTION, REFERENCE_DATE, CURVE_NAMES, BLACK_BUNDLE, PRICE_ZERO, ONE_DAY_FWD);
    final MultipleCurrencyAmount theta1_1 = CALC.getTheta(OPTION_TRANSACTION, REFERENCE_DATE, CURVE_NAMES, BLACK_BUNDLE, PRICE_ONE, ONE_DAY_FWD);

    final PresentValueBlackCalculator pvCalculator = PresentValueBlackCalculator.getInstance();
    final InterestRateFutureOptionMarginTransaction derivative = OPTION_TRANSACTION.toDerivative(REFERENCE_DATE, PRICE_ONE, CURVE_NAMES);
    final double pvToday = derivative.accept(pvCalculator, BLACK_BUNDLE);

    assertEquals("InterestRateFutureOption Theta - sensitive to reference rate: ", 0.0, (theta1_0.getAmount(CUR) - theta1_1.getAmount(CUR)) / pvToday, 1e-15);
  }

  @Test(enabled = false)
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.future.derivative.InterestRateFutureTransaction.accept()

    final double fixingPeriodAccrualFactor = 0.267;
    final double paymentAccrualFactor = 0.25;
    final double refrencePrice = 0.0;
    final InterestRateFutureTransaction ir = new InterestRateFutureTransaction(lastTradingTime, iborIndex, fixingPeriodStartTime, fixingPeriodEndTime, fixingPeriodAccrualFactor, refrencePrice, 1,
        paymentAccrualFactor, 1, "S");
    assertEquals(fixingPeriodEndTime, ir.accept(LDC), 1e-12);
  }

  @Test
  public void testFixedCouponAnnuity() {
    final AnnuityCouponFixed annuity = new AnnuityCouponFixed(CUR, new double[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, 1.0, 1.0, true);
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.payments.derivative.CapFloorIbor.accept()

   * It is suggested not to use the standard SABR method as it can lead to exploding prices for long term contracts.
   */
  public void persentValueSABRExtrapolation() {
    final CapFloorIbor capStandard = new CapFloorIbor(EUR, CAP_LONG.getFixingPeriodEndTime(), CAP_LONG.getPaymentYearFraction(), NOTIONAL, CAP_LONG.getFixingTime(), EURIBOR6M,
        CAP_LONG.getFixingPeriodStartTime(), CAP_LONG.getFixingPeriodEndTime(), CAP_LONG.getFixingAccrualFactor(), STRIKE, IS_CAP);
    final MultipleCurrencyAmount priceStandard = capStandard.accept(PVSCC, SABR_MULTICURVES);
    final double forward = MULTICURVES.getForwardRate(CAP_LONG.getIndex(), CAP_LONG.getFixingPeriodStartTime(), CAP_LONG.getFixingPeriodEndTime(), CAP_LONG.getFixingAccrualFactor());
    final double beta = (1.0 + CAP_LONG.getFixingAccrualFactor() * forward) * MULTICURVES.getDiscountFactor(EUR, CAP_LONG.getFixingPeriodEndTime())
        / MULTICURVES.getDiscountFactor(EUR, CAP_LONG.getFixingPeriodStartTime());
    final double strikePart = (1.0 + CAP_LONG.getFixingAccrualFactor() * STRIKE) * priceStandard.getAmount(EUR);
    final RungeKuttaIntegrator1D integrator = new RungeKuttaIntegrator1D(1.0, 1E-8, 10);
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.