Package com.opengamma.financial.analytics.ircurve.strips

Examples of com.opengamma.financial.analytics.ircurve.strips.FRANode


      final Tenor fixingStart = Tenor.of(Period.parse(message.getString(FIXING_START_FIELD)));
      final Tenor fixingEnd = Tenor.of(Period.parse(message.getString(FIXING_END_FIELD)));
      final ExternalId conventionId = deserializer.fieldValueToObject(ExternalId.class, message.getByName(CONVENTION_ID_FIELD));
      if (message.hasField(NAME_FIELD)) {
        final String name = message.getString(NAME_FIELD);
        return new FRANode(fixingStart, fixingEnd, conventionId, curveNodeIdMapperName, name);
      }
      return new FRANode(fixingStart, fixingEnd, conventionId, curveNodeIdMapperName);
    }
View Full Code Here


    assertEquals(node, cycleObject(DiscountFactorNode.class, node));
  }

  @Test
  public void testFRANodeBuilder() {
    FRANode node = new FRANode(Tenor.SIX_MONTHS, Tenor.NINE_MONTHS, ExternalId.of("convention", "name"), "TEST");
    assertEquals(node, cycleObject(FRANode.class, node));
    node = new FRANode(Tenor.SIX_MONTHS, Tenor.NINE_MONTHS, ExternalId.of("convention", "name"), "TEST", null);
    assertEquals(node, cycleObject(FRANode.class, node));
    node = new FRANode(Tenor.SIX_MONTHS, Tenor.NINE_MONTHS, ExternalId.of("convention", "name"), "TEST", "Name");
    assertEquals(node, cycleObject(FRANode.class, node));
  }
View Full Code Here

    node.accept(EMPTY_CONVENTIONS);
  }

  @Test(expectedExceptions = OpenGammaRuntimeException.class)
  public void testNullFRAConvention() {
    final FRANode node = new FRANode(Tenor.ONE_DAY, Tenor.THREE_MONTHS, LIBOR_3M_ID, SCHEME);
    node.accept(EMPTY_CONVENTIONS);
  }
View Full Code Here

    assertNull(node.accept(VISITOR));
  }

  @Test
  public void testFRANode() {
    final FRANode node = new FRANode(Tenor.ONE_DAY, Tenor.THREE_MONTHS, LIBOR_3M_ID, SCHEME);
    final Set<Currency> currencies = node.accept(VISITOR);
    assertEquals(1, currencies.size());
    assertEquals(Currency.USD, currencies.iterator().next());
  }
View Full Code Here

  public void testNoConventionForFRA() {
    final ExternalId marketDataId = ExternalId.of(SCHEME, "Data");
    final SnapshotDataBundle marketValues = new SnapshotDataBundle();
    final double rate = 0.0012345;
    marketValues.setDataPoint(marketDataId, rate);
    final FRANode fraNode = new FRANode(Tenor.SIX_MONTHS, Tenor.NINE_MONTHS, ExternalId.of(SCHEME, "Test"), "Mapper");
    final CurveNodeVisitor<InstrumentDefinition<?>> converter = new FRANodeConverter(CONVENTION_SOURCE, HOLIDAY_SOURCE, REGION_SOURCE,
        marketValues, marketDataId, NOW);
    fraNode.accept(converter);
  }
View Full Code Here

  public void testWrongConventionForFRA() {
    final ExternalId marketDataId = ExternalId.of(SCHEME, "Data");
    final SnapshotDataBundle marketValues = new SnapshotDataBundle();
    final double rate = 0.0012345;
    marketValues.setDataPoint(marketDataId, rate);
    final FRANode fraNode = new FRANode(Tenor.SIX_MONTHS, Tenor.NINE_MONTHS, FIXED_LEG_ID, "Mapper");
    final CurveNodeVisitor<InstrumentDefinition<?>> converter = new FRANodeConverter(CONVENTION_SOURCE, HOLIDAY_SOURCE, REGION_SOURCE,
        marketValues, marketDataId, NOW);
    fraNode.accept(converter);
  }
View Full Code Here

  public void testFRA() {
    final ExternalId marketDataId = ExternalId.of(SCHEME, "US3mLibor");
    final double rate = 0.0012345;
    final SnapshotDataBundle marketValues = new SnapshotDataBundle();
    marketValues.setDataPoint(marketDataId, rate);
    final FRANode fraNode = new FRANode(Tenor.SIX_MONTHS, Tenor.NINE_MONTHS, LIBOR_3M_ID, "Mapper");
    final IborIndex index = new IborIndex(Currency.USD, Tenor.THREE_MONTHS.getPeriod(), 2, THIRTY_360, MODIFIED_FOLLOWING, false, LIBOR_3M_ID.getValue());
    final ZonedDateTime now = DateUtils.getUTCDate(2013, 3, 1);
    final CurveNodeVisitor<InstrumentDefinition<?>> converter = new FRANodeConverter(CONVENTION_SOURCE, HOLIDAY_SOURCE, REGION_SOURCE, marketValues, marketDataId, now);
    final InstrumentDefinition<?> definition = fraNode.accept(converter);
    assertTrue(definition instanceof ForwardRateAgreementDefinition);
    final ForwardRateAgreementDefinition fra = (ForwardRateAgreementDefinition) definition;
    final ForwardRateAgreementDefinition expectedFRA = ForwardRateAgreementDefinition.from(DateUtils.getUTCDate(2013, 9, 5), DateUtils.getUTCDate(2013, 12, 5), 1, index, rate, CALENDAR);
    assertEquals(expectedFRA, fra);
  }
View Full Code Here

    assertEquals(new CurveNodeWithIdentifier(df, ExternalId.of("Test", "DF"), "DF Data", DataFieldType.POINTS), df.accept(BUILDER));
  }

  @Test
  public void testFRA() {
    final FRANode fra = new FRANode(Tenor.ONE_DAY, Tenor.TWO_MONTHS, ExternalId.of("Test", "Test"), "Test");
    assertEquals(new CurveNodeWithIdentifier(fra, ExternalId.of("Test", "FRA"), "FRA Data", DataFieldType.OUTRIGHT), fra.accept(BUILDER));
  }
View Full Code Here

TOP

Related Classes of com.opengamma.financial.analytics.ircurve.strips.FRANode

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.