Package com.opengamma.integration.tool.portfolio.xml.v1_0

Examples of com.opengamma.integration.tool.portfolio.xml.v1_0.SchemaGenerator


    return false;
  }

  @Override
  public SwapTradeSecurityExtractor getSecurityExtractor() {
    return new SwapTradeSecurityExtractor(this);
  }
View Full Code Here


    return false;
  }

  @Override
  public TradeSecurityExtractor getSecurityExtractor() {
    return new SwaptionTradeSecurityExtractor(this);
  }
View Full Code Here

  //-------------------------------------------------------------------------
  @Override
  public ManageableSecurity[] extractSecurities() {
    ExternalId region = null;
    boolean parameterizedAsVariance = false; // distinguishes vega or variance strike/notional
    EquityVarianceSwapTrade trade = getTrade();
    EquityVarianceSwapSecurity security = new EquityVarianceSwapSecurity(
        trade.getUnderlying().toExternalId(),
        trade.getCurrency(),
        trade.getStrike().doubleValue(),
        trade.getVegaAmount().doubleValue(),
        parameterizedAsVariance,
        trade.getAnnualizationFactor(),
        convertLocalDate(trade.getObservationStartDate()),
        convertLocalDate(trade.getObservationEndDate()),
        /*convertLocalDate(trade.getPremiumSettlementDate())*/
        null,
        region,
        SimpleFrequencyFactory.INSTANCE.getFrequency(trade.getObservationfrequency()));
    return securityArray(addIdentifier(security));
  }
View Full Code Here

   
    return fra;
  }

  private IdWrapper createExternalId(String id, String scheme) {
    ExtId tradeExtId = new ExtId();
    tradeExtId.setId(id);
    tradeExtId.setScheme(scheme);
    IdWrapper tradeId = new IdWrapper();
    tradeId.setExternalId(tradeExtId);
    return tradeId;
  }
View Full Code Here

    Frequency frequency = SimpleFrequencyFactory.INSTANCE.getFrequency(floatingLeg.getFrequency());
    BusinessDayConvention businessDayConvention =
        BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention(floatingLeg.getBusinessDayConvention());
    boolean isEndOfMonth = floatingLeg.isEndOfMonth();

    FixingIndex fixingIndex = floatingLeg.getFixingIndex();
    ExternalId referenceRate = fixingIndex.getIndex().toExternalId();
    FloatingRateType rateType = FloatingRateType.valueOf(fixingIndex.getRateType().toString());

    return new FloatingInterestRateLeg(dayCount, frequency, region, businessDayConvention, notional, isEndOfMonth,
        referenceRate, rateType);
  }
View Full Code Here

    fra.setTerminationDate(LocalDate.of(2013, 5, 23));
    fra.setCurrency(Currency.USD);
    fra.setNotional(BigDecimal.valueOf(1000000));
    fra.setRate(BigDecimal.valueOf(105.25));
   
    FixingIndex fixingIndex = new FixingIndex();
    fixingIndex.setIndex(createExternalId("US0003M Curncy", "BLOOMBERG_TICKER").getExternalId());
    fixingIndex.setRateType(RateType.IBOR);
    fra.setFixingIndex(fixingIndex);
   
    return fra;
  }
View Full Code Here

    super(trade);
  }

  @Override
  public ManageableSecurity[] extractSecurities() {
    FraTrade fraTrade = getTrade();
   
    validate(fraTrade);
   
    boolean payFixed = fraTrade.isPayFixed();
   
    double specifiedNotional = fraTrade.getNotional().doubleValue();
   
    //sign of notional determines the sides of the trade.
    //pay fixed => positive; pay floating => negative
    double absoluteNotional = payFixed ? specifiedNotional : -specifiedNotional;
   
    ExternalId underlyingIdentifier = fraTrade.getFixingIndex().getIndex().toExternalId();
   
   
    FRASecurity fraSecurity = new FRASecurity(fraTrade.getCurrency(),
                  fraTrade.getRegionId().toExternalId(), //region id not used.
                  convertLocalDate(fraTrade.getEffectiveDate()),
                  convertLocalDate(fraTrade.getTerminationDate()),
                  fraTrade.getRate().doubleValue(),
                  absoluteNotional,
                  underlyingIdentifier,
                  convertLocalDate(fraTrade.getFixingDate()));
   
    return securityArray(addIdentifier(fraSecurity));
  }
View Full Code Here

@Test(groups = TestGroup.UNIT)
public class FraTradeSecurityExtractorTest {
 
  @Test
  public void testExtractSecurities() {
    FraTrade fra = createBasicFra();
    FraTradeSecurityExtractor fraExtractor = new FraTradeSecurityExtractor(fra);
    ManageableSecurity[] extractSecurities = fraExtractor.extractSecurities();
    assertEquals(1, extractSecurities.length, "One fra expected");
    assertEquals(FRASecurity.class, extractSecurities[0].getClass(), "Expected instance of FraSecurity");
   
View Full Code Here

   
  }

  @Test(expectedExceptions={OpenGammaRuntimeException.class})
  public void testExtractSecuritiesBadPaymentDate() {
    FraTrade fra = createBasicFra();
    fra.setPaymentDate(fra.getEffectiveDate().plusDays(1));
    FraTradeSecurityExtractor fraExtractor = new FraTradeSecurityExtractor(fra);
    //should throw:
    fraExtractor.extractSecurities();
  }
View Full Code Here

  }

  @Test
  public void testExtractSecuritiesWithCalendarInfo() {
    //should work, but will print a warning
    FraTrade fra = createBasicFra();
    fra.setDayCount("Modified Following");
    fra.setBusinessDayConvention("Actual/365");
    FraTradeSecurityExtractor fraExtractor = new FraTradeSecurityExtractor(fra);
    ManageableSecurity[] extractSecurities = fraExtractor.extractSecurities();
    assertEquals(1, extractSecurities.length, "One fra expected");
    assertEquals(FRASecurity.class, extractSecurities[0].getClass(), "Expected instance of FraSecurity");
  }
View Full Code Here

TOP

Related Classes of com.opengamma.integration.tool.portfolio.xml.v1_0.SchemaGenerator

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.