public virtual MarketDataBox <FxOptionVolatilities> build(FxOptionVolatilitiesId id, MarketDataConfig marketDataConfig, ScenarioMarketData marketData, ReferenceData refData) { FxOptionVolatilitiesDefinition volatilitiesDefinition = marketDataConfig.get(typeof(FxOptionVolatilitiesDefinition), id.Name.Name); ValuationZoneTimeDefinition zoneTimeDefinition = marketDataConfig.get(typeof(ValuationZoneTimeDefinition)); int nScenarios = marketData.ScenarioCount; MarketDataBox <LocalDate> valuationDates = marketData.ValuationDate; MarketDataBox <ZonedDateTime> valuationDateTimes = zoneTimeDefinition.toZonedDateTime(valuationDates); int nParameters = volatilitiesDefinition.ParameterCount; //JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter: ImmutableList <MarketDataBox <double> > inputs = volatilitiesDefinition.volatilitiesInputs().Select(q => marketData.getValue(q)).collect(toImmutableList()); ImmutableList <FxOptionVolatilities> vols = IntStream.range(0, nScenarios).mapToObj(scenarioIndex => volatilitiesDefinition.volatilities(valuationDateTimes.getValue(scenarioIndex), DoubleArray.of(nParameters, paramIndex => inputs.get(paramIndex).getValue(scenarioIndex)), refData)).collect(toImmutableList()); return(nScenarios > 1 ? MarketDataBox.ofScenarioValues(vols) : MarketDataBox.ofSingleValue(vols.get(0))); }
public virtual MarketDataBox <FxRate> build(FxRateId id, MarketDataConfig marketDataConfig, ScenarioMarketData marketData, ReferenceData refData) { FxRateConfig fxRateConfig = marketDataConfig.get(typeof(FxRateConfig), id.ObservableSource); Optional <QuoteId> optional = fxRateConfig.getObservableRateKey(id.Pair); return(optional.map(key => buildFxRate(id, key, marketData)).orElseThrow(() => new System.ArgumentException("No FX rate configuration available for " + id.Pair))); }
public virtual MarketDataRequirements requirements(FxRateId id, MarketDataConfig marketDataConfig) { FxRateConfig fxRateConfig = marketDataConfig.get(typeof(FxRateConfig), id.ObservableSource); Optional <QuoteId> optional = fxRateConfig.getObservableRateKey(id.Pair); return(optional.map(key => MarketDataRequirements.of(key)).orElse(MarketDataRequirements.empty())); }
public virtual MarketDataRequirements requirements(CurveId id, MarketDataConfig config) { CurveGroupDefinition groupDefn = config.get(typeof(CurveGroupDefinition), id.CurveGroupName); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: com.opengamma.strata.data.MarketDataId<? extends com.opengamma.strata.market.curve.CurveGroup> groupId = groupDefn.createGroupId(id.getObservableSource()); MarketDataId <CurveGroup> groupId = groupDefn.createGroupId(id.ObservableSource); return(MarketDataRequirements.of(groupId)); }
public virtual MarketDataBox <RatesCurveGroup> build(RatesCurveGroupId id, MarketDataConfig marketDataConfig, ScenarioMarketData marketData, ReferenceData refData) { // create the calibrator, using the configured RootFinderConfig if found RootFinderConfig rfc = marketDataConfig.find(typeof(RootFinderConfig)).orElse(RootFinderConfig.standard()); RatesCurveCalibrator calibrator = RatesCurveCalibrator.of(rfc.AbsoluteTolerance, rfc.RelativeTolerance, rfc.MaximumSteps, calibrationMeasures); // calibrate CurveGroupName groupName = id.CurveGroupName; RatesCurveGroupDefinition configuredDefn = marketDataConfig.get(typeof(RatesCurveGroupDefinition), groupName); return(buildCurveGroup(configuredDefn, calibrator, marketData, refData, id.ObservableSource)); }
//------------------------------------------------------------------------- public virtual MarketDataRequirements requirements(RatesCurveGroupId id, MarketDataConfig marketDataConfig) { RatesCurveGroupDefinition groupDefn = marketDataConfig.get(typeof(RatesCurveGroupDefinition), id.CurveGroupName); // request input data for any curves that need market data // no input data is requested if the curve definition contains all the market data needed to build the curve //JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter: IList <RatesCurveInputsId> curveInputsIds = groupDefn.CurveDefinitions.Where(defn => requiresMarketData(defn)).Select(defn => defn.Name).Select(curveName => RatesCurveInputsId.of(groupDefn.Name, curveName, id.ObservableSource)).collect(toImmutableList()); IList <ObservableId> timeSeriesIds = groupDefn.Entries.stream().flatMap(entry => entry.Indices.stream()).distinct().map(index => IndexQuoteId.of(index)).collect(toImmutableList()); return(MarketDataRequirements.builder().addValues(curveInputsIds).addTimeSeries(timeSeriesIds).build()); }
public MarketDataRequirements requirements(RatesCurveInputsId id, MarketDataConfig marketDataConfig) { RatesCurveGroupDefinition groupConfig = marketDataConfig.get(typeof(RatesCurveGroupDefinition), id.CurveGroupName); Optional <CurveDefinition> optionalDefinition = groupConfig.findCurveDefinition(id.CurveName); if (!optionalDefinition.Present) { return(MarketDataRequirements.empty()); } CurveDefinition definition = optionalDefinition.get(); return(MarketDataRequirements.builder().addValues(nodeRequirements(ImmutableList.of(definition))).build()); }
public virtual MarketDataBox <Curve> build(CurveId id, MarketDataConfig config, ScenarioMarketData marketData, ReferenceData refData) { // find curve CurveGroupDefinition groupDefn = config.get(typeof(CurveGroupDefinition), id.CurveGroupName); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: com.opengamma.strata.data.MarketDataId<? extends com.opengamma.strata.market.curve.CurveGroup> groupId = groupDefn.createGroupId(id.getObservableSource()); MarketDataId <CurveGroup> groupId = groupDefn.createGroupId(id.ObservableSource); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: com.opengamma.strata.data.scenario.MarketDataBox<? extends com.opengamma.strata.market.curve.CurveGroup> curveGroupBox = marketData.getValue(groupId); MarketDataBox <CurveGroup> curveGroupBox = marketData.getValue(groupId); return(curveGroupBox.map(curveGroup => findCurve(id, curveGroup))); }
public MarketDataBox <RatesCurveInputs> build(RatesCurveInputsId id, MarketDataConfig marketDataConfig, ScenarioMarketData marketData, ReferenceData refData) { CurveGroupName groupName = id.CurveGroupName; CurveName curveName = id.CurveName; RatesCurveGroupDefinition groupDefn = marketDataConfig.get(typeof(RatesCurveGroupDefinition), groupName); Optional <CurveDefinition> optionalDefinition = groupDefn.findCurveDefinition(id.CurveName); if (!optionalDefinition.Present) { throw new System.ArgumentException(Messages.format("No curve named '{}' found in group '{}'", curveName, groupName)); } CurveDefinition configuredDefn = optionalDefinition.get(); // determine market data needs MarketDataBox <LocalDate> valuationDates = marketData.ValuationDate; bool multipleValuationDates = valuationDates.ScenarioValue; // curve definition can vary for each valuation date if (multipleValuationDates) { IList <CurveDefinition> curveDefns = IntStream.range(0, valuationDates.ScenarioCount).mapToObj(valuationDates.getValue).map((LocalDate valDate) => configuredDefn.filtered(valDate, refData)).collect(toImmutableList()); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.Set<com.opengamma.strata.data.MarketDataId<?>> requirements = nodeRequirements(curveDefns); ISet <MarketDataId <object> > requirements = nodeRequirements(curveDefns); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.Map<com.opengamma.strata.data.MarketDataId<?>, com.opengamma.strata.data.scenario.MarketDataBox<?>> marketDataValues = requirements.stream().collect(toImmutableMap(k -> k, k -> marketData.getValue(k))); //JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter: IDictionary <MarketDataId <object>, MarketDataBox <object> > marketDataValues = requirements.collect(toImmutableMap(k => k, k => marketData.getValue(k))); return(buildMultipleCurveInputs(MarketDataBox.ofScenarioValues(curveDefns), marketDataValues, valuationDates, refData)); } // only one valuation date LocalDate valuationDate = valuationDates.getValue(0); CurveDefinition filteredDefn = configuredDefn.filtered(valuationDate, refData); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.Set<com.opengamma.strata.data.MarketDataId<?>> requirements = nodeRequirements(com.google.common.collect.ImmutableList.of(filteredDefn)); ISet <MarketDataId <object> > requirements = nodeRequirements(ImmutableList.of(filteredDefn)); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.Map<com.opengamma.strata.data.MarketDataId<?>, com.opengamma.strata.data.scenario.MarketDataBox<?>> marketDataValues = requirements.stream().collect(toImmutableMap(k -> k, k -> marketData.getValue(k))); //JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter: IDictionary <MarketDataId <object>, MarketDataBox <object> > marketDataValues = requirements.collect(toImmutableMap(k => k, k => marketData.getValue(k))); // Do any of the inputs contain values for multiple scenarios, or do they contain 1 value each? bool multipleInputValues = marketDataValues.Values.Any(MarketDataBox.isScenarioValue); return(multipleInputValues || multipleValuationDates?buildMultipleCurveInputs(MarketDataBox.ofSingleValue(filteredDefn), marketDataValues, valuationDates, refData) : buildSingleCurveInputs(filteredDefn, marketDataValues, valuationDate, refData)); }
public virtual MarketDataRequirements requirements(FxOptionVolatilitiesId id, MarketDataConfig marketDataConfig) { FxOptionVolatilitiesDefinition volatilitiesDefinition = marketDataConfig.get(typeof(FxOptionVolatilitiesDefinition), id.Name.Name); return(MarketDataRequirements.builder().addValues(volatilitiesDefinition.volatilitiesInputs()).build()); }