Package com.opengamma

Examples of com.opengamma.OpenGammaRuntimeException


  private FederalFundsFutureSecurity getFederalFundsFuture(final RateFutureNode rateFuture, final FederalFundsFutureConvention futureConvention,
                                                           final Double price) {
    final String expiryCalculatorName = futureConvention.getExpiryConvention().getValue();
    final OvernightIndexConvention indexConvention = _conventionSource.getConvention(OvernightIndexConvention.class, rateFuture.getUnderlyingConvention());
    if (indexConvention == null) {
      throw new OpenGammaRuntimeException("Underlying convention was null");
    }
    final Currency currency = indexConvention.getCurrency();
    final DayCount dayCount = indexConvention.getDayCount();
    final int publicationLag = indexConvention.getPublicationLag();
    final IndexON index = new IndexON(indexConvention.getName(), currency, dayCount, publicationLag);
View Full Code Here


  @Override
  protected void doRun() throws Exception {
    final Random random = new Random(3457);
    final Collection<FinancialSecurity> vanillaSwaps = getVanillaSwapSecurities(random);
    if (vanillaSwaps.isEmpty()) {
      throw new OpenGammaRuntimeException("No valid vanilla swaps were generated");
    }
    final Collection<FinancialSecurity> oisSwaps = getOISSwapSecurities(random);
    if (oisSwaps.isEmpty()) {
      throw new OpenGammaRuntimeException("No valid OIS were generated");
    }
    final Collection<FinancialSecurity> basisSwaps = getBasisSwapSecurities(random);
    if (basisSwaps.isEmpty()) {
      throw new OpenGammaRuntimeException("No valid basis swaps were generated");
    }
    final Collection<FinancialSecurity> futures = getIRFutureSecurities(random);
    if (futures.isEmpty()) {
      throw new OpenGammaRuntimeException("No valid futures were generated");
    }
//    persistToPortfolio(Arrays.asList(vanillaSwaps, oisSwaps, basisSwaps, futures), Arrays.asList("EUR Vanilla Swaps", "EUR OIS Swaps", "EUR 3m/6m Basis Swaps", "STIR Futures"), PORTFOLIO_NAME);   
    persistToPortfolio(Arrays.asList(vanillaSwaps, oisSwaps, basisSwaps), Arrays.asList("EUR Vanilla Swaps", "EUR OIS Swaps", "EUR 3m/6m Basis Swaps"), PORTFOLIO_NAME);
  }
View Full Code Here

    FudgeMsg mappingMsg = (FudgeMsg) mapping.getValue();
    List<FudgeField> keys = mappingMsg.getAllByOrdinal(1); // keys
    List<FudgeField> values = mappingMsg.getAllByOrdinal(2); // values
    if (keys.size() != values.size()) {
      s_logger.error("keys and values list in map don't have the same number of elements: message = {}", message);
      throw new OpenGammaRuntimeException("keys and values list in map don't have the same number of elements");
    }
    for (int i = 0; i < keys.size(); i++) { // better to use iterators?
      FudgeField reqField = keys.get(i);
      ValueRequirement valueReq = deserializer.fieldValueToObject(ValueRequirement.class, reqField);
      FudgeField specField = values.get(i);
      ValueSpecification valueSpec = deserializer.fieldValueToObject(ValueSpecification.class, specField);
      if (valueReq == null || valueSpec == null) {
        s_logger.error("valueReq or valueSpec was null during deserialize: message = {}", message);
        throw new OpenGammaRuntimeException("valueReq or valueSpec was null during deserialize");
      }
      mappings.put(valueReq, valueSpec);
    }
    return DependencyGraphBuildTrace.of(dependencyGraph, exceptionsWithCounts, failures, mappings);
  }
View Full Code Here

          sbJavadoc = null;
        }
      }
      reader.close();
    } catch (final IOException e) {
      throw new OpenGammaRuntimeException("I/O exception", e);
    }
  }
View Full Code Here

          _valuePropertyDescription.add(Pair.of(Pattern.compile("^" + k.replace("\\", "\\\\").replace(".", "\\.").replace("*", ".*?") + "$"), v));
        }
      }
      reader.close();
    } catch (final IOException e) {
      throw new OpenGammaRuntimeException("I/O exception", e);
    }
  }
