Examples of FXSpotConvention


Examples of com.opengamma.financial.convention.FXSpotConvention

      throw new OpenGammaRuntimeException("Could not get convention with id " + underlyingConventionId);
    }
    if (!(underlyingConvention instanceof FXSpotConvention)) {
      throw new OpenGammaRuntimeException("Need a convention of type " + FXSpotConvention.class + ", have " + convention.getClass());
    }
    final FXSpotConvention spotConvention = (FXSpotConvention) underlyingConvention;
    final Currency payCurrency = fxForward.getPayCurrency();
    final Currency receiveCurrency = fxForward.getReceiveCurrency();
    final Tenor forwardTenor = fxForward.getMaturityTenor();
    final double payAmount = 1;
    final double receiveAmount = forward;
    final int settlementDays = spotConvention.getSettlementDays();
    final ExternalId settlementRegion = forwardConvention.getSettlementRegion();
    final Calendar settlementCalendar = CalendarUtils.getCalendar(_regionSource, _holidaySource, settlementRegion);
    final ZonedDateTime spotDate = ScheduleCalculator.getAdjustedDate(_valuationTime, settlementDays, settlementCalendar);
    final ZonedDateTime exchangeDate = ScheduleCalculator.getAdjustedDate(spotDate, forwardTenor.getPeriod(), forwardConvention.getBusinessDayConvention(), settlementCalendar,
        forwardConvention.isIsEOM());
View Full Code Here

Examples of com.opengamma.financial.convention.FXSpotConvention

    node.accept(VISITOR);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testUnhandledConvention() {
    final FXSpotConvention convention = new FXSpotConvention("Test", ExternalIdBundle.of(ExternalId.of("Test", "Test")), 0, US);
    final Map<ExternalId, Convention> map = new HashMap<>();
    map.put(FIXED_LEG_ID, FIXED_LEG);
    map.put(ExternalId.of("Test", "Test"), convention);
    final CurveNodeCurrencyVisitor visitor = new CurveNodeCurrencyVisitor(new TestConventionSource(map));
    final SwapNode node = new SwapNode(Tenor.ONE_DAY, Tenor.TEN_YEARS, FIXED_LEG_ID, ExternalId.of("Test", "Test"), SCHEME);
View Full Code Here

Examples of com.opengamma.financial.convention.FXSpotConvention

      if (message.hasField(SETTLEMENT_REGION_FIELD)) {
        settlementRegion = deserializer.fieldValueToObject(ExternalId.class, message.getByName(SETTLEMENT_REGION_FIELD));
      } else {
        settlementRegion = null;
      }
      final FXSpotConvention convention = new FXSpotConvention(name, externalIdBundle, settlementDays, settlementRegion);
      final FudgeField uniqueIdMsg = message.getByName(UNIQUE_ID_FIELD);
      if (uniqueIdMsg != null) {
        convention.setUniqueId(deserializer.fieldValueToObject(UniqueId.class, uniqueIdMsg));
      }
      return convention;
    }
View Full Code Here

Examples of com.opengamma.financial.convention.FXSpotConvention

    final LocalDateDoubleTimeSeries spotTS = spotTimeSeries.getTimeSeries();
    final Map<LocalDate, YieldAndDiscountCurve> foreignCurves = (Map<LocalDate, YieldAndDiscountCurve>) foreignCurveObject;
    final Map<LocalDate, YieldAndDiscountCurve> domesticCurves = new LinkedHashMap<>();
    final Calendar calendar = CalendarUtils.getCalendar(holidaySource, domesticCurrency, foreignCurrency);
    final ConventionSource conventionSource = OpenGammaExecutionContext.getConventionSource(executionContext);
    final FXSpotConvention fxSpotConvention = (FXSpotConvention) conventionSource.getConvention(ExternalId.of("CONVENTION", "FX Spot"));
    final int spotLag = fxSpotConvention.getSettlementDays();
    final boolean isRegular = specification.isMarketQuoteConvention();
    final ExternalId conventionSettlementRegion = fxSpotConvention.getSettlementRegion();
    for (final Map.Entry<LocalDate, YieldAndDiscountCurve> entry : foreignCurves.entrySet()) {
      final LocalDate valuationDate = entry.getKey();
      final ZonedDateTime valuationDateTime = ZonedDateTime.of(valuationDate, now.toLocalTime(), now.getZone());
      final Double spotValue = spotTS.getValue(valuationDate);
      if (spotValue == null) {
View Full Code Here

Examples of com.opengamma.financial.convention.FXSpotConvention

    final List<InstrumentDerivative> derivatives = new ArrayList<>();
    int nInstruments = 0;
    final HolidaySource holidaySource = OpenGammaExecutionContext.getHolidaySource(executionContext);
    final Calendar calendar = CalendarUtils.getCalendar(holidaySource, domesticCurrency, foreignCurrency);
    final ConventionSource conventionSource = OpenGammaExecutionContext.getConventionSource(executionContext);
    final FXSpotConvention fxSpotConvention = (FXSpotConvention) conventionSource.getConvention(ExternalId.of("CONVENTION", "FX Spot"));
    final int spotLag = fxSpotConvention.getSettlementDays();
    final ExternalId conventionSettlementRegion = fxSpotConvention.getSettlementRegion();
    ZonedDateTime spotDate;
    if (spotLag == 0 && conventionSettlementRegion == null) {
      spotDate = now; //This preserves the old behaviour that ignored holidays and settlement days.
    } else {
      spotDate = ScheduleCalculator.getAdjustedDate(now, spotLag, calendar);
View Full Code Here

Examples of com.opengamma.financial.convention.FXSpotConvention

    assertEquals(convention, cycleObject(FXForwardAndSwapConvention.class, convention));
  }

  @Test
  public void testFXSpotConvention() {
    final FXSpotConvention convention = new FXSpotConvention("USD/CAD", ExternalIdBundle.of(InMemoryConventionBundleMaster.simpleNameSecurityId("USD/CAD")),
        1, ExternalId.of("Test", "US"));
    convention.setUniqueId(UniqueId.of("Test", "1234"));
    assertEquals(convention, cycleObject(FXSpotConvention.class, convention));
  }
View Full Code Here

Examples of com.opengamma.financial.convention.FXSpotConvention

    final Convention serialSTIRFutureConvention = new InterestRateFutureConvention(serialFutureConventionName, ExternalIdBundle.of(ExternalId.of(SCHEME_NAME, serialFutureConventionName)),
        ExternalId.of(ExchangeTradedInstrumentExpiryCalculator.SCHEME, IMMFutureAndFutureOptionMonthlyExpiryCalculator.NAME), EU, liborConventionId);
   
    // Forex
    final String fxSpotEURUSDName = FX_SPOT + " EUR/USD";
    final FXSpotConvention fxSpotEURUSD = new FXSpotConvention(fxSpotEURUSDName, ExternalIdBundle.of(ExternalId.of(SCHEME_NAME, fxSpotEURUSDName)), 2, USEU);
    final String fxFwdEURUSDName = FX_FORWARD + " EUR/USD";
    final FXForwardAndSwapConvention fxForwardEURUSD = new FXForwardAndSwapConvention(fxFwdEURUSDName, ExternalIdBundle.of(ExternalId.of(SCHEME_NAME, fxFwdEURUSDName)),
        ExternalId.of(SCHEME_NAME, fxSpotEURUSDName), FOLLOWING, false, USEU);
   
    // X-Ccy OIS
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.