//-------------------------------------------------------------------------
        /// <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());
        }
Пример #2
0
 public FunctionRequirements requirements(UnresolvableTarget target, ISet <Measure> measures, CalculationParameters parameters, ReferenceData refData)
 {
     return(FunctionRequirements.empty());
 }
Пример #3
0
 public FunctionRequirements requirements(TestTarget target, ISet <Measure> measures, CalculationParameters parameters, ReferenceData refData)
 {
     return(FunctionRequirements.builder().outputCurrencies(GBP, EUR, USD).observableSource(OBS_SOURCE).build());
 }
Пример #4
0
 public FunctionRequirements requirements(TestTarget target, ISet <Measure> measures, CalculationParameters parameters, ReferenceData refData)
 {
     return(FunctionRequirements.builder().valueRequirements(ImmutableSet.of(TestId.of("1"), TestObservableId.of("2"))).timeSeriesRequirements(TestObservableId.of("3")).observableSource(OBS_SOURCE).build());
 }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Combines these requirements with another set.
 /// <para>
 /// The result contains the union of the two sets of requirements.
 ///
 /// </para>
 /// </summary>
 /// <param name="other">  the other requirements </param>
 /// <returns> the combined requirements </returns>
 public FunctionRequirements combinedWith(FunctionRequirements other)
 {
     return(builder().valueRequirements(Sets.union(valueRequirements, other.valueRequirements)).timeSeriesRequirements(Sets.union(timeSeriesRequirements, other.timeSeriesRequirements)).outputCurrencies(Sets.union(outputCurrencies, other.outputCurrencies)).observableSource(!this.observableSource.Equals(ObservableSource.NONE) ? this.observableSource : other.observableSource).build());
 }
Пример #6
0
 public virtual FunctionRequirements requirements(T target, CalculationParameters parameters, ReferenceData refData)
 {
     return(FunctionRequirements.empty());
 }