Package com.opengamma.master.position

Examples of com.opengamma.master.position.ManageableTrade$Meta


    @Override
    public PortfolioNode createPortfolioNode() {
      final SimplePortfolioNode node = new SimplePortfolioNode("CM Swap");
      for (final Tenor tenor : _tenors) {
        final SwapSecurity swap = createSwap(tenor);
        final ManageableTrade trade = new ManageableTrade(BigDecimal.ONE, getSecurityPersister().storeSecurity(swap), _tradeDate.toLocalDate(),
            _tradeDate.toOffsetDateTime().toOffsetTime(), ExternalId.of(Counterparty.DEFAULT_SCHEME, COUNTERPARTY));
        trade.setPremium(0.);
        trade.setPremiumCurrency(CURRENCY);
        final Position position = SimplePositionGenerator.createPositionFromTrade(trade);
        node.addPosition(position);
      }
      return node;
    }
View Full Code Here


      for (final Tenor payTenor : _payTenors) {
        for (final Tenor receiveTenor : _receiveTenors) {
          for (final Tenor maturity : _maturities) {
            for (final double strike : _strikes) {
              final CapFloorCMSSpreadSecurity cap = createCMSCapFloorSpread(payTenor, receiveTenor, maturity, strike);
              final ManageableTrade trade = new ManageableTrade(BigDecimal.ONE, getSecurityPersister().storeSecurity(cap), _tradeDate.toLocalDate(),
                  _tradeDate.toOffsetDateTime().toOffsetTime(), ExternalId.of(Counterparty.DEFAULT_SCHEME, COUNTERPARTY));
              trade.setPremium(0.);
              trade.setPremiumCurrency(CURRENCY);
              final Position position = SimplePositionGenerator.createPositionFromTrade(trade);
              node.addPosition(position);
            }
          }
        }
View Full Code Here

      final SimplePortfolioNode node = new SimplePortfolioNode(_name);
      for (int i = 0; i < _securities.length; i++) {
        final BigDecimal n = new BigDecimal(_amounts[i]);
        final GovernmentBondSecurity bond = _securities[i];
        final ZonedDateTime tradeDate = bond.getSettlementDate();
        final ManageableTrade trade = new ManageableTrade(n, getSecurityPersister().storeSecurity(bond), tradeDate.toLocalDate(),
            tradeDate.toOffsetDateTime().toOffsetTime(), ExternalId.of(Counterparty.DEFAULT_SCHEME, COUNTERPARTY));
        trade.setPremium(bond.getIssuancePrice());
        trade.setPremiumCurrency(bond.getCurrency());
        final Position position = SimplePositionGenerator.createPositionFromTrade(trade);
        node.addPosition(position);
      }
      return node;
    }
View Full Code Here

      }
      ExternalId counterpartyId = null;
      if (cpartyScheme != null && cpartyValue != null) {
        counterpartyId = ExternalId.of(cpartyScheme, cpartyValue);
      }
      _trade = new ManageableTrade(tradeQuantity, ExternalIdBundle.EMPTY, tradeDate, tradeOffsetTime, counterpartyId);
      _trade.setUniqueId(createUniqueId(tradeOid, tradeId));
      if (providerScheme != null && providerValue != null) {
        _trade.setProviderId(ExternalId.of(providerScheme, providerValue));
      }
      //set premium
View Full Code Here

        return new RawSecurity();
      }

      @Override
      public ManageableTrade createSecurityTrade(QuantityGenerator quantityGenerator, SecurityPersister securityPersister, NameGenerator counterPartyGenerator) {
        ManageableTrade trade = null;
        RawSecurity security = createSecurity();
        ZonedDateTime tradeDate = ZonedDateTime.now();
        trade = new ManageableTrade(quantityGenerator.createQuantity(), securityPersister.storeSecurity(security), tradeDate.toLocalDate(), tradeDate.toOffsetDateTime().toOffsetTime(),
            ExternalId.of(Counterparty.DEFAULT_SCHEME, counterPartyGenerator.createName()));
        return trade;
      }
     
    }, new InMemorySecurityPersister(source));
