PerformanceReport¶
- class PerformanceReport(report_id=None, name=None, position_source_id=None, position_source_type=None, parameters=None, earliest_start_date=None, latest_end_date=None, latest_execution_time=None, status=ReportStatus.new, percentage_complete=None, **kwargs)[source]¶
Historical analyses on measures like PnL and exposure of a position source over a date range
Methods
- __init__(report_id=None, name=None, position_source_id=None, position_source_type=None, parameters=None, earliest_start_date=None, latest_end_date=None, latest_execution_time=None, status=ReportStatus.new, percentage_complete=None, **kwargs)[source]¶
Historical analyses on measures like PnL and exposure of a portfolio over a date range
- Parameters:
report_id (
Optional
[str
]) – Marquee report IDname (
Optional
[str
]) – report nameposition_source_id (
Optional
[str
]) – position source IDposition_source_type (
Union
[str
,PositionSourceType
,None
]) – position source (i.e. ‘Portfolio’, ‘Asset’, or ‘Hedge’)parameters (
Optional
[ReportParameters
]) – parameters of the reportearliest_start_date (
Optional
[date
]) – start date of reportlatest_end_date (
Optional
[date
]) – end date of reportlatest_execution_time (
Optional
[datetime
]) – date of the latest executionstatus (
Union
[str
,ReportStatus
]) – status of of report (i.e. ‘ready’, ‘executing’, or ‘done’)percentage_complete (
Optional
[float
]) – percent of the report that is complete
Examples
>>> performance_report = PerformanceReport( >>> position_source_type=PositionSourceType.Portfolio, >>> position_source_id='PORTFOLIOID' >>> )
- delete()¶
Delete a report from Marquee
- classmethod get(report_id, **kwargs)[source]¶
Get a performance report from the unique report identifier
- Parameters:
report_id (
str
) – Marquee report ID- Returns:
returns a PerformanceReport object that correlates to the Marquee report
- get_asset_count(start_date=None, end_date=None)[source]¶
Get historical portfolio asset count
- Parameters:
start_date (
Optional
[date
]) – start dateend_date (
Optional
[date
]) – end date
- Return type:
DataFrame
- Returns:
returns a Pandas DataFrame with the results
- get_asset_count_long(start_date=None, end_date=None)[source]¶
Get historical portfolio long asset count
- Parameters:
start_date (
Optional
[date
]) – start dateend_date (
Optional
[date
]) – end date
- Return type:
DataFrame
- Returns:
returns a Pandas DataFrame with the results
- get_asset_count_priced(start_date=None, end_date=None)[source]¶
Get historical portfolio asset count priced
- Parameters:
start_date (
Optional
[date
]) – start dateend_date (
Optional
[date
]) – end date
- Return type:
DataFrame
- Returns:
returns a Pandas DataFrame with the results
- get_asset_count_short(start_date=None, end_date=None)[source]¶
Get historical portfolio short asset count
- Parameters:
start_date (
Optional
[date
]) – start dateend_date (
Optional
[date
]) – end date
- Return type:
Union
[MDAPIDataBatchResponse
,DataQueryResponse
,tuple
,list
]- Returns:
returns a Pandas DataFrame with the results
- get_aum(start_date, end_date)[source]¶
Get AUM data for performance report
- Parameters:
start_date (
date
) – start dateend_date (
date
) – end date
- Returns:
dictionary of dates with corresponding AUM values
- get_aum_source()[source]¶
Get AUM Source for the portfolio associated with the performance report
- Return type:
RiskAumSource
- Returns:
aum source
- get_brinson_attribution(benchmark=None, currency=None, include_interaction=False, aggregation_type=AttributionAggregationType.Arithmetic, start_date=None, end_date=None, return_format=ReturnFormat.DATA_FRAME)[source]¶
Get PnL analytics called Brinson Attribution
- Parameters:
benchmark (
Optional
[str
]) – benchmark’s unique Marquee identifiercurrency (
Optional
[Currency
]) – currency of results; if none passed results default to your portfolio’s currencyinclude_interaction (
bool
) – show interaction independent of security selectionaggregation_type (
AttributionAggregationType
) – either artihmetic or geometricstart_date (
Optional
[date
]) – start dateend_date (
Optional
[date
]) – end datereturn_format (
ReturnFormat
) – return format; defaults to a Pandas DataFrame, but can be manually
set to ReturnFormat.JSON :rtype:
Union
[Dict
,DataFrame
] :return: Portfolio Brinson Attribution data for the requested date rangeExamples
>>> brinson_attribution_results = performance_report.get_brinson_attribution ( >>> benchmark=asset.get_marquee_id(), >>> include_interaction=True, >>> start_date=performance_report.earliest_start_date, >>> end_date=performance_report.latest_end_date, >>> ) >>> display(pd.DataFrame(brinson_attribution_results))
- get_custom_aum(start_date=None, end_date=None)[source]¶
Get AUM data for performance report
- Parameters:
start_date (
Optional
[date
]) – start dateend_date (
Optional
[date
]) – end date
- Return type:
List
[CustomAUMDataPoint
]- Returns:
list of AUM data between the specified range
- get_gross_exposure(start_date=None, end_date=None)[source]¶
Get historical portfolio gross exposure
- Parameters:
start_date (
Optional
[date
]) – start dateend_date (
Optional
[date
]) – end date
- Return type:
DataFrame
- Returns:
returns a Pandas DataFrame with the results
- get_long_exposure(start_date=None, end_date=None)[source]¶
Get historical portfolio long exposure
- Parameters:
start_date (
Optional
[date
]) – start dateend_date (
Optional
[date
]) – end date
- Return type:
DataFrame
- Returns:
returns a Pandas DataFrame with the results
- get_many_measures(measures=None, start_date=None, end_date=None, return_format=ReturnFormat.DATA_FRAME)[source]¶
Get many historical portfolio metrics
- Parameters:
measures (
Optional
[Tuple
[str
,...
]]) – a list of metricsstart_date (
Optional
[date
]) – start dateend_date (
Optional
[date
]) – end date
- Return type:
Union
[Dict
,DataFrame
]- Returns:
returns a Pandas DataFrame with the results
- get_measure(field, start_date=None, end_date=None, return_format=ReturnFormat.DATA_FRAME)[source]¶
Get historical portfolio metrics
- Parameters:
field (
str
) – the entity property to be returnedstart_date (
Optional
[date
]) – start dateend_date (
Optional
[date
]) – end date
- Return type:
Union
[Dict
,DataFrame
]- Returns:
returns a Pandas DataFrame with the results
- get_most_recent_job()¶
Retrieve the most current report job
- get_net_exposure(start_date=None, end_date=None)[source]¶
Get historical portfolio net exposure
- Parameters:
start_date (
Optional
[date
]) – start dateend_date (
Optional
[date
]) – end date
- Return type:
DataFrame
- Returns:
returns a Pandas DataFrame with the results
- get_pnl(start_date=None, end_date=None)[source]¶
Get historical portfolio PnL
- Parameters:
start_date (
Optional
[date
]) – start dateend_date (
Optional
[date
]) – end date
- Return type:
DataFrame
- Returns:
returns a Pandas DataFrame with the results
- get_pnl_contribution(start_date=None, end_date=None, currency=None)[source]¶
Get PnL Contribution broken down by constituents
- Parameters:
start_date (
Optional
[date
]) – optional start dateend_date (
Optional
[date
]) – optional end datecurrency (
Optional
[Currency
]) – optional currency; defaults to your portfolio’s currency
- Return type:
DataFrame
- Returns:
a Pandas DataFrame of results
- get_portfolio_constituents(fields=None, start_date=None, end_date=None, return_format=ReturnFormat.DATA_FRAME)[source]¶
Get historical portfolio constituents
- Parameters:
fields (
Optional
[List
[str
]]) – list of fields to include in the resultsstart_date (
Optional
[date
]) – start dateend_date (
Optional
[date
]) – end datereturn_format (
ReturnFormat
) – return format; defaults to a Pandas DataFrame, but can be manually
set to ReturnFormat.JSON :rtype:
Union
[Dict
,DataFrame
] :return: Portfolio constituent data for each day in the requested date range
- get_positions_data(start=None, end=datetime.date(2023, 8, 14), fields=None, include_all_business_days=False)[source]¶
- get_servicing_cost_long_pnl(start_date=None, end_date=None)[source]¶
Get historical portfolio servicing cost long PnL
- Parameters:
start_date (
Optional
[date
]) – start dateend_date (
Optional
[date
]) – end date
- Return type:
DataFrame
- Returns:
returns a Pandas DataFrame with the results
- get_servicing_cost_short_pnl(start_date=None, end_date=None)[source]¶
Get historical portfolio servicing cost short PnL
- Parameters:
start_date (
Optional
[date
]) – start dateend_date (
Optional
[date
]) – end date
- Return type:
DataFrame
- Returns:
returns a Pandas DataFrame with the results
- get_short_exposure(start_date=None, end_date=None)[source]¶
Get historical portfolio short exposure
- Parameters:
start_date (
Optional
[date
]) – start dateend_date (
Optional
[date
]) – end date
- Return type:
DataFrame
- Returns:
returns a Pandas DataFrame with the results
- get_trading_cost_pnl(start_date=None, end_date=None)[source]¶
Get historical portfolio trading cost PnL
- Parameters:
start_date (
Optional
[date
]) – start dateend_date (
Optional
[date
]) – end date
- Return type:
DataFrame
- Returns:
returns a Pandas DataFrame with the results
- get_trading_pnl(start_date=None, end_date=None)[source]¶
Get historical portfolio trading PnL
- Parameters:
start_date (
Optional
[date
]) – start dateend_date (
Optional
[date
]) – end date
- Return type:
DataFrame
- Returns:
returns a Pandas DataFrame with the results
- get_turnover(start_date=None, end_date=None)[source]¶
Get historical portfolio turnover
- Parameters:
start_date (
Optional
[date
]) – start dateend_date (
Optional
[date
]) – end date
- Return type:
DataFrame
- Returns:
returns a Pandas DataFrame with the results
- run(start_date=None, end_date=None, backcast=False, is_async=True)¶
Run a report with the given date range
- Parameters:
start_date (
Optional
[date
]) – start date (optional)end_date (
Optional
[date
]) – end date (optional)backcast (
bool
) – set to true if the report should be backcasted; defaults to falseis_async (
bool
) – return immediately (true) or wait for results (false); defaults to true
- save()¶
Create a report in Marquee if it doesn’t exist. Update the report if it does.
- schedule(start_date=None, end_date=None, backcast=None)¶
Schedule a report with the given date range
- Parameters:
start_date (
Optional
[date
]) – start date (optional)end_date (
Optional
[date
]) – end date (optional)backcast (
Optional
[bool
]) – set to true if the report should be backcasted
- set_aum_source(aum_source)[source]¶
Set AUM Source for the portfolio associated with the performance report
- Parameters:
aum_source (
RiskAumSource
) – aum source for portfolio- Returns:
aum source
- set_position_source(entity_id)¶
Set position source type and position source ID
- upload_custom_aum(aum_data, clear_existing_data=None)[source]¶
Add AUM data for portfolio corresponding to the performance report
- Parameters:
aum_data (
List
[CustomAUMDataPoint
]) – list of AUM data to uploadclear_existing_data (
Optional
[bool
]) – delete all previously uploaded AUM data for the portfolio (defaults to false)