예제 #1
0
  @Override
  public org.drip.math.calculus.WengertJacobian calcQuoteDFMicroJack(
      final java.lang.String strQuote,
      final org.drip.param.valuation.ValuationParams valParams,
      final org.drip.param.pricer.PricerParams pricerParams,
      final org.drip.param.definition.ComponentMarketParams mktParams,
      final org.drip.param.valuation.QuotingParams quotingParams) {
    if (null == valParams
        || valParams._dblValue >= _dblMaturity
        || null == strQuote
        || null == mktParams
        || null == mktParams.getDiscountCurve()) return null;

    if ("Rate".equalsIgnoreCase(strQuote)) {
      try {
        org.drip.analytics.definition.DiscountCurve dc = mktParams.getDiscountCurve();

        org.drip.math.calculus.WengertJacobian wjDF = dc.getDFJacobian(_dblMaturity);

        if (null == wjDF) return null;

        org.drip.math.calculus.WengertJacobian wjDFMicroJack =
            new org.drip.math.calculus.WengertJacobian(1, wjDF.numParameters());

        for (int k = 0; k < wjDF.numParameters(); ++k) {
          if (!wjDFMicroJack.accumulatePartialFirstDerivative(
              0,
              k,
              -365.25
                  / (_dblMaturity - _dblEffective)
                  / dc.getDF(_dblMaturity)
                  * wjDF.getFirstDerivative(0, k))) return null;
        }

        return wjDFMicroJack;
      } catch (java.lang.Exception e) {
        e.printStackTrace();
      }
    }

    return null;
  }
예제 #2
0
  @Override
  public org.drip.math.calculus.WengertJacobian calcPVDFMicroJack(
      final org.drip.param.valuation.ValuationParams valParams,
      final org.drip.param.pricer.PricerParams pricerParams,
      final org.drip.param.definition.ComponentMarketParams mktParams,
      final org.drip.param.valuation.QuotingParams quotingParams) {
    if (null == valParams
        || valParams._dblValue >= _dblMaturity
        || null == mktParams
        || null == mktParams.getDiscountCurve()) return null;

    try {
      org.drip.analytics.support.CaseInsensitiveTreeMap<java.lang.Double> mapMeasures =
          value(valParams, pricerParams, mktParams, quotingParams);

      if (null == mapMeasures) return null;

      double dblPV = mapMeasures.get("PV");

      org.drip.analytics.definition.DiscountCurve dc = mktParams.getDiscountCurve();

      org.drip.math.calculus.WengertJacobian wjDFDF = dc.getDFJacobian(_dblMaturity);

      if (null == wjDFDF) return null;

      org.drip.math.calculus.WengertJacobian wjPVDFMicroJack =
          new org.drip.math.calculus.WengertJacobian(1, wjDFDF.numParameters());

      for (int k = 0; k < wjDFDF.numParameters(); ++k) {
        if (!wjPVDFMicroJack.accumulatePartialFirstDerivative(
            0, k, wjDFDF.getFirstDerivative(0, k))) return null;
      }

      return adjustPVDFMicroJackForCashSettle(valParams._dblCashPay, dblPV, dc, wjPVDFMicroJack)
          ? wjPVDFMicroJack
          : null;
    } catch (java.lang.Exception e) {
      e.printStackTrace();
    }

    return null;
  }