コード例 #1
0
  public void regression_withZSpread_periodic() {
    double price =
        FUTURE_PRICER.priceWithZSpread(
            FUTURE_PRODUCT, PROVIDER, Z_SPREAD, PERIODIC, PERIOD_PER_YEAR);
    assertEquals(price, 1.1720190529653407, TOL);
    PointSensitivities point =
        FUTURE_PRICER.priceSensitivityWithZSpread(
            FUTURE_PRODUCT, PROVIDER, Z_SPREAD, PERIODIC, PERIOD_PER_YEAR);
    CurrencyParameterSensitivities test = PROVIDER.parameterSensitivity(point);

    DoubleArray expectedIssuer =
        DoubleArray.of(
            -3.9201229100932256E-4,
            -0.0041367134351306374,
            -0.014173323438217467,
            -0.9886444827927878,
            -4.07533109609094,
            0);
    DoubleArray actualIssuer =
        test.getSensitivity(METADATA_ISSUER.getCurveName(), USD).getSensitivity();
    assertTrue(actualIssuer.equalWithTolerance(expectedIssuer, TOL));

    DoubleArray expectedRepo =
        DoubleArray.of(0.1428352116441475, 0.20242871054203687, 0.0, 0.0, 0.0, 0.0);
    DoubleArray actualRepo =
        test.getSensitivity(METADATA_REPO.getCurveName(), USD).getSensitivity();
    assertTrue(actualRepo.equalWithTolerance(expectedRepo, TOL));
  }
コード例 #2
0
  // -------------------------------------------------------------------------
  // regression to 2.x
  public void regression() {
    double price = FUTURE_PRICER.price(FUTURE_PRODUCT, PROVIDER);
    assertEquals(price, 1.2106928633440506, TOL);
    PointSensitivities point = FUTURE_PRICER.priceSensitivity(FUTURE_PRODUCT, PROVIDER);
    CurrencyParameterSensitivities test = PROVIDER.parameterSensitivity(point);

    DoubleArray expectedIssuer =
        DoubleArray.of(
            -3.940585873921608E-4,
            -0.004161527192990392,
            -0.014331606019672717,
            -1.0229665443857998,
            -4.220553063715371,
            0);
    DoubleArray actualIssuer =
        test.getSensitivity(METADATA_ISSUER.getCurveName(), USD).getSensitivity();
    assertTrue(actualIssuer.equalWithTolerance(expectedIssuer, TOL));

    DoubleArray expectedRepo =
        DoubleArray.of(0.14752541809405412, 0.20907575809356016, 0.0, 0.0, 0.0, 0.0);
    DoubleArray actualRepo =
        test.getSensitivity(METADATA_REPO.getCurveName(), USD).getSensitivity();
    assertTrue(actualRepo.equalWithTolerance(expectedRepo, TOL));
  }