Package com.opengamma.financial.analytics.ircurve

Examples of com.opengamma.financial.analytics.ircurve.FixedIncomeStrip


    return message;
  }

  @Override
  public FixedIncomeStripWithIdentifier buildObject(FudgeDeserializer deserializer, FudgeMsg message) {
    FixedIncomeStrip type = deserializer.fieldValueToObject(FixedIncomeStrip.class, message.getByName(STRIP_NAME));
    ExternalId security = deserializer.fieldValueToObject(ExternalId.class, message.getByName(IDENTIFIER_NAME));
    return new FixedIncomeStripWithIdentifier(type, security);
  }
View Full Code Here


    return message;
  }

  @Override
  public FixedIncomeStripWithIdentifier buildObject(FudgeDeserializer deserializer, FudgeMsg message) {
    FixedIncomeStrip type = deserializer.fieldValueToObject(FixedIncomeStrip.class, message.getByName(STRIP_NAME));
    ExternalId security = deserializer.fieldValueToObject(ExternalId.class, message.getByName(IDENTIFIER_NAME));
    return new FixedIncomeStripWithIdentifier(type, security);
  }
View Full Code Here

    final StripInstrumentType type = deserializer.fieldValueToObject(StripInstrumentType.class, message.getByName(TYPE));
    final String conventionName = message.getString(CONVENTION_NAME);
    final Tenor tenor = deserializer.fieldValueToObject(Tenor.class, message.getByName(TENOR));
    if (type == StripInstrumentType.FUTURE) {
      final int numFutures = message.getInt(NUM_FUTURES);
      return new FixedIncomeStrip(type, tenor, numFutures, conventionName);
    } else if (type == StripInstrumentType.PERIODIC_ZERO_DEPOSIT) {
      final int periodsPerYear = message.getInt(PERIODS_PER_YEAR);
      return new FixedIncomeStrip(type, tenor, periodsPerYear, true, conventionName);
    } else if (message.hasField(RESET_TENOR)) {
      final Tenor resetTenor = deserializer.fieldValueToObject(Tenor.class, message.getByName(RESET_TENOR));
      final IndexType indexType = deserializer.fieldValueToObject(IndexType.class, message.getByName(INDEX_TYPE));
      return new FixedIncomeStrip(type, tenor, resetTenor, indexType, conventionName);
    } else if (type == StripInstrumentType.BASIS_SWAP) {
      final Tenor payTenor = deserializer.fieldValueToObject(Tenor.class, message.getByName(PAY_TENOR));
      final Tenor receiveTenor = deserializer.fieldValueToObject(Tenor.class, message.getByName(RECEIVE_TENOR));
      final IndexType payIndexType = deserializer.fieldValueToObject(IndexType.class, message.getByName(PAY_INDEX_TYPE));
      final IndexType receiveIndexType = deserializer.fieldValueToObject(IndexType.class, message.getByName(RECEIVE_INDEX_TYPE));
      return new FixedIncomeStrip(type, tenor, payTenor, receiveTenor, payIndexType, receiveIndexType, conventionName);
    } else {
      return new FixedIncomeStrip(type, tenor, conventionName);
    }
  }
View Full Code Here

    final DayCount dayCount = DayCountFactory.INSTANCE.getDayCount("Actual/365");
    final CashSecurity cash = new CashSecurity(Currency.USD, ExternalSchemes.financialRegionId("US"), start, maturity, dayCount, 0.05, 1);
    cash.setUniqueId(UniqueId.of("TEST", "TEST"));
    cash.setName("1m deposit rate");
    cash.setExternalIdBundle(bundle);
    final FixedIncomeStripWithSecurity cashStrip = new FixedIncomeStripWithSecurity(new FixedIncomeStrip(StripInstrumentType.CASH, Tenor.ONE_MONTH, "DEFAULT"), Tenor.ONE_MONTH, maturity, dummyId, cash);

    dummyId = ExternalSchemes.bloombergTickerSecurityId("EDZ2 Comdty");
    bundle = ExternalIdBundle.of(dummyId);
    final FutureSecurity future = new InterestRateFutureSecurity(new Expiry(ZonedDateTime.now()), "XCSE", "XCSE", Currency.USD, 0, dummyId, "Interest Rate");
    future.setExternalIdBundle(bundle);
    final FixedIncomeStripWithSecurity futureStrip = new FixedIncomeStripWithSecurity(new FixedIncomeStrip(StripInstrumentType.FUTURE, Tenor.THREE_MONTHS, 2, "DEFAULT"), Tenor.THREE_MONTHS, DateUtils.getUTCDate(2011, 12, 1), dummyId, future);

    dummyId = ExternalSchemes.bloombergTickerSecurityId("USFR0BE Curncy");
    bundle = ExternalIdBundle.of(dummyId);
    final ZonedDateTime startDate = DateUtils.getUTCDate(2011, 11, 1);
    final ZonedDateTime endDate = DateUtils.getUTCDate(2012, 2, 1);
    final ExternalId underlyingIdentifier = ExternalSchemes.bloombergTickerSecurityId("US0003M Index");
    final ZonedDateTime fixingDate = startDate.minusDays(2);
    final FRASecurity fra = new FRASecurity(Currency.USD, ExternalSchemes.financialRegionId("US"), startDate, endDate, 0.05, 1, underlyingIdentifier, fixingDate);
    fra.setExternalIdBundle(bundle);
    final FixedIncomeStripWithSecurity fraStrip = new FixedIncomeStripWithSecurity(new FixedIncomeStrip(StripInstrumentType.FRA_3M, Tenor.FIVE_MONTHS, "DEFAULT"), Tenor.FIVE_MONTHS, endDate, dummyId, fra);

    final Collection<FixedIncomeStripWithSecurity> strips = new ArrayList<FixedIncomeStripWithSecurity>();
    strips.add(cashStrip);
    strips.add(futureStrip);
    strips.add(fraStrip);