View Full Code Here

    ManageablePosition position = new ManageablePosition(BigDecimal.valueOf(shares), bundle);

    // create random trades that add up in shares to the position they're under (this is not enforced by the system)
    if (shares <= 2000) {
      ManageableTrade trade = new ManageableTrade(BigDecimal.valueOf(shares), bundle, _tradeDate3, null, ExternalId.of("CPARTY", "BACS"));
      position.addTrade(trade);
    } else {
      ManageableTrade trade1 = new ManageableTrade(BigDecimal.valueOf(2000), bundle, _tradeDate1, null, ExternalId.of("CPARTY", "BACS"));
      position.addTrade(trade1);
      ManageableTrade trade2 = new ManageableTrade(BigDecimal.valueOf(shares - 2000), bundle, _tradeDate2, null, ExternalId.of("CPARTY", "BACS"));
      position.addTrade(trade2);
    }
    return position;
  }
View Full Code Here

    @SuppressWarnings("synthetic-access")
    @Override
    public PortfolioNode createPortfolioNode() {
      final SimplePortfolioNode node = new SimplePortfolioNode(_name);
      for (final ManageableSecurity security : _securities) {
        final ManageableTrade trade = new ManageableTrade(BigDecimal.ONE, getSecurityPersister().storeSecurity(security), _tradeDate.toLocalDate(),
            _tradeDate.toOffsetDateTime().toOffsetTime(), ExternalId.of(Counterparty.DEFAULT_SCHEME, COUNTERPARTY));
        trade.setPremium(0.);
        trade.setPremiumCurrency(CURRENCY);
        final Position position = SimplePositionGenerator.createPositionFromTrade(trade);
        node.addPosition(position);
      }
      return node;
    }
View Full Code Here

    public PortfolioNode createPortfolioNode() {
      final SimplePortfolioNode node = new SimplePortfolioNode(_name);
      for (int i = 0; i < _securities.length; i++) {
        final BigDecimal n = new BigDecimal(_amounts[i]);
        final double premium = _prices[i];
        final ManageableTrade trade = new ManageableTrade(n, getSecurityPersister().storeSecurity(_securities[i]), _tradeDate.toLocalDate(),
            _tradeDate.toOffsetDateTime().toOffsetTime(), ExternalId.of(Counterparty.DEFAULT_SCHEME, COUNTERPARTY));
        trade.setPremium(premium);
        trade.setPremiumCurrency(CURRENCY);
        final Position position = SimplePositionGenerator.createPositionFromTrade(trade);
        node.addPosition(position);
      }
      return node;
    }
View Full Code Here

    public PortfolioNode createPortfolioNode() {
      final SimplePortfolioNode node = new SimplePortfolioNode(_name);
      for (int i = 0; i < _securities.length; i++) {
        final BigDecimal n = new BigDecimal(_amounts[i]);
        final double premium = _prices[i];
        final ManageableTrade trade = new ManageableTrade(n, getSecurityPersister().storeSecurity(_securities[i]), _tradeDate.toLocalDate(),
            _tradeDate.toOffsetDateTime().toOffsetTime(), ExternalId.of(Counterparty.DEFAULT_SCHEME, COUNTERPARTY));
        trade.setPremium(premium);
        trade.setPremiumCurrency(CURRENCY);
        final Position position = SimplePositionGenerator.createPositionFromTrade(trade);
        node.addPosition(position);
      }
      return node;
    }
View Full Code Here

    int shares = (RandomUtils.nextInt(490) + 10) * 10;
    ExternalIdBundle bundle = security.getExternalIdBundle();
   
    ManageablePosition position = new ManageablePosition(BigDecimal.valueOf(shares), bundle);
    ManageableTrade trade = new ManageableTrade(BigDecimal.valueOf(shares), bundle, LocalDate.of(2010, 12, 3), null, ExternalId.of("CPARTY", "BACS"));
    position.addTrade(trade);
  
    return position;
  }
View Full Code Here

TOP

Related Classes of com.opengamma.master.position.ManageableTrade$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.