/** * @param priority The priority, not null * @param defaultArray The default values, not null: currency, */ public EquityForwardCurveYieldCurveImpliedDefaults( final String priority, final String... defaultArray) { super( ComputationTargetType.PRIMITIVE, true); // // [PLAT-2286]: change to correct type; should this be SECURITY? ArgumentChecker.notNull(priority, "priority"); ArgumentChecker.notNull(defaultArray, "per currency config"); final int n = defaultArray.length; ArgumentChecker.isTrue( n == 4, "Must have 4 defaults: currency, curve, curve config, dividend type"); _priority = PriorityClass.valueOf(priority); _currency = defaultArray[0]; _curveName = defaultArray[1]; _curveCalculationConfig = defaultArray[2]; _dividendType = defaultArray[3]; ArgumentChecker.isTrue( _dividendType.equals(ValuePropertyNames.DIVIDEND_TYPE_CONTINUOUS) || _dividendType.equals(ValuePropertyNames.DIVIDEND_TYPE_DISCRETE), "4th String in defaultArray must be either Discrete or Continuous"); }
/** * @param priority The priority of the functions * @param interpolatorName The volatility surface interpolator name * @param leftExtrapolatorName The volatility surface left extrapolator name * @param rightExtrapolatorName The volatility surface right extrapolator name * @param propertyValuesByCurrencies Values for the properties per currency: an array of strings * where the <i>i<sup>th</sup></i> currency has properties: * <ul> * <li><i>i</i> = first currency name, * <li><i>i + 1</i> = first currency curve configuration name * <li><i>i + 2</i> = first currency discounting curve name * <li><i>i + 3</i> = second currency name, * <li><i>i + 4</i> = second currency curve configuration name * <li><i>i + 5</i> = second currency discounting curve name * <li><i>i + 6</i> = surface name * </ul> */ public FXOptionBlackDefaults( final String priority, final String interpolatorName, final String leftExtrapolatorName, final String rightExtrapolatorName, final String... propertyValuesByCurrencies) { super(ComputationTargetType.SECURITY, true); ArgumentChecker.notNull(priority, "priority"); ArgumentChecker.notNull(interpolatorName, "interpolator name"); ArgumentChecker.notNull(leftExtrapolatorName, "left extrapolator name"); ArgumentChecker.notNull(rightExtrapolatorName, "right extrapolator name"); ArgumentChecker.notNull(propertyValuesByCurrencies, "property values by currency"); ArgumentChecker.isTrue( propertyValuesByCurrencies.length % 7 == 0, "Must have two currencies, one curve config and discounting curve name per currency pair and one surface name"); _priority = PriorityClass.valueOf(priority); _interpolatorName = interpolatorName; _leftExtrapolatorName = leftExtrapolatorName; _rightExtrapolatorName = rightExtrapolatorName; _propertyValuesByFirstCurrency = new HashMap<String, Pair<String, String>>(); _propertyValuesBySecondCurrency = new HashMap<String, Pair<String, String>>(); _surfaceNameByCurrencyPair = new HashMap<Pair<String, String>, String>(); for (int i = 0; i < propertyValuesByCurrencies.length; i += 7) { final String firstCurrency = propertyValuesByCurrencies[i]; final Pair<String, String> firstCurrencyValues = Pair.of(propertyValuesByCurrencies[i + 1], propertyValuesByCurrencies[i + 2]); final String secondCurrency = propertyValuesByCurrencies[i + 3]; ArgumentChecker.isFalse( firstCurrency.equals(secondCurrency), "The two currencies must not be equal; have {} and {}", firstCurrency, secondCurrency); final Pair<String, String> secondCurrencyValues = Pair.of(propertyValuesByCurrencies[i + 4], propertyValuesByCurrencies[i + 5]); final String surfaceName = propertyValuesByCurrencies[i + 6]; _propertyValuesByFirstCurrency.put(firstCurrency, firstCurrencyValues); _propertyValuesBySecondCurrency.put(secondCurrency, secondCurrencyValues); _surfaceNameByCurrencyPair.put(Pair.of(firstCurrency, secondCurrency), surfaceName); } }
public StandardVanillaCDSBucketedCS01Defaults( final String priority, final String... perCurrencyDefaults) { super( FinancialSecurityTypes.STANDARD_VANILLA_CDS_SECURITY .or(FinancialSecurityTypes.LEGACY_VANILLA_CDS_SECURITY) .or(FinancialSecurityTypes.CREDIT_DEFAULT_SWAP_OPTION_SECURITY) .or(FinancialSecurityTypes.CREDIT_DEFAULT_SWAP_INDEX_SECURITY), true); ArgumentChecker.notNull(priority, "priority"); ArgumentChecker.notNull(perCurrencyDefaults, "per currency defaults"); ArgumentChecker.isTrue( perCurrencyDefaults.length % 3 == 0, "Must have one spread curve bump, spread bump type and price type per currency"); _priority = PriorityClass.valueOf(priority); _currencyToSpreadCurveBump = new HashMap<>(); _currencyToSpreadBumpType = new HashMap<>(); for (int i = 0; i < perCurrencyDefaults.length; i += 3) { final String currency = perCurrencyDefaults[i]; _currencyToSpreadCurveBump.put(currency, perCurrencyDefaults[i + 1]); _currencyToSpreadBumpType.put(currency, perCurrencyDefaults[i + 2]); } }