@Override
 protected Set<String> getDefaultValue(
     final FunctionCompilationContext context,
     final ComputationTarget target,
     final ValueRequirement desiredValue,
     final String propertyName) {
   if (FXOptionBlackFunction.CALL_CURVE.equals(propertyName)) {
     return Collections.singleton(_callCurveName);
   }
   if (FXOptionBlackFunction.PUT_CURVE.equals(propertyName)) {
     return Collections.singleton(_putCurveName);
   }
   if (FXOptionBlackFunction.CALL_CURVE_CALC_CONFIG.equals(propertyName)) {
     return Collections.singleton(_callCurveConfig);
   }
   if (FXOptionBlackFunction.PUT_CURVE_CALC_CONFIG.equals(propertyName)) {
     return Collections.singleton(_putCurveConfig);
   }
   if (ValuePropertyNames.SURFACE.equals(propertyName)) {
     return Collections.singleton(_surfaceName);
   }
   if (InterpolatedDataProperties.X_INTERPOLATOR_NAME.equals(propertyName)) {
     return Collections.singleton(_interpolatorName);
   }
   if (InterpolatedDataProperties.LEFT_X_EXTRAPOLATOR_NAME.equals(propertyName)) {
     return Collections.singleton(_leftExtrapolatorName);
   }
   if (InterpolatedDataProperties.RIGHT_X_EXTRAPOLATOR_NAME.equals(propertyName)) {
     return Collections.singleton(_rightExtrapolatorName);
   }
   if (FXDigitalCallSpreadBlackFunction.PROPERTY_CALL_SPREAD_VALUE.equals(propertyName)) {
     return Collections.singleton(_callSpread);
   }
   if (ValuePropertyNames.SAMPLING_PERIOD.equals(propertyName)) {
     return Collections.singleton(_samplingPeriod);
   }
   if (ValuePropertyNames.SCHEDULE_CALCULATOR.equals(propertyName)) {
     return Collections.singleton(_scheduleCalculator);
   }
   if (ValuePropertyNames.SAMPLING_FUNCTION.equals(propertyName)) {
     return Collections.singleton(_samplingFunction);
   }
   return null;
 }
Exemplo n.º 2
0
 @Override
 protected Set<String> getDefaultValue(
     final FunctionCompilationContext context,
     final ComputationTarget target,
     final ValueRequirement desiredValue,
     final String propertyName) {
   final FinancialSecurity security = (FinancialSecurity) target.getSecurity();
   final String putCurrency = security.accept(ForexVisitors.getPutCurrencyVisitor()).getCode();
   final String callCurrency = security.accept(ForexVisitors.getCallCurrencyVisitor()).getCode();
   if (!(_propertyValuesByFirstCurrency.containsKey(putCurrency)
       || _propertyValuesBySecondCurrency.containsKey(putCurrency))) {
     s_logger.error(
         "Could not get config for put currency " + putCurrency + "; should never happen");
     return null;
   }
   if (!(_propertyValuesByFirstCurrency.containsKey(callCurrency)
       || _propertyValuesBySecondCurrency.containsKey(callCurrency))) {
     s_logger.error(
         "Could not get config for call currency " + callCurrency + "; should never happen");
     return null;
   }
   final String putCurveConfig, callCurveConfig, putCurve, callCurve;
   if (_propertyValuesByFirstCurrency.containsKey(putCurrency)) {
     final Pair<String, String> firstCurrencyValues =
         _propertyValuesByFirstCurrency.get(putCurrency);
     putCurveConfig = firstCurrencyValues.getFirst();
     putCurve = firstCurrencyValues.getSecond();
     final Pair<String, String> secondCurrencyValues =
         _propertyValuesBySecondCurrency.get(callCurrency);
     callCurveConfig = secondCurrencyValues.getFirst();
     callCurve = secondCurrencyValues.getSecond();
   } else {
     final Pair<String, String> firstCurrencyValues =
         _propertyValuesByFirstCurrency.get(callCurrency);
     callCurveConfig = firstCurrencyValues.getFirst();
     callCurve = firstCurrencyValues.getSecond();
     final Pair<String, String> secondCurrencyValues =
         _propertyValuesBySecondCurrency.get(putCurrency);
     putCurveConfig = secondCurrencyValues.getFirst();
     putCurve = secondCurrencyValues.getSecond();
   }
   if (FXOptionBlackFunction.PUT_CURVE_CALC_CONFIG.equals(propertyName)) {
     return Collections.singleton(putCurveConfig);
   }
   if (FXOptionBlackFunction.PUT_CURVE.equals(propertyName)) {
     return Collections.singleton(putCurve);
   }
   if (FXOptionBlackFunction.CALL_CURVE_CALC_CONFIG.equals(propertyName)) {
     return Collections.singleton(callCurveConfig);
   }
   if (FXOptionBlackFunction.CALL_CURVE.equals(propertyName)) {
     return Collections.singleton(callCurve);
   }
   if (InterpolatedDataProperties.X_INTERPOLATOR_NAME.equals(propertyName)) {
     return Collections.singleton(_interpolatorName);
   }
   if (InterpolatedDataProperties.LEFT_X_EXTRAPOLATOR_NAME.equals(propertyName)) {
     return Collections.singleton(_leftExtrapolatorName);
   }
   if (InterpolatedDataProperties.RIGHT_X_EXTRAPOLATOR_NAME.equals(propertyName)) {
     return Collections.singleton(_rightExtrapolatorName);
   }
   if (ValuePropertyNames.SURFACE.equals(propertyName)) {
     Pair<String, String> pair = Pair.of(putCurrency, callCurrency);
     if (_surfaceNameByCurrencyPair.containsKey(pair)) {
       return Collections.singleton(_surfaceNameByCurrencyPair.get(pair));
     }
     pair = Pair.of(callCurrency, putCurrency);
     if (_surfaceNameByCurrencyPair.containsKey(pair)) {
       return Collections.singleton(_surfaceNameByCurrencyPair.get(pair));
     }
   }
   return null;
 }