TreynorRatioCalculator { public double evaluate(final DoubleTimeSeries<?> assetReturnTS, final DoubleTimeSeries<?> riskFreeReturnTS, final double beta) { TimeSeriesDataTestUtils.testNotNullOrEmpty(assetReturnTS); TimeSeriesDataTestUtils.testNotNullOrEmpty(riskFreeReturnTS); final Double expectedAssetReturn = _expectedAssetReturnCalculator.evaluate(assetReturnTS); final Double expectedRiskFreeReturn = _expectedRiskFreeReturnCalculator.evaluate(riskFreeReturnTS); return (expectedAssetReturn - expectedRiskFreeReturn) / beta; } TreynorRatioCalculator(final DoubleTimeSeriesStatisticsCalculator expectedAssetReturnCalculator,
      final DoubleTimeSeriesStatisticsCalculator expectedRiskFreeReturnCalculator); double evaluate(final DoubleTimeSeries<?> assetReturnTS, final DoubleTimeSeries<?> riskFreeReturnTS, final double beta);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullTS1() { TREYNOR.evaluate(null, RISK_FREE, BETA); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullTS2() { TREYNOR.evaluate(ASSET_RETURN, null, BETA); }
@Test public void test() { assertEquals(TREYNOR.evaluate(ASSET_RETURN, RISK_FREE, BETA), 0.1286, 1e-4); }