class SecurityTradeCalculationFunction implements CalculationFunction<SecurityTrade> {

  @Override
  public Map<Measure, Result<?>> calculate(
      SecurityTrade trade,
      Set<Measure> measures,
      CalculationParameters parameters,
      ScenarioMarketData scenarioMarketData,
      ReferenceData refData) {

    // resolve security
    Security security = refData.getValue(trade.getSecurityId());

    // loop around measures, calculating all scenarios for one measure
    Map<Measure, Result<?>> results = new HashMap<>();
    for (Measure measure : measures) {
      results.put(measure, calculate(measure, trade, security, scenarioMarketData));
    }
    return results;
  }

  public  SecurityTradeCalculationFunction();

}