@Override
  public org.drip.state.estimator.PredictorResponseWeightConstraint generateCalibPRLC(
      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,
      final org.drip.state.representation.LatentStateMetricMeasure lsmm) {
    org.drip.state.estimator.PredictorResponseWeightConstraint prwc =
        _floatDerived.generateCalibPRLC(valParams, pricerParams, mktParams, quotingParams, lsmm);

    if (null == prwc) return null;

    org.drip.analytics.support.CaseInsensitiveTreeMap<java.lang.Double> mapReferenceValue =
        _floatReference.value(valParams, null, mktParams, quotingParams);

    if (null == mapReferenceValue || !mapReferenceValue.containsKey("CleanPV")) return null;

    return prwc.updateValue(-1. * mapReferenceValue.get("CleanPV")) ? prwc : null;
  }
예제 #2
0
  @Override
  public org.drip.state.estimator.PredictorResponseWeightConstraint generateCalibPRLC(
      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,
      final org.drip.state.representation.LatentStateMetricMeasure lsmm) {
    if (null == valParams
        || valParams.valueDate() >= getMaturityDate().getJulian()
        || null == lsmm
        || !(lsmm instanceof org.drip.analytics.rates.RatesLSMM)
        || !org.drip.analytics.rates.DiscountCurve.LATENT_STATE_DISCOUNT.equalsIgnoreCase(
            lsmm.getID())) return null;

    if (org.drip.analytics.rates.DiscountCurve.QUANTIFICATION_METRIC_FORWARD_RATE.equalsIgnoreCase(
            lsmm.getQuantificationMetric())
        || org.drip.analytics.rates.DiscountCurve.QUANTIFICATION_METRIC_DISCOUNT_FACTOR
            .equalsIgnoreCase(lsmm.getQuantificationMetric())) {
      if (null == mktParams) return null;

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

      if (null == dc) return null;

      org.drip.state.estimator.PredictorResponseWeightConstraint prwc =
          new org.drip.state.estimator.PredictorResponseWeightConstraint();

      double dblDirtyCV100 = 0.;
      boolean bFirstPeriod = true;

      try {
        for (org.drip.analytics.period.CashflowPeriod period : _lsCouponPeriod) {
          if (null == period) continue;

          double dblPayDate = period.getPayDate();

          if (valParams.valueDate() > dblPayDate) continue;

          double dblPeriodDCF = period.getCouponDCF();

          if (bFirstPeriod) {
            bFirstPeriod = false;

            dblPeriodDCF -= period.getAccrualDCF(valParams.valueDate());
          }

          double dblPeriodCV100 = dblPeriodDCF * dc.df(dblPayDate) * getNotional(dblPayDate);

          dblDirtyCV100 += dblPeriodCV100;

          if (!prwc.addPredictorResponseWeight(dblPayDate, dblPeriodCV100 * _dblNotional))
            return null;
        }

        return prwc.updateValue(-1. * dblDirtyCV100 * _dblNotional * lsmm.getMeasureQuoteValue())
            ? prwc
            : null;
      } catch (java.lang.Exception e) {
        e.printStackTrace();

        return null;
      }
    }

    return null;
  }