Skip to content

fix(SDK): Added Holdings Mode for PA API Code Snippet #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions examples/pa_engine_multiple_unit_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,16 @@ def main():
startdate = "20180101"
enddate = "20181231"
frequency = "Monthly"
holdings = "B&H"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this better to make the variable name too as holdingsmode? Also, it may be good to have this variable at line 49 as it is related to accounts and benchmarks.

# uncomment the below code line to setup cache control; max-stale=0 will be a fresh adhoc run and the max-stale value is in seconds.
# Results are by default cached for 12 hours; Setting max-stale=300 will fetch a cached result which is 5 minutes older.
# cache_control = "max-stale=0"
get_components_response = components_api.get_pa_components(document=pa_document_name)
component_id = [id for id in list(
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]
print("PA Component Id: " + component_id)
pa_accounts = [PAIdentifier(id=portfolio)]
pa_benchmarks = [PAIdentifier(id=benchmark)]
pa_accounts = [PAIdentifier(id=portfolio, holdingsmode=holdings)]
pa_benchmarks = [PAIdentifier(id=benchmark, holdingsmode=holdings)]
pa_dates = PADateParameters(
startdate=startdate, enddate=enddate, frequency=frequency)

Expand Down
5 changes: 3 additions & 2 deletions examples/pa_engine_single_unit_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,16 @@ def main():
startdate = "20180101"
enddate = "20181231"
frequency = "Monthly"
holdings = "B&H"
# uncomment the below code line to setup cache control; max-stale=0 will be a fresh adhoc run and the max-stale value is in seconds.
# Results are by default cached for 12 hours; Setting max-stale=300 will fetch a cached result which is 5 minutes older.
# cache_control = "max-stale=0"
get_components_response = components_api.get_pa_components(document=pa_document_name)
component_id = [id for id in list(
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]
print("PA Component Id: " + component_id)
pa_accounts = [PAIdentifier(id=portfolio)]
pa_benchmarks = [PAIdentifier(id=benchmark)]
pa_accounts = [PAIdentifier(id=portfolio, holdingsmode=holdings)]
pa_benchmarks = [PAIdentifier(id=benchmark, holdingsmode=holdings)]
pa_dates = PADateParameters(
startdate=startdate, enddate=enddate, frequency=frequency)

Expand Down