JensenAlphaCalculator { public double evaluate(final DoubleTimeSeries<?> assetReturnTS, final DoubleTimeSeries<?> riskFreeReturnTS, final double beta, final DoubleTimeSeries<?> marketReturnTS) { Validate.notNull(assetReturnTS, "asset return time series"); Validate.notNull(riskFreeReturnTS, "risk-free return time series"); Validate.notNull(marketReturnTS, "market return time series"); final double assetReturn = _expectedAssetReturnCalculator.evaluate(assetReturnTS); final double riskFreeReturn = _expectedRiskFreeReturnCalculator.evaluate(riskFreeReturnTS); final double marketReturn = _expectedMarketReturnCalculator.evaluate(marketReturnTS); return assetReturn - riskFreeReturn * (1 - beta) - beta * marketReturn; } JensenAlphaCalculator(final DoubleTimeSeriesStatisticsCalculator expectedAssetReturnCalculator,
      final DoubleTimeSeriesStatisticsCalculator expectedRiskFreeReturnCalculator, final DoubleTimeSeriesStatisticsCalculator expectedMarketReturnCalculator); double evaluate(final DoubleTimeSeries<?> assetReturnTS, final DoubleTimeSeries<?> riskFreeReturnTS, final double beta, final DoubleTimeSeries<?> marketReturnTS);  }
@Test public void test() { assertEquals(CALCULATOR.evaluate(ASSET_RETURN, RISK_FREE, BETA, MARKET_RETURN), 0.034, 1e-3); }