private void addSecurityBenchmark(DataSeries item, Security security, List<Exception> warnings) {
    PerformanceIndex securityIndex = dataCache.get(security);

    if (securityIndex == null) {
      PerformanceIndex clientIndex = getClientIndex(warnings);
      securityIndex = PerformanceIndex.forSecurity(clientIndex, security, warnings);
      dataCache.put(security, securityIndex);
    }

    addScatterSeries(item, securityIndex);
  }
  @Test
  public void testVolatilityIfBenchmarkHasNoQuotes() throws IOException {
    ReportingPeriod report =
        new ReportingPeriod.FromXtoY(Dates.date("2014-01-31"), Dates.date("2015-01-31"));
    List<Exception> warnings = new ArrayList<>();

    PerformanceIndex index = PerformanceIndex.forClient(client, report, warnings);

    Security sap =
        client.getSecurities().stream().filter(s -> "Sap AG".equals(s.getName())).findAny().get();
    PerformanceIndex sapIndex = PerformanceIndex.forSecurity(index, sap, warnings);

    assertThat(warnings, empty());
    // quotes only until December 31st
    assertThat(sapIndex.getDates()[sapIndex.getDates().length - 1], is(Dates.date("2014-12-31")));
    assertThat(
        sapIndex.getVolatility().getStandardDeviation(),
        closeTo(0.0126152529671108, 0.00001)); // excel
  }