private static PACalculationParametersRoot GetPaCalculationParameters() { var componentsApi = new ComponentsApi(GetApiConfiguration()); var componentsResponse = componentsApi.GetPAComponents(PADocument); var paComponentId = componentsResponse.Data.FirstOrDefault(component => (component.Value.Name == ComponentName && component.Value.Category == ComponentCategory)).Key; Console.WriteLine($"PA Component Id : {paComponentId}"); var paAccountIdentifier = new PAIdentifier(Portfolio); var paAccounts = new List <PAIdentifier> { paAccountIdentifier }; var paBenchmarkIdentifier = new PAIdentifier(Benchmark); var paBenchmarks = new List <PAIdentifier> { paBenchmarkIdentifier }; var paCalculation = new PACalculationParameters(paComponentId, paAccounts, paBenchmarks); var calculationParameters = new PACalculationParametersRoot { Data = new Dictionary <string, PACalculationParameters> { { "1", paCalculation } } }; return(calculationParameters); }
public void Init() { _calculationsApi = new CalculationsApi(CommonFunctions.BuildConfiguration()); _utilityApi = new UtilityApi(CommonFunctions.BuildConfiguration()); _componentsApi = new ComponentsApi(CommonFunctions.BuildConfiguration()); _configurationsApi = new ConfigurationsApi(CommonFunctions.BuildConfiguration()); }
public void ComponentsApi_Get_SparComponents_Success() { _componentsApi = new ComponentsApi(CommonFunctions.BuildConfiguration(Engine.SPAR)); var componentGetAllResponse = _componentsApi.GetSPARComponentsWithHttpInfo(CommonParameters.SPARDefaultDocument); Assert.IsTrue(componentGetAllResponse.StatusCode == HttpStatusCode.OK, "Response should be 200 - OK"); Assert.IsTrue(componentGetAllResponse.Data.GetType() == typeof(Dictionary <string, ComponentSummary>), "Response result should be of ComponentSummary Dictionary type."); Assert.IsTrue(componentGetAllResponse.Data.Count != 0, "Response data should not be null."); }
public static void Main(string[] args) { try { // Build Vault Engine calculation parameters var componentsApi = new ComponentsApi(GetEngineApiConfiguration()); var componentsResponse = componentsApi.GetVaultComponentsWithHttpInfo(VaultDefaultDocument); var vaultComponentId = componentsResponse.Data.FirstOrDefault(component => (component.Value.Name == VaultComponentName && component.Value.Category == VaultComponentCategory)) .Key; Console.WriteLine($"Vault Component Id : {vaultComponentId}"); var vaultAccount = new VaultIdentifier(VaultDefaultAccount); var vaultDates = new VaultDateParameters(VaultStartDate, VaultEndDate, VaultFrequency); var configurationApi = new ConfigurationsApi(GetEngineApiConfiguration()); var configurationResponse = configurationApi.GetVaultConfigurationsWithHttpInfo(vaultAccount.Id); var vaultConfiguration = configurationResponse.Data.First().Key; var vaultCalculation = new VaultCalculationParameters(vaultComponentId, vaultAccount, vaultDates, vaultConfiguration); var calculationApi = new VaultCalculationsApi(GetEngineApiConfiguration()); var runCalculationResponse = calculationApi.RunVaultCalculationWithHttpInfo(vaultCalculation); var calculationId = string.Empty; while (runCalculationResponse.StatusCode == HttpStatusCode.Accepted) { if (string.IsNullOrWhiteSpace(calculationId)) { runCalculationResponse.Headers.TryGetValue("Location", out var location); calculationId = location?[0].Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries).Last(); } if (runCalculationResponse.Headers.ContainsKey("Cache-Control") && runCalculationResponse.Headers["Cache-Control"][0] is var maxAge && !string.IsNullOrWhiteSpace(maxAge)) { var age = int.Parse(maxAge.Replace("max-age=", "")); Console.WriteLine($"Sleeping for {age} seconds"); Thread.Sleep(age * 1000); } else { Console.WriteLine("Sleeping for 2 seconds"); // Sleep for at least 2 seconds. Thread.Sleep(2000); } runCalculationResponse = calculationApi.GetVaultCalculationByIdWithHttpInfo(calculationId); }
public static void Main(string[] args) { try { var componentsApi = new ComponentsApi(GetEngineApiConfiguration()); var componentsResponse = componentsApi.GetPAComponentsWithHttpInfo(PADefaultDocument); var paComponentId = componentsResponse.Data.FirstOrDefault(component => (component.Value.Name == PAComponentName && component.Value.Category == PAComponentCategory)).Key; Console.WriteLine($"PA Component Id : {paComponentId}"); var paAccountIdentifier = new PAIdentifier(PABenchmarkSP50); var paAccounts = new List <PAIdentifier> { paAccountIdentifier }; var paBenchmarkIdentifier = new PAIdentifier(PABenchmarkR1000); var paBenchmarks = new List <PAIdentifier> { paBenchmarkIdentifier }; var paCalculation = new PACalculationParameters(paComponentId, paAccounts, paBenchmarks); var calculationApi = new PACalculationsApi(GetEngineApiConfiguration()); var runCalculationResponse = calculationApi.RunPACalculationWithHttpInfo(paCalculation); var calculationId = string.Empty; while (runCalculationResponse.StatusCode == HttpStatusCode.Accepted) { if (string.IsNullOrWhiteSpace(calculationId)) { runCalculationResponse.Headers.TryGetValue("Location", out var location); calculationId = location?[0].Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries).Last(); } if (runCalculationResponse.Headers.ContainsKey("Cache-Control") && runCalculationResponse.Headers["Cache-Control"][0] is var maxAge && !string.IsNullOrWhiteSpace(maxAge)) { var age = int.Parse(maxAge.Replace("max-age=", "")); Console.WriteLine($"Sleeping for {age} seconds"); Thread.Sleep(age * 1000); } else { Console.WriteLine("Sleeping for 2 seconds"); // Sleep for at least 2 seconds. Thread.Sleep(2000); } runCalculationResponse = calculationApi.GetPACalculationByIdWithHttpInfo(calculationId); }
public void ComponentsApi_Get_VaultComponentById_Success() { _componentsApi = new ComponentsApi(CommonFunctions.BuildConfiguration(Engine.VAULT)); var vaultComponents = _componentsApi.GetVaultComponentsWithHttpInfo(CommonParameters.VaultDefaultDocument); var vaultComponentId = vaultComponents.Data.Keys.First(); var componentGetByIdResponse = _componentsApi.GetVaultComponentByIdWithHttpInfo(vaultComponentId); Assert.IsTrue(componentGetByIdResponse.StatusCode == HttpStatusCode.OK, "Response should be 200 - OK"); Assert.IsTrue(componentGetByIdResponse.Data != null, "Response data should not be null"); Assert.IsTrue(componentGetByIdResponse.Data.GetType() == typeof(VaultComponent), "Response result should be of VaultComponent type"); }
public void DatesApi_VaultDatesToAbsoluteFormat_Success() { componentsApi = new ComponentsApi(CommonFunctions.BuildConfiguration()); var endDate = "-1M"; var account = CommonParameters.VaultDefaultAccount; var vaultComponents = componentsApi.GetVaultComponentsWithHttpInfo(CommonParameters.VaultDefaultDocument); var vaultComponentId = vaultComponents.Data.Data.Keys.First(); var datesResponse = datesApi.ConvertVaultDatesToAbsoluteFormatWithHttpInfo(endDate, vaultComponentId, account); Assert.IsTrue(datesResponse.StatusCode == HttpStatusCode.OK, "Response should be 200 - OK"); Assert.IsTrue(datesResponse.Data.Data.GetType() == typeof(DateParametersSummary), "Response Should be of DateParametersSummary type."); Assert.IsTrue(datesResponse.Data.Data != null, "Response data should not be null"); }
private static SPARCalculationParameters GetSparCalculationParameters() { // Build SPAR Engine calculation parameters var componentsApi = new ComponentsApi(GetEngineApiConfiguration()); var componentsResponse = componentsApi.GetSPARComponentsWithHttpInfo(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(SPARBenchmarkR1000, SPARBenchmarkRussellReturnType, SPARBenchmarkRussellPrefix); var sparAccounts = new List <SPARIdentifier> { sparAccountIdentifier }; var sparBenchmarkIdentifier = new SPARIdentifier(SPARBenchmarkRussellPr2000, SPARBenchmarkRussellReturnType, SPARBenchmarkRussellPrefix); var sparCalculation = new SPARCalculationParameters(sparComponentId, sparAccounts, sparBenchmarkIdentifier); return(sparCalculation); }
private static SPARCalculationParameters GetSparCalculationParameters1() { 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(SPARBenchmark, SPARBenchmarkReturnType, SPARBenchmarkPrefix); var sparCalculation = new SPARCalculationParameters(sparComponentId, sparAccounts, sparBenchmarkIdentifier); return(sparCalculation); }
private static VaultCalculationParameters GetVaultCalculationParameters2() { var componentsApi = new ComponentsApi(GetApiConfiguration()); var componentsResponse = componentsApi.GetVaultComponents(VaultDefaultDocument); var vaultComponentId = componentsResponse.Data.FirstOrDefault(component => (component.Value.Name == VaultPerformanceOverTimeComponentName && component.Value.Category == VaultComponentCategory)).Key; Console.WriteLine($"Vault Component Id : {vaultComponentId}"); var vaultAccount = new VaultIdentifier(VaultDefaultAccount); var vaultDates = new VaultDateParameters(VaultStartDate, VaultEndDate, VaultFrequency); var configurationApi = new ConfigurationsApi(GetApiConfiguration()); var configurationResponse = configurationApi.GetVaultConfigurationsWithHttpInfo(vaultAccount.Id); var vaultConfigurationId = configurationResponse.Data.Data.Keys.First(); var vaultCalculation = new VaultCalculationParameters(vaultComponentId, vaultAccount, vaultDates, vaultConfigurationId); return(vaultCalculation); }
private static PACalculationParameters GetPaCalculationParameters() { // Build PA Engine calculation parameters var componentsApi = new ComponentsApi(GetEngineApiConfiguration()); var componentsResponse = componentsApi.GetPAComponentsWithHttpInfo(PADefaultDocument); var paComponentId = componentsResponse.Data.FirstOrDefault(component => (component.Value.Name == PAComponentName && component.Value.Category == PAComponentCategory)).Key; Console.WriteLine($"PA Component Id : {paComponentId}"); var paAccountIdentifier = new PAIdentifier(PABenchmarkSP50); var paAccounts = new List <PAIdentifier> { paAccountIdentifier }; var paBenchmarkIdentifier = new PAIdentifier(PABenchmarkR1000); var paBenchmarks = new List <PAIdentifier> { paBenchmarkIdentifier }; var paCalculation = new PACalculationParameters(paComponentId, paAccounts, paBenchmarks); return(paCalculation); }
public void Init() { _calculationsApi = new VaultCalculationsApi(CommonFunctions.BuildConfiguration(Engine.VAULT)); _componentsApi = new ComponentsApi(CommonFunctions.BuildConfiguration(Engine.VAULT)); _configurationsApi = new ConfigurationsApi(CommonFunctions.BuildConfiguration(Engine.VAULT)); }
public void Init() { instance = new ComponentsApi(); }
public void Init() { componentsApi = new ComponentsApi(CommonFunctions.BuildConfiguration()); ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; }
public void Init() { sparCalculationsApi = new SPARCalculationsApi(CommonFunctions.BuildConfiguration()); componentsApi = new ComponentsApi(CommonFunctions.BuildConfiguration()); }
public void Init() { _calculationsApi = new PACalculationsApi(CommonFunctions.BuildConfiguration(Engine.PA)); _componentsApi = new ComponentsApi(CommonFunctions.BuildConfiguration(Engine.PA)); }
public void Init() { vaultCalculationsApi = new VaultCalculationsApi(CommonFunctions.BuildConfiguration()); componentsApi = new ComponentsApi(CommonFunctions.BuildConfiguration()); configurationsApi = new ConfigurationsApi(CommonFunctions.BuildConfiguration()); }