//------------------------------------------------------------------------- /// <summary> /// Gets the market data that is required to perform the calculations. /// <para> /// This can be used to pass into the market data system to obtain and calibrate data. /// /// </para> /// </summary> /// <param name="refData"> the reference data </param> /// <returns> the market data required for all calculations </returns> /// <exception cref="RuntimeException"> if unable to obtain the requirements </exception> public MarketDataRequirements requirements(ReferenceData refData) { // use for loop not streams for shorter stack traces MarketDataRequirementsBuilder builder = MarketDataRequirements.builder(); foreach (CalculationTask task in tasks) { builder.addRequirements(task.requirements(refData)); } return(builder.build()); }
//------------------------------------------------------------------------- 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()); }
//------------------------------------------------------------------------- /// <summary> /// Returns requirements specifying the market data the function needs to perform its calculations. /// </summary> /// <param name="refData"> the reference data </param> /// <returns> requirements specifying the market data the function needs to perform its calculations </returns> //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") public com.opengamma.strata.calc.marketdata.MarketDataRequirements requirements(com.opengamma.strata.basics.ReferenceData refData) public MarketDataRequirements requirements(ReferenceData refData) { // determine market data requirements of the function FunctionRequirements functionRequirements = function.requirements(target, Measures, parameters, refData); ObservableSource obsSource = functionRequirements.ObservableSource; // convert function requirements to market data requirements MarketDataRequirementsBuilder requirementsBuilder = MarketDataRequirements.builder(); foreach (ObservableId id in functionRequirements.TimeSeriesRequirements) { requirementsBuilder.addTimeSeries(id.withObservableSource(obsSource)); } //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: for (com.opengamma.strata.data.MarketDataId<?> id : functionRequirements.getValueRequirements()) foreach (MarketDataId <object> id in functionRequirements.ValueRequirements) { if (id is ObservableId) { requirementsBuilder.addValues(((ObservableId)id).withObservableSource(obsSource)); } else { requirementsBuilder.addValues(id); } } // add requirements for the FX rates needed to convert the output values into the reporting currency foreach (CalculationTaskCell cell in cells) { if (cell.Measure.CurrencyConvertible && !cell.ReportingCurrency.None) { Currency reportingCurrency = cell.reportingCurrency(this, refData); //JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter: IList <MarketDataId <FxRate> > fxRateIds = functionRequirements.OutputCurrencies.Where(outputCurrency => !outputCurrency.Equals(reportingCurrency)).Select(outputCurrency => CurrencyPair.of(outputCurrency, reportingCurrency)).Select(pair => FxRateId.of(pair, obsSource)).collect(toImmutableList()); requirementsBuilder.addValues(fxRateIds); } } return(requirementsBuilder.build()); }
public virtual MarketDataRequirements requirements(FxOptionVolatilitiesId id, MarketDataConfig marketDataConfig) { FxOptionVolatilitiesDefinition volatilitiesDefinition = marketDataConfig.get(typeof(FxOptionVolatilitiesDefinition), id.Name.Name); return(MarketDataRequirements.builder().addValues(volatilitiesDefinition.volatilitiesInputs()).build()); }