Package com.opengamma.core.security

Examples of com.opengamma.core.security.Security


    s_logger.debug("{}+{}", indent, node.getName());
    for (final PortfolioNode childNode : node.getChildNodes()) {
      writePortfolio(securitySource, childNode, indent + "  ");
    }
    for (final Position position : node.getPositions()) {
      final Security security = position.getSecurityLink().resolve(securitySource);
      s_logger.debug("{} {} x {}", new Object[] {indent, position.getQuantity(), security });
    }
  }
View Full Code Here


  public String visitCommodityFutureOptionSecurity(CommodityFutureOptionSecurity security) {
    if (security.getUnderlyingId().isScheme(_preferredScheme)) {
      String identifier = security.getUnderlyingId().getValue();
      return identifier != null ? identifier : NOT_APPLICABLE;
    } else {
      Security underlying = _securitySource.getSingle(ExternalIdBundle.of(security.getUnderlyingId()));
      if (underlying != null) {
        String identifier = underlying.getExternalIdBundle().getValue(_preferredScheme);
        return identifier != null ? identifier : NOT_APPLICABLE;
      } else {
        String identifier = security.getUnderlyingId() != null ? security.getUnderlyingId().getValue() : null;
        return identifier != null ? identifier : NOT_APPLICABLE;
      }
View Full Code Here

  public String visitEquityOptionSecurity(EquityOptionSecurity security) {
    if (security.getUnderlyingId().isScheme(_preferredScheme)) {
      String identifier = security.getUnderlyingId().getValue();
      return identifier != null ? identifier : NOT_APPLICABLE;
    } else {
      Security underlying = _securitySource.getSingle(ExternalIdBundle.of(security.getUnderlyingId()));
      if (underlying != null) {
        String identifier = underlying.getExternalIdBundle().getValue(_preferredScheme);
        return identifier != null ? identifier : NOT_APPLICABLE;
      } else {
        String identifier = security.getUnderlyingId() != null ? security.getUnderlyingId().getValue() : null;
        return identifier != null ? identifier : NOT_APPLICABLE;
      }
View Full Code Here

  public String visitEquityBarrierOptionSecurity(EquityBarrierOptionSecurity security) {
    if (security.getUnderlyingId().isScheme(_preferredScheme)) {
      String identifier = security.getUnderlyingId().getValue();
      return identifier != null ? identifier : NOT_APPLICABLE;
    } else {
      Security underlying = _securitySource.getSingle(ExternalIdBundle.of(security.getUnderlyingId()));
      if (underlying != null) {
        String identifier = underlying.getExternalIdBundle().getValue(_preferredScheme);
        return identifier != null ? identifier : NOT_APPLICABLE;
      } else {
        String identifier = security.getUnderlyingId() != null ? security.getUnderlyingId().getValue() : null;
        return identifier != null ? identifier : NOT_APPLICABLE;
      }
View Full Code Here

  public String visitIRFutureOptionSecurity(IRFutureOptionSecurity security) {
    if (security.getUnderlyingId().isScheme(_preferredScheme)) {
      String identifier = security.getUnderlyingId().getValue();
      return identifier != null ? identifier : NOT_APPLICABLE;
    }
    Security underlying = _securitySource.getSingle(ExternalIdBundle.of(security.getUnderlyingId()));
    String identifier = underlying.getExternalIdBundle().getValue(_preferredScheme);
    return identifier != null ? identifier : NOT_APPLICABLE;
  }
View Full Code Here

  public String visitCreditDefaultSwapIndexSecurity(CreditDefaultSwapIndexSecurity security) {
    if (security.getReferenceEntity().isScheme(_preferredScheme)) {
      String identifier = security.getReferenceEntity().getValue();
      return identifier != null ? identifier : NOT_APPLICABLE;
    }
    Security underlying = _securitySource.getSingle(ExternalIdBundle.of(security.getReferenceEntity()));
    String identifier = underlying.getExternalIdBundle().getValue(_preferredScheme);
    return identifier != null ? identifier : NOT_APPLICABLE;
  }
View Full Code Here

  public String visitCreditDefaultSwapOptionSecurity(CreditDefaultSwapOptionSecurity security) {
    if (security.getUnderlyingId().isScheme(_preferredScheme)) {
      String identifier = security.getUnderlyingId().getValue();
      return identifier != null ? identifier : NOT_APPLICABLE;
    }
    Security underlying = _securitySource.getSingle(ExternalIdBundle.of(security.getUnderlyingId()));
    String identifier = underlying.getExternalIdBundle().getValue(_preferredScheme);
    return identifier != null ? identifier : NOT_APPLICABLE;
  }
View Full Code Here

      } else {
        return NO_LIQUIDITY;
      }
    } else {
      try {
        Security sec = position.getSecurityLink().getTarget();
        if (sec == null) {
          sec = position.getSecurityLink().resolve(_secSource); // side effect is it updates target.
        }
        Double daysToLiquidate = getDaysToLiquidate(position);
        if (daysToLiquidate != null) {
View Full Code Here

      }
    }
  }
 
  private Double getDaysToLiquidate(Position position) {
    Security security = position.getSecurity();
    UniqueId cacheKey = position.getUniqueId();
    if (_caching && cacheKey != null) {
      if (_daysToLiquidateCache.containsKey(cacheKey)) {
        return _daysToLiquidateCache.get(cacheKey);
      }
    }
   
    Pair<LocalDate, Double> latestDataPoint = _htsSource.getLatestDataPoint(FIELD, security.getExternalIdBundle(), RESOLUTION_KEY);
    if (latestDataPoint != null) {
      double volume = latestDataPoint.getSecond();
      double daysToLiquidate = (volume / position.getQuantity().doubleValue()) * LIQUIDATE_FACTOR;
     
      if (_caching && cacheKey != null) {
View Full Code Here

      final BloombergHistoricalTimeSeriesLoader loader = new BloombergHistoricalTimeSeriesLoader(
          getToolContext().getHistoricalTimeSeriesMaster(),
          getToolContext().getHistoricalTimeSeriesProvider(),
          new BloombergIdentifierProvider(getToolContext().getBloombergReferenceDataProvider()));
      for (final SecurityDocument doc : readEquitySecurities()) {
        final Security security = doc.getSecurity();
        loader.loadTimeSeries(ImmutableSet.of(security.getExternalIdBundle().getExternalId(ExternalSchemes.BLOOMBERG_TICKER)), "UNKNOWN", "PX_LAST", LocalDate.now().minusYears(1), LocalDate.now());
      }
      loader.loadTimeSeries(_historicalDataToLoad, "UNKNOWN", "PX_LAST", LocalDate.now().minusYears(1), LocalDate.now());
      _historicalDataToLoad.clear();
      log.done();
    } catch (final RuntimeException t) {
View Full Code Here

TOP

Related Classes of com.opengamma.core.security.Security

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.