View Full Code Here

public class YieldCurveDefinitionFudgeEncodingTest extends FinancialTestBase {

  @Test
  public void testCycle() {
    final YieldCurveDefinition curveDefinition = new YieldCurveDefinition(Currency.USD, ExternalSchemes.countryRegionId(Country.US), "NAME", "LINEAR", "LEFT", "RIGHT", false);
    curveDefinition.addStrip(new FixedIncomeStrip(StripInstrumentType.CASH, Tenor.DAY, "Convention"));
    assertEquals(curveDefinition, cycleObject(YieldCurveDefinition.class, curveDefinition));
    curveDefinition.addStrip(new FixedIncomeStrip(StripInstrumentType.FUTURE, Tenor.TWO_YEARS, 3, "CONVENTIONAL"));
    assertEquals(curveDefinition, cycleObject(YieldCurveDefinition.class, curveDefinition));
  }
View Full Code Here

    return message;
  }

  @Override
  public FixedIncomeStripWithSecurity buildObject(FudgeDeserializer deserializer, FudgeMsg message) {
    FixedIncomeStrip strip = deserializer.fieldValueToObject(FixedIncomeStrip.class, message.getByName(STRIP_NAME));
    Tenor resolvedTenor = deserializer.fieldValueToObject(Tenor.class, message.getByName(RESOLVED_TENOR_NAME));
    ZonedDateTimeFudgeBuilder zonedDateTimeBuilder = new ZonedDateTimeFudgeBuilder();
    ZonedDateTime maturity = zonedDateTimeBuilder.buildObject(deserializer, message.getMessage(MATURITY_NAME));
    ExternalId identifier = deserializer.fieldValueToObject(ExternalId.class, message.getByName(IDENTIFIER_NAME));
    Security security = (Security) deserializer.fieldValueToObject(message.getByName(SECURITY_NAME));
View Full Code Here

    final String name = message.getString(NAME_FIELD);
    final String interpolatorName = message.getString(INTERPOLATOR_NAME_FIELD);
    final List<FudgeField> allByOrdinal = message.getAllByName(STRIP_FIELD);
    final SortedSet<FixedIncomeStrip> strips = new TreeSet<FixedIncomeStrip>();
    for (final FudgeField field : allByOrdinal) {
      final FixedIncomeStrip strip = deserializer.fieldValueToObject(FixedIncomeStrip.class, field);
      strips.add(strip);
    }
    final String leftExtrapolatorName;
    if (message.hasField(LEFT_EXTRAPOLATOR_NAME_FIELD)) {
      leftExtrapolatorName = message.getString(LEFT_EXTRAPOLATOR_NAME_FIELD);
View Full Code Here

@Test(groups = TestGroup.UNIT)
public class FixedIncomeStripWithIdentifierFudgeEncodingTest extends FinancialTestBase {

  @Test
  public void testCycle() {
    FixedIncomeStripWithIdentifier strip = new FixedIncomeStripWithIdentifier(new FixedIncomeStrip(StripInstrumentType.CASH, Tenor.DAY, "DEFAULT"), ExternalId.of(ExternalSchemes.BLOOMBERG_TICKER,
        "USDR5 Curncy"));
    assertEquals(strip, cycleObject(FixedIncomeStripWithIdentifier.class, strip));
    strip = new FixedIncomeStripWithIdentifier(new FixedIncomeStrip(StripInstrumentType.LIBOR, Tenor.ONE_MONTH, "DEFAULT"), ExternalId.of(ExternalSchemes.BLOOMBERG_TICKER, "US0001M Curncy"));
    assertEquals(strip, cycleObject(FixedIncomeStripWithIdentifier.class, strip));
    strip = new FixedIncomeStripWithIdentifier(new FixedIncomeStrip(StripInstrumentType.EURIBOR, Tenor.ONE_MONTH, "DEFAULT"), ExternalId.of(ExternalSchemes.BLOOMBERG_TICKER, "US0001M Curncy"));
    assertEquals(strip, cycleObject(FixedIncomeStripWithIdentifier.class, strip));
    strip = new FixedIncomeStripWithIdentifier(new FixedIncomeStrip(StripInstrumentType.FUTURE, Tenor.YEAR, 3, "DEFAULT"), ExternalId.of(ExternalSchemes.BLOOMBERG_TICKER, "L Z3 Comdty"));
    assertEquals(strip, cycleObject(FixedIncomeStripWithIdentifier.class, strip));
    strip = new FixedIncomeStripWithIdentifier(new FixedIncomeStrip(StripInstrumentType.FRA_3M, Tenor.YEAR, "DEFAULT"), ExternalId.of(ExternalSchemes.BLOOMBERG_TICKER, "USFR01C Curncy"));
    assertEquals(strip, cycleObject(FixedIncomeStripWithIdentifier.class, strip));
    strip = new FixedIncomeStripWithIdentifier(new FixedIncomeStrip(StripInstrumentType.FRA_6M, Tenor.YEAR, "DEFAULT"), ExternalId.of(ExternalSchemes.BLOOMBERG_TICKER, "USFR01C Curncy"));
    assertEquals(strip, cycleObject(FixedIncomeStripWithIdentifier.class, strip));
    strip = new FixedIncomeStripWithIdentifier(new FixedIncomeStrip(StripInstrumentType.SWAP_3M, Tenor.YEAR, "DEFAULT"), ExternalId.of(ExternalSchemes.BLOOMBERG_TICKER, "USSW1 Curncy"));
    assertEquals(strip, cycleObject(FixedIncomeStripWithIdentifier.class, strip));
    strip = new FixedIncomeStripWithIdentifier(new FixedIncomeStrip(StripInstrumentType.SWAP_3M, Tenor.YEAR, "DEFAULT"), ExternalId.of(ExternalSchemes.BLOOMBERG_TICKER, "USSW1 Curncy"));
    assertEquals(strip, cycleObject(FixedIncomeStripWithIdentifier.class, strip));
    strip = new FixedIncomeStripWithIdentifier(new FixedIncomeStrip(StripInstrumentType.TENOR_SWAP, Tenor.YEAR, "DEFAULT"), ExternalId.of(ExternalSchemes.BLOOMBERG_TICKER, "USBG1 Curncy"));
    assertEquals(strip, cycleObject(FixedIncomeStripWithIdentifier.class, strip));
    strip = new FixedIncomeStripWithIdentifier(new FixedIncomeStrip(StripInstrumentType.BASIS_SWAP, Tenor.YEAR, Tenor.SIX_MONTHS, Tenor.ONE_YEAR, IndexType.Libor, IndexType.Libor, "DEFAULT"),
        ExternalId.of(ExternalSchemes.BLOOMBERG_TICKER, "USBG1 Curncy"));
    assertEquals(strip, cycleObject(FixedIncomeStripWithIdentifier.class, strip));
    strip = new FixedIncomeStripWithIdentifier(new FixedIncomeStrip(StripInstrumentType.OIS_SWAP, Tenor.YEAR, "DEFAULT"), ExternalId.of(ExternalSchemes.BLOOMBERG_TICKER, "USSO1 Curncy"));
    assertEquals(strip, cycleObject(FixedIncomeStripWithIdentifier.class, strip));
  }
View Full Code Here

    DayCount dayCount = DayCountFactory.INSTANCE.getDayCount("Actual/365");
    final CashSecurity cash = new CashSecurity(Currency.USD, ExternalSchemes.financialRegionId("US"), start, maturity, dayCount, 0.05, 1);
    cash.setUniqueId(UniqueId.of("TEST", "TEST"));
    cash.setName("1m deposit rate");
    cash.setExternalIdBundle(bundle);
    FixedIncomeStripWithSecurity strip = new FixedIncomeStripWithSecurity(new FixedIncomeStrip(StripInstrumentType.CASH, Tenor.ONE_MONTH, "DEFAULT"), Tenor.ONE_MONTH, maturity, dummyId, cash);
    assertEquals(strip, cycleObject(FixedIncomeStripWithSecurity.class, strip));

    dummyId = ExternalSchemes.bloombergTickerSecurityId("EDZ2 Comdty");
    bundle = ExternalIdBundle.of(dummyId);
    final FutureSecurity future = new InterestRateFutureSecurity(new Expiry(ZonedDateTime.now()), "XCSE", "XCSE", Currency.USD, 0, dummyId, "Interest Rate");
    future.setExternalIdBundle(bundle);
    strip = new FixedIncomeStripWithSecurity(new FixedIncomeStrip(StripInstrumentType.FUTURE, Tenor.THREE_MONTHS, 2, "DEFAULT"), Tenor.THREE_MONTHS, DateUtils.getUTCDate(2011, 12, 1), dummyId, future);
    assertEquals(strip, cycleObject(FixedIncomeStripWithSecurity.class, strip));
   
    dummyId = ExternalSchemes.bloombergTickerSecurityId("USFR0BE Curncy");
    bundle = ExternalIdBundle.of(dummyId);
    ZonedDateTime startDate = DateUtils.getUTCDate(2011, 11, 1);
    ZonedDateTime endDate = DateUtils.getUTCDate(2012, 2, 1);
    ExternalId underlyingIdentifier = ExternalSchemes.bloombergTickerSecurityId("US0003M Index");
    ZonedDateTime fixingDate = startDate.minusDays(2);
    FRASecurity fra = new FRASecurity(Currency.USD, ExternalSchemes.financialRegionId("US"), startDate, endDate, 0.05, 1, underlyingIdentifier, fixingDate);
    fra.setExternalIdBundle(bundle);
    strip = new FixedIncomeStripWithSecurity(new FixedIncomeStrip(StripInstrumentType.FRA_3M, Tenor.FIVE_MONTHS, "DEFAULT"), Tenor.FIVE_MONTHS, endDate, dummyId, fra);
    assertEquals(strip, cycleObject(FixedIncomeStripWithSecurity.class, strip));
  }
View Full Code Here

@Test(groups = TestGroup.UNIT)
public class FixedIncomeStripFudgeEncodingTest extends FinancialTestBase {

  @Test
  public void testCycle() {
    FixedIncomeStrip strip = new FixedIncomeStrip(StripInstrumentType.CASH, Tenor.DAY, "DEFAULT");
    assertEquals(strip, cycleObject(FixedIncomeStrip.class, strip));
    strip = new FixedIncomeStrip(StripInstrumentType.FUTURE, Tenor.YEAR, 3, "DEFAULT");
    assertEquals(strip, cycleObject(FixedIncomeStrip.class, strip));
    strip = new FixedIncomeStrip(StripInstrumentType.LIBOR, Tenor.DAY, "DEFAULT");
    assertEquals(strip, cycleObject(FixedIncomeStrip.class, strip));
    strip = new FixedIncomeStrip(StripInstrumentType.EURIBOR, Tenor.DAY, "DEFAULT");
    assertEquals(strip, cycleObject(FixedIncomeStrip.class, strip));
    strip = new FixedIncomeStrip(StripInstrumentType.FRA_3M, Tenor.SIX_MONTHS, "DEFAULT");
    assertEquals(strip, cycleObject(FixedIncomeStrip.class, strip));
    strip = new FixedIncomeStrip(StripInstrumentType.FRA_6M, Tenor.NINE_MONTHS, "DEFAULT");
    assertEquals(strip, cycleObject(FixedIncomeStrip.class, strip));
    strip = new FixedIncomeStrip(StripInstrumentType.FUTURE, Tenor.YEAR, 3, "DEFAULT");
    assertEquals(strip, cycleObject(FixedIncomeStrip.class, strip));
    strip = new FixedIncomeStrip(StripInstrumentType.SWAP_3M, Tenor.THREE_YEARS, "DEFAULT");
    assertEquals(strip, cycleObject(FixedIncomeStrip.class, strip));
    strip = new FixedIncomeStrip(StripInstrumentType.SWAP_6M, Tenor.THREE_YEARS, "DEFAULT");
    assertEquals(strip, cycleObject(FixedIncomeStrip.class, strip));
    strip = new FixedIncomeStrip(StripInstrumentType.SWAP_12M, Tenor.THREE_YEARS, "DEFAULT");
    assertEquals(strip, cycleObject(FixedIncomeStrip.class, strip));
    strip = new FixedIncomeStrip(StripInstrumentType.TENOR_SWAP, Tenor.THREE_YEARS, "DEFAULT");
    assertEquals(strip, cycleObject(FixedIncomeStrip.class, strip));
    strip = new FixedIncomeStrip(StripInstrumentType.BASIS_SWAP, Tenor.THREE_YEARS, Tenor.THREE_MONTHS, Tenor.SIX_MONTHS, IndexType.Libor, IndexType.Libor, "DEFAULT");
    assertEquals(strip, cycleObject(FixedIncomeStrip.class, strip));
    strip = new FixedIncomeStrip(StripInstrumentType.OIS_SWAP, Tenor.THREE_YEARS, "DEFAULT");
    assertEquals(strip, cycleObject(FixedIncomeStrip.class, strip));
  }
View Full Code Here

TOP

Related Classes of com.opengamma.financial.analytics.ircurve.FixedIncomeStrip

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.