Package com.opengamma.financial.analytics.ircurve

Examples of com.opengamma.financial.analytics.ircurve.YieldCurveDefinition$Meta


   */
  private Set<ExternalId> getCurves(final ConfigSource configSource, final Collection<String> names, final List<LocalDate> dates) {
    final Set<ExternalId> externalIds = newHashSet();
    for (final String name : names) {
      s_logger.info("Processing curve " + name);
      final YieldCurveDefinition curveDefinition = configSource.getSingle(YieldCurveDefinition.class, name, VersionCorrection.LATEST);
      if (curveDefinition != null) {
        final InterpolatedYieldCurveSpecificationBuilder builder = new ConfigDBInterpolatedYieldCurveSpecificationBuilder(configSource);
        for (final LocalDate date : dates) {
          s_logger.info("Processing curve date " + date);
          final InterpolatedYieldCurveSpecification curveSpec = builder.buildCurve(date, curveDefinition);
View Full Code Here


   */
  private Set<ExternalIdBundle> getFutures(final ConfigSource configSource, final Collection<String> names, final List<LocalDate> dates) {
    final Set<ExternalIdBundle> externalIds = newHashSet();
    for (final String name : names) {
      s_logger.info("Processing curve " + name);
      final YieldCurveDefinition curveDefinition = configSource.getSingle(YieldCurveDefinition.class, name, VersionCorrection.LATEST);
      if (curveDefinition != null) {
        final InterpolatedYieldCurveSpecificationBuilder builder = new ConfigDBInterpolatedYieldCurveSpecificationBuilder(configSource);
        for (final LocalDate date : dates) {
          s_logger.info("Processing curve date " + date);
          final InterpolatedYieldCurveSpecification curveSpec = builder.buildCurve(date, curveDefinition);
View Full Code Here

@Test(groups = TestGroup.UNIT)
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

    assertEquals(curveDefinition, cycleObject(YieldCurveDefinition.class, curveDefinition));
  }

  @Test
  public void testRealCycle() {
    final YieldCurveDefinition curveDefinition = CurveDefinitionAndSpecifications.buildUSDThreeMonthForwardCurveDefinition();
    assertEquals(curveDefinition, cycleObject(YieldCurveDefinition.class, curveDefinition));
    final YieldCurveDefinition curveDefinition2 = CurveDefinitionAndSpecifications.buildUSDFundingCurveDefinition();
    assertEquals(curveDefinition2, cycleObject(YieldCurveDefinition.class, curveDefinition2));

  }
View Full Code Here

      @QueryParam("currency") String currencyStr,
      @QueryParam("versionAsOf") String versionAsOfStr,
      @QueryParam("name") String name) {
    final Currency currency = Currency.parse(currencyStr);
    if (versionAsOfStr != null) {
      YieldCurveDefinition result = getInterpolatedYieldCurveDefinitionSource().getDefinition(currency, name, VersionCorrection.parse(versionAsOfStr, null));
      return responseOkFudge(result);
    } else {
      YieldCurveDefinition result = getInterpolatedYieldCurveDefinitionSource().getDefinition(currency, name);
      return responseOkFudge(result);
    }
  }
View Full Code Here

    }
    final Currency originalCurrency = (Currency) target.getValue();
    if (!originalCurrency.equals(impliedCurrency)) {
      throw new OpenGammaRuntimeException("Currency targets for configurations " + _curveCalculationConfig + " and " + entry.getKey() + " did not match");
    }
    final YieldCurveDefinition impliedDefinition = configurationSource.getLatestByName(YieldCurveDefinition.class, impliedCurveNames[0] + "_" + impliedCurrency.getCode());
    if (impliedDefinition == null) {
      throw new OpenGammaRuntimeException("Could not get implied definition called " + impliedCurveNames[0] + "_" + impliedCurrency.getCode());
    }
    final Set<FixedIncomeStrip> strips = impliedDefinition.getStrips();
    for (final FixedIncomeStrip strip : strips) {
      if (strip.getInstrumentType() != StripInstrumentType.CASH) {
        throw new OpenGammaRuntimeException("Can only handle yield curve definitions with CASH strips");
      }
    }
View Full Code Here

   */
  private Set<ExternalId> getCurveRequiredExternalIds(final ConfigSource configSource, final Collection<String> names, final List<LocalDate> dates) {
    final Set<ExternalId> externalIds = newHashSet();
    for (final String name : names) {
      s_logger.info("Processing curve " + name);
      YieldCurveDefinition curveDefinition = configSource.getSingle(YieldCurveDefinition.class, name, VersionCorrection.LATEST);
      if (curveDefinition != null) {
        InterpolatedYieldCurveSpecificationBuilder builder = new ConfigDBInterpolatedYieldCurveSpecificationBuilder(configSource);
        for (LocalDate date : dates) {
          s_logger.info("Processing curve date " + date);
          try {
View Full Code Here

    if (message.hasField(INTERPOLATE_YIELDS_FIELD)) {
      interpolateYields = message.getBoolean(INTERPOLATE_YIELDS_FIELD);
    } else {
      interpolateYields = DEFAULT_INTERPOLATE_YIELD_VALUE;
    }
    final YieldCurveDefinition curveDefinition = new YieldCurveDefinition(currency, region, name, interpolatorName,
        leftExtrapolatorName, rightExtrapolatorName, interpolateYields, strips);
    final FudgeField uniqueId = message.getByName(UNIQUE_ID_FIELD);
    if (uniqueId != null) {
      curveDefinition.setUniqueId(deserializer.fieldValueToObject(UniqueId.class, uniqueId));
    }
    return curveDefinition;
  }
View Full Code Here

  private static String createTemplate() {
    return YieldCurveDefinitionJSONBuilder.INSTANCE.toJSON(getDummyYieldCurveDefinition());
  }

  private static YieldCurveDefinition getDummyYieldCurveDefinition() {
    YieldCurveDefinition dummy = new YieldCurveDefinition(Currency.GBP, ExternalSchemes.countryRegionId(Country.US), "", "", "", "", true);
    dummy.addStrip(new FixedIncomeStrip(StripInstrumentType.LIBOR, Tenor.DAY, ""));
    return dummy;
  }
View Full Code Here

    }
    final Currency originalCurrency = (Currency) target.getValue();
    if (!originalCurrency.equals(impliedCurrency)) {
      throw new OpenGammaRuntimeException("Currency targets for configurations " + _impliedCurveCalculationConfig + " and " + entry.getKey() + " did not match");
    }
    final YieldCurveDefinition impliedDefinition = configurationSource.getLatestByName(YieldCurveDefinition.class, impliedCurveNames[0] + "_" + impliedCurrency.getCode());
    if (impliedDefinition == null) {
      throw new OpenGammaRuntimeException("Could not get implied definition called " + impliedCurveNames[0] + "_" + impliedCurrency.getCode());
    }
    final Set<FixedIncomeStrip> strips = impliedDefinition.getStrips();
    for (final FixedIncomeStrip strip : strips) {
      if (strip.getInstrumentType() != StripInstrumentType.CASH) {
        throw new OpenGammaRuntimeException("Can only handle yield curve definitions with CASH strips");
      }
    }
View Full Code Here

TOP

Related Classes of com.opengamma.financial.analytics.ircurve.YieldCurveDefinition$Meta

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.