Examples of FraTrade


Examples of com.opengamma.integration.tool.portfolio.xml.v1_0.jaxb.FraTrade

    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

Examples of com.opengamma.integration.tool.portfolio.xml.v1_0.jaxb.FraTrade

@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

Examples of com.opengamma.integration.tool.portfolio.xml.v1_0.jaxb.FraTrade

   
  }

  @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

Examples of com.opengamma.integration.tool.portfolio.xml.v1_0.jaxb.FraTrade

  }

  @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

Examples of com.opengamma.integration.tool.portfolio.xml.v1_0.jaxb.FraTrade

 
  /**
   * @return a fra with some fields set
   */
  private FraTrade createBasicFra(){
    FraTrade fra = new FraTrade();

    IdWrapper tradeId = createExternalId("IdFromExternalSystem", "External");
    IdWrapper regionId = createExternalId("IdFromExternalSystem", "External");
    IdWrapper counterparty = createExternalId("GOLDMAN", "Cpty");
   
    fra.setExternalSystemId(tradeId);
    fra.setTradeDate(LocalDate.of(2013, 1, 21));
    fra.setCounterparty(counterparty);
    fra.setPayFixed(true);
    fra.setRegionId(regionId);
    fra.setEffectiveDate(LocalDate.of(2013, 1, 23));
    fra.setPaymentDate(LocalDate.of(2013, 1, 23));
    fra.setFixingDate(LocalDate.of(2013, 2, 21));
    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
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.