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

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


 
  /**
   * @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


  }

  //-------------------------------------------------------------------------
  @Override
  protected ManageableSecurity createSecurity() {
    FutureOptionSecurityDefinition defn = getSecurityDefinition();
    ExternalId underlyingId = defn.getUnderlyingId().toExternalId();
    Expiry expiry = new Expiry(defn.getFutureExpiry().atDay(1).atStartOfDay(ZoneOffset.UTC), ExpiryAccuracy.MONTH_YEAR);
    String exchange = defn.getExchange();
    Currency currency = defn.getCurrency();
    int pointValue = defn.getPointValue();
    boolean isMargined = defn.isIsMargined();
    double strike = defn.getStrike().doubleValue();
    OptionType optionType = defn.getOptionType();
    ExerciseType exerciseType = defn.getExerciseType().convert();

    switch (defn.getListedFutureOptionType()) {
      case EQUITY_INDEX_FUTURE_OPTION:
        return new EquityIndexFutureOptionSecurity(exchange, expiry, exerciseType, underlyingId, pointValue,
                                                   isMargined, currency, strike, optionType);
      case EQUITY_DIVIDEND_FUTURE_OPTION:
        return new EquityIndexDividendFutureOptionSecurity(exchange,  expiry, exerciseType, underlyingId, pointValue,
                                                           isMargined, currency, strike, optionType);
      default:
        // The xml validation should prevent this from happening
        throw new PortfolioParsingException("Unrecognised listed option type: " + defn.getListedFutureOptionType());
    }
  }
View Full Code Here

    super(securityDefinition);
  }

  @Override
  protected ManageableSecurity createSecurity() {
    FutureSecurityDefinition defn = getSecurityDefinition();
    ExternalId underlyingId = defn.getUnderlyingId().toExternalId();
    Expiry expiry = new Expiry(defn.getFutureExpiry().atDay(1).atStartOfDay(ZoneOffset.UTC), ExpiryAccuracy.MONTH_YEAR);
    String exchange = defn.getExchange();
    Currency currency = defn.getCurrency();
    int pointValue = defn.getPointValue();
    String settlementExchange = defn.getSettlementExchange();
    ZonedDateTime settlementDate = defn.getSettlementDate().atStartOfDay(ZoneOffset.UTC);

    switch (defn.getFutureType()) {
      case EQUITY_DIVIDEND_FUTURE:
        return new EquityIndexDividendFutureSecurity(
            expiry,
            exchange,
            settlementExchange,
            currency,
            pointValue,
            settlementDate,
            underlyingId,
            defn.getFutureCategory());
      case EQUITY_INDEX_FUTURE:
        throw new PortfolioParsingException("EquityIndexFuture is not yet supported");
      default:
        // The xml validation should prevent this from happening
        throw new PortfolioParsingException("Unrecognised listed option type: " + defn.getFutureType());
    }
  }
View Full Code Here

  }

  //-------------------------------------------------------------------------
  @Override
  public ManageableSecurity[] extractSecurities() {
    FxDigitalOptionTrade trade = getTrade();
    Currency payoutCurrency = trade.getPayoutCurrency();
    FxOptionCalculator calculator = new FxOptionCalculator(trade, trade.getPayout(), payoutCurrency);

    ManageableSecurity security = new FXDigitalOptionSecurity(
        calculator.getPutCurrency(),
        calculator.getCallCurrency(),
        calculator.getPutAmount(),
View Full Code Here

  }

  //-------------------------------------------------------------------------
  @Override
  public ManageableSecurity[] extractSecurities() {
    FxForwardTrade trade = getTrade();
    ExternalId region = extractRegion(trade.getPaymentCalendars());
    boolean nonDeliverable = checkNonDeliverable(trade);

    Currency payCurrency = trade.getPayCurrency();
    double payAmount = trade.getPayAmount().doubleValue();
    Currency receiveCurrency = trade.getReceiveCurrency();
    double receiveAmount = trade.getReceiveAmount().doubleValue();
    ZonedDateTime forwardDate = convertLocalDate(trade.getMaturityDate());

    ManageableSecurity security = nonDeliverable ?
        // todo - expiry should be used in construction of NonDeliverableFXForwardSecurity
        new NonDeliverableFXForwardSecurity(payCurrency, payAmount, receiveCurrency, receiveAmount, forwardDate,
                                            region, trade.getSettlementCurrency().equals(trade.getReceiveCurrency())) :
        new FXForwardSecurity(payCurrency, payAmount, receiveCurrency, receiveAmount, forwardDate, region);

    return securityArray(addIdentifier(security));
  }
View Full Code Here

  }

  //-------------------------------------------------------------------------
  @Override
  public ManageableSecurity[] extractSecurities() {
    FxOptionTrade trade = getTrade();
    FxOptionCalculator calculator = new FxOptionCalculator(trade, trade.getNotional(), trade.getNotionalCurrency());
    ExerciseType exerciseType = trade.getExerciseType().convert();
    ManageableSecurity security = trade.getSettlementType() == SettlementType.PHYSICAL ?
        new FXOptionSecurity(
            calculator.getPutCurrency(),
            calculator.getCallCurrency(),
            calculator.getPutAmount(),
            calculator.getCallAmount(),
            calculator.getExpiry(),
            calculator.getSettlementDate(),
            calculator.isLong(),
            exerciseType) :
        new NonDeliverableFXOptionSecurity(
            calculator.getPutCurrency(),
            calculator.getCallCurrency(),
            calculator.getPutAmount(),
            calculator.getCallAmount(),
            calculator.getExpiry(),
            calculator.getSettlementDate(),
            calculator.isLong(),
            exerciseType,
            trade.getSettlementCurrency().equals(calculator.getCallCurrency().getCode()));
    return securityArray(addIdentifier(security));
  }
View Full Code Here

  /**
   * Creates an instance.
   */
  public PortfolioConversionV1_0() {
    super(new SchemaVersion("1.0"), PortfolioDocumentV1_0.class, new PortfolioDocumentConverterV1_0(), new IdRefResolverFactoryV1_0());
  }
View Full Code Here

      managedPositions.addAll(processPortfolio(nestedPortfolio, false, portfolioPath));
    }

    for (Position position : nullCheckIterable(portfolio.getPositions())) {

      IdWrapper positionExternalId = position.getExternalSystemId();
      String positionId = positionExternalId != null ? positionExternalId.toExternalId().toString() : "AUTO-CREATED";
      s_logger.debug("Extracting position: [{}]", positionId);

      List<Trade> trades = position.getTrades();
      BigDecimal tradeTotalQuantity = BigDecimal.ZERO;
View Full Code Here

    // rather than the total quantity obtained from the trades
    BigDecimal positionQuantity = position.getQuantity();
    ManageablePosition manageablePosition = new ManageablePosition(
        positionQuantity != null ? positionQuantity : tradeQuantity, security.getExternalIdBundle());

    IdWrapper externalSystemId = position.getExternalSystemId();
    if (externalSystemId != null) {
      manageablePosition.setProviderId(externalSystemId.toExternalId());
    }

    List<Trade> trades = position.getTrades();
    for (Trade trade : nullCheckIterable(trades)) {
      manageablePosition.addTrade(convertTrade(trade, security));
View Full Code Here

   * @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);
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.