Skip to content

Commit 08622ab

Browse files
authored
fix(examples): fixed components api calls in relevant examples (#45)
1 parent 8abd3e5 commit 08622ab

6 files changed

+19
-19
lines changed

examples/pa_engine_multiple_unit_example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ def main():
5050
enddate = "20181231"
5151
frequency = "Monthly"
5252

53-
components = components_api.get_pa_components(pa_document_name)
53+
get_components_response = components_api.get_pa_components(pa_document_name)
5454
component_summary = ComponentSummary(
5555
name=pa_component_name, category=pa_component_category)
5656
component_id = [id for id in list(
57-
components.data.keys()) if components.data[id] == component_summary][0]
57+
get_components_response[0].data.keys()) if get_components_response[0].data[id] == component_summary][0]
5858
print("PA Component Id: " + component_id)
5959
pa_accounts = [PAIdentifier(id=pa_benchmark_sp_50)]
6060
pa_benchmarks = [PAIdentifier(id=pa_benchmark_r_1000)]

examples/pa_engine_single_unit_example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ def main():
5050
enddate = "20181231"
5151
frequency = "Monthly"
5252

53-
components = components_api.get_pa_components(pa_document_name)
53+
get_components_response = components_api.get_pa_components(pa_document_name)
5454
component_summary = ComponentSummary(
5555
name=pa_component_name, category=pa_component_category)
5656
component_id = [id for id in list(
57-
components.data.keys()) if components.data[id] == component_summary][0]
57+
get_components_response[0].data.keys()) if get_components_response[0].data[id] == component_summary][0]
5858
print("PA Component Id: " + component_id)
5959
pa_accounts = [PAIdentifier(id=pa_benchmark_sp_50)]
6060
pa_benchmarks = [PAIdentifier(id=pa_benchmark_r_1000)]

examples/spar_engine_multiple_unit_example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ def main():
5656
enddate2 = "20191231"
5757
frequency2 = "Monthly"
5858

59-
components = components_api.get_spar_components(spar_document_name)
59+
get_components_response = components_api.get_spar_components(spar_document_name)
6060
component_summary = ComponentSummary(
6161
name=spar_component_name, category=spar_component_category)
6262
component_id = [id for id in list(
63-
components.data.keys()) if components.data[id] == component_summary][0]
63+
get_components_response[0].data.keys()) if get_components_response[0].data[id] == component_summary][0]
6464
print("SPAR Component Id: " + component_id)
6565
spar_account_identifier = SPARIdentifier(id=spar_benchmark_r_1000, returntype=spar_benchmark_russell_return_type,
6666
prefix=spar_benchmark_russell_prefix)

examples/spar_engine_single_unit_example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ def main():
5050
startdate = "20180101"
5151
enddate = "20181231"
5252
frequency = "Monthly"
53-
components = components_api.get_spar_components(spar_document_name)
53+
get_components_response = components_api.get_spar_components(spar_document_name)
5454
component_summary = ComponentSummary(
5555
name=spar_component_name, category=spar_component_category)
5656
component_id = [id for id in list(
57-
components.data.keys()) if components.data[id] == component_summary][0]
57+
get_components_response[0].data.keys()) if get_components_response[0].data[id] == component_summary][0]
5858
print("SPAR Component Id: " + component_id)
5959
spar_account_identifier = SPARIdentifier(id=spar_benchmark_r_1000, returntype=spar_benchmark_russell_return_type,
6060
prefix=spar_benchmark_russell_prefix)

examples/vault_engine_multiple_unit_example.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,17 @@ def main():
5151
vault_enddate = "20180329"
5252
frequency = "Monthly"
5353

54-
components = components_api.get_vault_components(vault_document_name)
54+
get_components_response = components_api.get_vault_components(vault_document_name)
5555
component_total_returns_summary = ComponentSummary(
5656
name=vault_component_total_returns, category=vault_component_category)
57-
component_total_returns_id = [id for id in list(components.data.keys(
58-
)) if components.data[id] == component_total_returns_summary][0]
57+
component_total_returns_id = [id for id in list(get_components_response[0].data.keys(
58+
)) if get_components_response[0].data[id] == component_total_returns_summary][0]
5959
print("Vault Total Returns Component Id: " + component_total_returns_id)
6060

6161
component_performance_summary = ComponentSummary(
6262
name=vault_component_performance, category=vault_component_category)
63-
component_performance_id = [id for id in list(components.data.keys(
64-
)) if components.data[id] == component_performance_summary][0]
63+
component_performance_id = [id for id in list(get_components_response[0].data.keys(
64+
)) if get_components_response[0].data[id] == component_performance_summary][0]
6565
print("Vault Performance Over Time Component Id: " +
6666
component_performance_id)
6767

@@ -70,9 +70,9 @@ def main():
7070
startdate=vault_startdate, enddate=vault_enddate, frequency=frequency)
7171

7272
configurations_api = ConfigurationsApi(api_client)
73-
configurations = configurations_api.get_vault_configurations(
73+
get_vault_configurations_response = configurations_api.get_vault_configurations(
7474
vault_default_account)
75-
configuration_id = list(configurations.data.keys())[0]
75+
configuration_id = list(get_vault_configurations_response[0].data.keys())[0]
7676

7777
vault_calculation_parameters = {
7878
"total_returns": VaultCalculationParameters(componentid=component_total_returns_id, account=vault_account_identifier, dates=vault_dates, configid=configuration_id),

examples/vault_engine_single_unit_example.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,20 @@ def main():
5050
vault_enddate = "20180329"
5151
frequency = "Monthly"
5252

53-
components = components_api.get_vault_components(vault_document_name)
53+
get_components_response = components_api.get_vault_components(vault_document_name)
5454
component_summary = ComponentSummary(
5555
name=vault_component_name, category=vault_component_category)
5656
component_id = [id for id in list(
57-
components.data.keys()) if components.data[id] == component_summary][0]
57+
get_components_response[0].data.keys()) if get_components_response[0].data[id] == component_summary][0]
5858
print("Vault Component Id: " + component_id)
5959
vault_account_identifier = VaultIdentifier(vault_default_account)
6060
vault_dates = VaultDateParameters(
6161
startdate=vault_startdate, enddate=vault_enddate, frequency=frequency)
6262

6363
configurations_api = ConfigurationsApi(api_client)
64-
configurations = configurations_api.get_vault_configurations(
64+
get_vault_configurations_response = configurations_api.get_vault_configurations(
6565
vault_default_account)
66-
configuration_id = list(configurations.data.keys())[0]
66+
configuration_id = list(get_vault_configurations_response[0].data.keys())[0]
6767

6868
vault_calculation_parameters = {
6969
"1": VaultCalculationParameters(componentid=component_id, account=vault_account_identifier, dates=vault_dates, configid=configuration_id)}

0 commit comments

Comments
 (0)