コード例 #1
0
  @Override
  public void retrieveResult(AnalysisOutput analysisOutput) {
    if (finalTimeSeriesPoint != null && highestTimeSeriesPoint != null) {
      double finalPriceClose = finalTimeSeriesPoint.getClose();
      double highestPrice = highestTimeSeriesPoint.getHigh();

      double totalDrawdown = Math.max(0, highestPrice - finalPriceClose);
      logger.debug("Total drawdown is: " + totalDrawdown);
      logger.debug(
          "Total drawdown period is from "
              + highestTimeSeriesPoint.getDate()
              + " to "
              + finalTimeSeriesPoint.getDate());

      analysisOutput.setTotalDrawdown(totalDrawdown);
    } else {
      throw new UnsupportedOperationException();
    }
  }