Skip to content

Commit cb3a60b

Browse files
fix(scripts): Fixing the component comparison logic (#75)
1 parent ffb2b22 commit cb3a60b

File tree

4 files changed

+8
-17
lines changed

4 files changed

+8
-17
lines changed

examples/pa_engine_multiple_unit_example.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
host = "https://api.factset.com"
2222
username = "<username-serial>"
23-
password = "<apiKey>"
23+
password = "<apikey>"
2424

2525

2626
def main():
@@ -45,18 +45,15 @@ def main():
4545
pa_document_name = "PA_DOCUMENTS:DEFAULT"
4646
pa_component_name = "Weights"
4747
pa_component_category = "Weights / Exposures"
48-
pa_component_type = "PA component"
4948
pa_benchmark_sp_50 = "BENCH:SP50"
5049
pa_benchmark_r_1000 = "BENCH:R.1000"
5150
startdate = "20180101"
5251
enddate = "20181231"
5352
frequency = "Monthly"
5453

5554
get_components_response = components_api.get_pa_components(document=pa_document_name)
56-
component_summary = ComponentSummary(
57-
name=pa_component_name, category=pa_component_category, type=pa_component_type)
5855
component_id = [id for id in list(
59-
get_components_response[0].data.keys()) if get_components_response[0].data[id] == component_summary][0]
56+
get_components_response[0].data.keys()) if get_components_response[0].data[id].name == pa_component_name and get_components_response[0].data[id].category == pa_component_category][0]
6057
print("PA Component Id: " + component_id)
6158
pa_accounts = [PAIdentifier(id=pa_benchmark_sp_50)]
6259
pa_benchmarks = [PAIdentifier(id=pa_benchmark_r_1000)]

examples/pa_engine_single_unit_example.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020

2121
host = "https://api.factset.com"
2222
username = "<username-serial>"
23-
password = "<apiKey>"
24-
23+
password = "<apikey>"
2524

2625
def main():
2726
config = Configuration()
@@ -45,18 +44,15 @@ def main():
4544
pa_document_name = "PA_DOCUMENTS:DEFAULT"
4645
pa_component_name = "Weights"
4746
pa_component_category = "Weights / Exposures"
48-
pa_component_type = "PA component"
4947
pa_benchmark_sp_50 = "BENCH:SP50"
5048
pa_benchmark_r_1000 = "BENCH:R.1000"
5149
startdate = "20180101"
5250
enddate = "20181231"
5351
frequency = "Monthly"
5452

5553
get_components_response = components_api.get_pa_components(document=pa_document_name)
56-
component_summary = ComponentSummary(
57-
name=pa_component_name, category=pa_component_category, type=pa_component_type)
5854
component_id = [id for id in list(
59-
get_components_response[0].data.keys()) if get_components_response[0].data[id] == component_summary][0]
55+
get_components_response[0].data.keys()) if get_components_response[0].data[id].name == pa_component_name and get_components_response[0].data[id].category == pa_component_category][0]
6056
print("PA Component Id: " + component_id)
6157
pa_accounts = [PAIdentifier(id=pa_benchmark_sp_50)]
6258
pa_benchmarks = [PAIdentifier(id=pa_benchmark_r_1000)]

examples/spar_engine_multiple_unit_example.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ def main():
5858
frequency2 = "Monthly"
5959

6060
get_components_response = components_api.get_spar_components(spar_document_name)
61-
component_summary = ComponentSummary(
62-
name=spar_component_name, category=spar_component_category)
61+
6362
component_id = [id for id in list(
64-
get_components_response[0].data.keys()) if get_components_response[0].data[id] == component_summary][0]
63+
get_components_response[0].data.keys()) if get_components_response[0].data[id].name == spar_component_name and get_components_response[0].data[id].category == spar_component_category][0]
6564
print("SPAR Component Id: " + component_id)
6665
spar_account_identifier = SPARIdentifier(id=spar_benchmark_r_1000, returntype=spar_benchmark_russell_return_type,
6766
prefix=spar_benchmark_russell_prefix)

examples/spar_engine_single_unit_example.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@ def main():
5252
enddate = "20181231"
5353
frequency = "Monthly"
5454
get_components_response = components_api.get_spar_components(spar_document_name)
55-
component_summary = ComponentSummary(
56-
name=spar_component_name, category=spar_component_category)
55+
5756
component_id = [id for id in list(
58-
get_components_response[0].data.keys()) if get_components_response[0].data[id] == component_summary][0]
57+
get_components_response[0].data.keys()) if get_components_response[0].data[id].name == spar_component_name and get_components_response[0].data[id].category == spar_component_category][0]
5958
print("SPAR Component Id: " + component_id)
6059
spar_account_identifier = SPARIdentifier(id=spar_benchmark_r_1000, returntype=spar_benchmark_russell_return_type,
6160
prefix=spar_benchmark_russell_prefix)

0 commit comments

Comments
 (0)