Example #1
0
        private ApiResponse <object> RunCalculation()
        {
            var sparComponents  = componentsApi.GetSPARComponentsWithHttpInfo(CommonParameters.SPARDefaultDocument);
            var sparComponentId = sparComponents.Data.Data.Keys.First();

            var sparAccountIdentifier = new SPARIdentifier(CommonParameters.SPARBenchmarkR1000);
            var sparAccount           = new List <SPARIdentifier> {
                sparAccountIdentifier
            };
            var sparBenchmark = new SPARIdentifier(CommonParameters.SPARBenchmarkRussellPR1000);
            var sparDates     = new SPARDateParameters("20180101", "20181231", "Monthly");

            var sparCalculationParameters = new SPARCalculationParameters(sparComponentId, sparAccount, sparBenchmark, sparDates);

            var parameters = new SPARCalculationParametersRoot
            {
                Data = new Dictionary <string, SPARCalculationParameters> {
                    { "1", sparCalculationParameters }, { "2", sparCalculationParameters }
                }
            };

            var response = sparCalculationsApi.PostAndCalculateWithHttpInfo(null, "max-stale=0", parameters);

            return(response);
        }
        private static SPARCalculationParameters GetSparCalculationParameters()
        {
            var componentsApi = new ComponentsApi(GetApiConfiguration());

            var componentsResponse = componentsApi.GetSPARComponents(SPARDefaultDocument);

            var sparComponentId = componentsResponse.Data.FirstOrDefault(component => (component.Value.Name == SPARComponentName && component.Value.Category == SPARComponentCategory)).Key;

            Console.WriteLine($"SPAR Component Id : {sparComponentId}");

            var sparAccountIdentifier = new SPARIdentifier(SPARBenchmark1, SPARBenchmarkReturnType, SPARBenchmarkPrefix);
            var sparAccounts          = new List <SPARIdentifier> {
                sparAccountIdentifier
            };
            var sparBenchmarkIdentifier = new SPARIdentifier(SPARBenchmark2, SPARBenchmarkReturnType, SPARBenchmarkPrefix);
            var sparDates = new SPARDateParameters(SPARStartDate, SPAREndDate, SPARFrequency);

            var sparCalculation = new SPARCalculationParameters(sparComponentId, sparAccounts, sparBenchmarkIdentifier, sparDates, SPARCurrency);

            return(sparCalculation);
        }