View Full Code Here

    final Map<String, FudgeMsg> refDataMap = referenceDataProvider.getReferenceData(memberEquities,
        Sets.newHashSet(BloombergFields.CURRENT_MARKET_CAP_FIELD, BloombergConstants.FIELD_GICS_SUB_INDUSTRY));
    for (final String equity : memberEquities) {
      final FudgeMsg fieldData = refDataMap.get(equity);
      if (fieldData == null) {
        throw new OpenGammaRuntimeException("Information not found for equity: " + equity);
      }
      final String gicsCodeString = fieldData.getString(BloombergConstants.FIELD_GICS_SUB_INDUSTRY);
      if (gicsCodeString == null) {
        continue;
      }
View Full Code Here

      //Short Calls
      final ArrayList<Pair<BloombergTickerParserEQOption, BloombergTickerParserEQOption>> calls = new ArrayList<Pair<BloombergTickerParserEQOption, BloombergTickerParserEQOption>>();
      for (int j = minIndex; j < strikeIndex; j++) {
        final Pair<BloombergTickerParserEQOption, BloombergTickerParserEQOption> pair = optionsByStrike.get(strikes[j]);
        if (pair == null) {
          throw new OpenGammaRuntimeException("no pair for strike" + strikes[j]);
        }
        calls.add(pair);
      }
      spreadOptions(bucketNode, calls, OptionType.CALL, -1, tickersToLoad, amountAtExpiry, includeUnderlying, calls.size());

      // Long Puts
      final ArrayList<Pair<BloombergTickerParserEQOption, BloombergTickerParserEQOption>> puts = new ArrayList<Pair<BloombergTickerParserEQOption, BloombergTickerParserEQOption>>();
      for (int j = strikeIndex + 1; j <= maxIndex; j++) {
        final Pair<BloombergTickerParserEQOption, BloombergTickerParserEQOption> pair = optionsByStrike.get(strikes[j]);
        if (pair == null) {
          throw new OpenGammaRuntimeException("no pair for strike" + strikes[j]);
        }
        puts.add(pair);
      }
      spreadOptions(bucketNode, puts, OptionType.PUT, 1, tickersToLoad, amountAtExpiry, includeUnderlying, puts.size());

      if (bucketNode.getChildNodes().size() + bucketNode.getPositionIds().size() > 0) {
        equityNode.addChildNode(bucketNode); //Avoid generating empty nodes
      }
    }

    for (final ExternalId optionTicker : tickersToLoad) {
      final ManageableSecurity loaded = getOrLoadSecurity(optionTicker);
      if (loaded == null) {
        throw new OpenGammaRuntimeException("Unexpected option type " + loaded);
      }

      //TODO [LAPANA-29] Should be able to do this for index options too
      if (includeUnderlying) {
        try {
          final HistoricalTimeSeriesInfoDocument loadedTs = getOrLoadTimeSeries(optionTicker, loaded.getExternalIdBundle());
          if (loadedTs == null) {
            throw new OpenGammaRuntimeException("Failed to get time series for " + loaded);
          }
        } catch (final Exception ex) {
          s_logger.info("Failed to get time series for " + loaded, ex);
        }
      }
View Full Code Here

    return tradeDate;
  }

  private Set<ExternalId> getOptionChain(final ExternalId ticker) {
    if (ticker.getScheme() != ExternalSchemes.BLOOMBERG_TICKER) {
      throw new OpenGammaRuntimeException("Not a bloomberg ticker " + ticker);
    }
    final ReferenceDataProvider referenceDataProvider = getToolContext().getBloombergReferenceDataProvider();

    final Set<ExternalId> optionChain = BloombergDataUtils.getOptionChain(referenceDataProvider, ticker.getValue()); //TODO [BBG-88] this query shouldn't get cached permanently
    if (optionChain == null) {
      throw new OpenGammaRuntimeException("Failed to get option chain for " + ticker);
    }
    s_logger.info("Got option chain {}", optionChain);
    return optionChain;
  }
View Full Code Here

      } else if (timeSeries.getTimeSeries().isEmpty()) {
        timeSeries = updateTimeSeries(timeSeries);
      }
      timeSeries = getAllowedRecentPoints(timeSeriesInfo);
      if (timeSeries == null || timeSeries.getTimeSeries().isEmpty()) {
        throw new OpenGammaRuntimeException("Couldn't load recent points for " + timeSeriesInfo);
      }
    }
    final Double latestValue = timeSeries.getTimeSeries().getLatestValue();
    if (latestValue == null) {
      throw new OpenGammaRuntimeException("Unexpected null latest vaule");
    }
    return latestValue;
  }
View Full Code Here

      case 0:
        return loadTimeSeries(idBundle);
      case 1:
        break;
      default:
        throw new OpenGammaRuntimeException("Multiple time series match " + htsSearch);
    }
    final HistoricalTimeSeriesInfoDocument timeSeriesInfo = htsSearch.getDocuments().get(0);
    s_logger.debug("Loaded time series info {} for underlying {}", timeSeriesInfo, ticker);
    return timeSeriesInfo;
  }
View Full Code Here

TOP

Related Classes of com.opengamma.OpenGammaRuntimeException

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.