Package com.opengamma

Examples of com.opengamma.OpenGammaRuntimeException


   */
  protected void testDates(final LocalDate d1, final LocalDate d2) {
    ArgumentChecker.notNull(d1, "first date");
    ArgumentChecker.notNull(d2, "second date");
    if (!(d2.isAfter(d1) || d2.equals(d1))) {
      throw new OpenGammaRuntimeException("d2 must be on or after d1: have d1 = " + d1 + " and d2 = " + d2);
    }
  }
View Full Code Here


      if (instance == null) {
        try {
          instance = (DayCount) Class.forName(clazz).newInstance();
          instances.put(clazz, instance);
        } catch (InstantiationException ex) {
          throw new OpenGammaRuntimeException("Error initialising DayCount conventions", ex);
        } catch (IllegalAccessException ex) {
          throw new OpenGammaRuntimeException("Error initialising DayCount conventions", ex);
        } catch (ClassNotFoundException ex) {
          throw new OpenGammaRuntimeException("Error initialising DayCount conventions", ex);
        }
      }
      _conventionMap.put(convention.toLowerCase(Locale.ENGLISH), instance);
    }
    _conventions = new ArrayList<>(instances.values());
View Full Code Here

    if (xData.length > 1) {
      _curve = InterpolatedDoublesCurve.fromSorted(xData, yData, INTERPOLATOR);
    } else if (xData.length == 1) {
      _curve = ConstantDoublesCurve.from(yData[0])// Unless the curve is flat, in which case use a constant curve
    } else {
      throw new OpenGammaRuntimeException("Cannot construct a curve with no points");
    }

    _shiftedTimePoints = new double[xData.length];

    for (int i = 0; i < xData.length; ++i) {
View Full Code Here

        FudgeMsg msg = reader.nextMessage();
        LoggedReferenceData loggedData = fudgeContext.fromFudgeMsg(LoggedReferenceData.class, msg);
        addDataToMap(fudgeContext, dataMap, loggedData);
      }
    } catch (FileNotFoundException ex) {
      throw new OpenGammaRuntimeException("Cannot open " + inputFile + " for reading");
    } finally {
      if (reader != null) {
        reader.close();
      }
    }
View Full Code Here

    );

    // In some cases the solver can diverge and report a root found at the upper bound
    // This needs to be reported as an error
    if (dataPoints[0] == HAZARD_SOLVER_UPPER_BOUND) {
      throw new OpenGammaRuntimeException("Failed to converge finding hazard rate");
    }

    final ISDACurve hazardRateCurve = new ISDACurve(cds.getSpreadCurveName(), timePoints, dataPoints, 0.0);

    return valueCDS(cds, hazardRateCurve, paymentTimeline, accrualTimeline, contingentTimeline, offsetStepinTime, stepinDiscountFactor, settlementDiscountFactor, cleanPrice);
View Full Code Here

   */
  private double valueCDS(final ISDACDSDerivative cds, final ISDACurve hazardRateCurve, final Timeline paymentTimeline, final Timeline accrualTimeline, final Timeline contingentTimeline,
    final double stepinTime, final double stepinDiscountFactor, final double settlementDiscountFactor, final boolean cleanPrice) {

    if (stepinTime < PRICING_TIME) {
      throw new OpenGammaRuntimeException("Cannot value a CDS with step-in date before pricing date");
    }

    final double contingentLeg = valueContingentLeg(cds, contingentTimeline, hazardRateCurve, settlementDiscountFactor);
    final double feeLeg = valueFeeLeg(cds, paymentTimeline, accrualTimeline, hazardRateCurve, stepinTime, stepinDiscountFactor, settlementDiscountFactor);
    final double dirtyPrice = (contingentLeg - feeLeg) * cds.getNotional();
 
View Full Code Here

    }
   
    try {
      _sessionProvider.getSession().subscribe(sl);
    } catch (Exception e) {
      throw new OpenGammaRuntimeException("Could not subscribe to " + bbgUniqueIds, e);
    }
   
    return returnValue;
  }
View Full Code Here

    int afterSubscriptionCount = requested + getActiveSubscriptionIds().size();
    if (afterSubscriptionCount > getSubscriptionLimit()) {
      String message = "Rejecting subscription request, would result in limit of " + getSubscriptionLimit() + " being exceeded " + afterSubscriptionCount;
      s_logger.warn(message);
      _lastLimitRejection = new RejectedDueToSubscriptionLimitEvent(getSubscriptionLimit(), requested, afterSubscriptionCount);
      throw new OpenGammaRuntimeException(message);
    }
  }
View Full Code Here

    }
   
    try {
      _sessionProvider.getSession().unsubscribe(sl);
    } catch (Exception e) {
      throw new OpenGammaRuntimeException("Could not unsubscribe from " + subscriptionHandles, e);
    }
  }
View Full Code Here

        y1 = yLo;
      } else if (y1 * yHi < 0.0) {
        x2 = upperBound;
        y2 = yHi;
      } else {
        throw new OpenGammaRuntimeException("Failed to find root");
      }
    }
   
    if (x1 > x2) {
      temp = x1; x1 = x2; x2 = temp;
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.