Package com.opengamma.analytics.financial.forex.definition

Examples of com.opengamma.analytics.financial.forex.definition.ForexSwapDefinition


    ArgumentChecker.notNull(attribute, "Attribute");
    final double fx = attribute.getFXMatrix().getFxRate(_currency1, _currency2);
    final ZonedDateTime spot = ScheduleCalculator.getAdjustedDate(date, _spotLag, _calendar);
    final ZonedDateTime startDate = ScheduleCalculator.getAdjustedDate(spot, attribute.getStartPeriod(), _businessDayConvention, _calendar, _endOfMonth);
    final ZonedDateTime endDate = ScheduleCalculator.getAdjustedDate(spot, attribute.getEndPeriod(), _businessDayConvention, _calendar, _endOfMonth);
    return new ForexSwapDefinition(_currency1, _currency2, startDate, endDate, notional, fx, forwardPoints);
  }
View Full Code Here


  /**
   * Creates a FX swap definition
   * @return A FX swap definition
   */
  public static ForexSwapDefinition createForexSwapDefinition() {
    return new ForexSwapDefinition(EUR, USD, NEAR_DATE, FAR_DATE, NOMINAL_1, FX_RATE_EUR_USD, FORWARD_POINTS);
  }
View Full Code Here

  /**
   * Tests the parSpread method.
   */
  public void parSpread() {
    final double parSpread = METHOD_FX_SWAP.parSpread((ForexSwap) FX_SWAP, CURVES_FX);
    final ForexSwapDefinition fxSwap0Definition = new ForexSwapDefinition(CUR_1, CUR_2, NEAR_DATE, FAR_DATE, NOMINAL_1, FX_RATE, FORWARD_POINTS + parSpread);
    final ForexSwap fxSwap0 = (ForexSwap) fxSwap0Definition.toDerivative(REFERENCE_DATE, CURVES_NAME);
    final MultipleCurrencyAmount pv0 = METHOD_FX_SWAP.presentValue(fxSwap0, CURVES);
    assertEquals("Forex swap: par spread", 0, FX_MATRIX.convert(pv0, CUR_1).getAmount(), TOLERANCE_PV);
  }
View Full Code Here

    final double pts = 0.01;
    final double eurUsd = 1.25;
    final double notional = 123000000;
    final FXMatrix fxMatrix = new FXMatrix(EUR, USD, eurUsd);
    final GeneratorAttributeFX attribute = new GeneratorAttributeFX(tenor, fxMatrix);
    final ForexSwapDefinition insGenerated = GENERATOR_FX_EURUSD.generateInstrument(referenceDate, pts, notional, attribute);
    final ZonedDateTime startDate = ScheduleCalculator.getAdjustedDate(referenceDate, SETTLEMENT_DAYS, CALENDAR);
    final ZonedDateTime endDate = ScheduleCalculator.getAdjustedDate(startDate, tenor, BUSINESS_DAY, CALENDAR, IS_EOM);
    final ForexSwapDefinition insExpected = new ForexSwapDefinition(EUR, USD, startDate, endDate, notional, eurUsd, pts);
    assertEquals("Generator Deposit: generate instrument", insExpected, insGenerated);
  }
View Full Code Here

  /**
   * Tests the parSpread method.
   */
  public void parSpread() {
    final double parSpread = METHOD_FX_SWAP.parSpread(FX_SWAP, MULTICURVES);
    final ForexSwapDefinition fxSwap0Definition = new ForexSwapDefinition(CUR_1, CUR_2, NEAR_DATE, FAR_DATE, NOMINAL_1, MULTICURVES.getFxRate(CUR_1, CUR_2), FORWARD_POINTS
        + parSpread);
    final ForexSwap fxSwap0 = (ForexSwap) fxSwap0Definition.toDerivative(REFERENCE_DATE);
    final MultipleCurrencyAmount pv0 = METHOD_FX_SWAP.presentValue(fxSwap0, MULTICURVES);
    assertEquals("Forex swap: par spread", 0, MULTICURVES.getFxRates().convert(pv0, CUR_1).getAmount(), TOLERANCE_PV);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.forex.definition.ForexSwapDefinition

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.