Package com.opengamma.master.security

Examples of com.opengamma.master.security.ManageableSecurity


    List<SwapLeg> recLegs = Lists.newArrayList(trade.getReceiveLegs());

    Preconditions.checkState(payLegs.size() == 1, format("Swaps must have one (and only one) pay leg. Found %d", payLegs.size()));
    Preconditions.checkState(recLegs.size() == 1, format("Swaps must have one (and only one) receive leg. Found %d", recLegs.size()));

    ManageableSecurity security = new SwapSecurity(
        convertLocalDate(trade.getTradeDate()),
        convertLocalDate(trade.getEffectiveDate()),
        convertLocalDate(trade.getMaturityDate()),
        trade.getCounterparty().getExternalId().getId(),
        convertLeg(payLegs.get(0)),
View Full Code Here


  }

  //-------------------------------------------------------------------------
  @Override
  public ManageableSecurity[] extract() {
    ManageableSecurity security = createSecurity();
    security.addExternalId(ExternalId.of("XML_LOADER", Integer.toHexString(
        new HashCodeBuilder()
            .append(security.getClass())
            .append(security)
            .toHashCode())));
    security.setAttributes(getSecurityDefinition().getAdditionalAttributes());
    return new ManageableSecurity[]{security};
  }
View Full Code Here

  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(),
        calculator.getCallAmount(),
        payoutCurrency,
View Full Code Here

    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);
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(),
View Full Code Here

  //-------------------------------------------------------------------------
  @Override
  public ManageableSecurity[] extractSecurities() {
    SwaptionTrade trade = getTrade();
    SwapTrade swapTrade = trade.getUnderlyingSwapTrade();
    ManageableSecurity underlying = swapTrade.getSecurityExtractor().extractSecurities()[0];

    ExternalId underlyingId = underlying.getExternalIdBundle().getExternalId(ExternalScheme.of("XML_LOADER"));

    List<FixedLeg> fixedLegs = Lists.newArrayList(swapTrade.getFixedLegs());

    //note - these fields are resolved on a best effort basis
    //since they aren't actually used by the analytics.
    //see PLAT-1924
    Currency currency = null;
    boolean isPayer = false;

    if (!fixedLegs.isEmpty()) {
      currency = fixedLegs.get(0).getCurrency();
      isPayer = fixedLegs.get(0).getDirection() == Direction.PAY;
    }

    Expiry expiry = new Expiry(convertLocalDate(trade.getExpirationDate()));

    ManageableSecurity security = new SwaptionSecurity(
        isPayer, underlyingId, trade.getBuySell() == BuySell.BUY,
        expiry, trade.getSettlementType() == SettlementType.CASH_SETTLED,
        currency,
        null, trade.getExerciseType().convert(),
        convertLocalDate(trade.getCashSettlementPaymentDate()));
View Full Code Here

    // Write securities
    final List<ManageableSecurity> writtenSecurities = new ArrayList<>();
    for (ManageableSecurity security : securities) {
      if (security != null || !_discardIncompleteOptions) { // latter term preserves old behaviour
        ManageableSecurity writtenSecurity = writeSecurity(security);
        if (writtenSecurity != null) {
          writtenSecurities.add(writtenSecurity);
        }
      }
    }
View Full Code Here

   
    ArgumentChecker.notNull(security, "security");
   
    SecuritySearchResult searchResult = lookupSecurity(security);

    ManageableSecurity foundSecurity = updateSecurityVersionIfFound(security, searchResult);

    if (foundSecurity != null) {
      return foundSecurity;
    } else {
      return addSecurity(security);
View Full Code Here

   
    List<ManageableSecurity> writtenSecurities = new ArrayList<ManageableSecurity>();
   
    // Write securities
    for (ManageableSecurity security : securities) {
      ManageableSecurity writtenSecurity = writeSecurity(security);
      if (writtenSecurity != null) {
        writtenSecurities.add(writtenSecurity);
      }
    }
View Full Code Here

      ManageablePosition position = _positionMaster.get(positionId, _versionCorrection).getPosition();
      if (position == null) {
        throw new DataNotFoundException("No position found with ID " + positionId + " and " +
                                            "version-correction " + _versionCorrection);
      }
      ManageableSecurity security = (ManageableSecurity) position.getSecurityLink().resolve(_securitySource);
      ExternalId underlyingId = FinancialSecurityUtils.getUnderlyingId(security);
      ManageableSecurity underlying;
      if (underlyingId != null) {
        SecuritySearchResult searchResult = _securityMaster.search(new SecuritySearchRequest(underlyingId));
        underlying = searchResult.getFirstSecurity();
      } else {
        underlying = null;
View Full Code Here

TOP

Related Classes of com.opengamma.master.security.ManageableSecurity

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.