PerformanceReport#
-
class sigtech.framework.analytics.performance.performance_report.PerformanceReport
Class providing customised statistics, rolling graphs and performance calendar output for strategies, instruments and time series.
Basic usage:
from sigtech.framework.default_strategy_objects.rolling_futures import es_index_front few_views = [sig.View.MONTHLY_STATS, sig.View.PRESENTATION_PERF_TABLE] # Define a performance report for a strategy report = sig.PerformanceReport(es_index_front(), name='My Strategy', views=few_views) # Define a performance report for an instrument bond = sig.obj.get('US 2 2025/08/15 GOVT') report = sig.PerformanceReport(bond, name='My bond', views=few_views) # Once a performance report has been defined, it can be generated via `report.report()`
The parameter
cash
is used to compute specific metrics, e.g. Annualised Sortino Ratio (vs Cash). Accepted types are pandas Series andInstrument
. Ifcash
is set to'automatic'
, the cash index object returned by the currency ticker of the strategy is used (when applicable).The parameter
legend
controls the location of the legend when plotting graphs. The graphs currently available are:historical performance with
View.HISTORY
, androlling excess return, rolling sharpe, rolling drawdown with
View.ROLLING_PLOTS
.
See
View
for a full list of available views. To display all views, specifyviews='ALL'
.Using the legend constants available for pyplot,
legend=(1, 2, 3, 4)
will position the historical performance legend in the top right corner of the graph, the rolling excess return legend in the top left corner, the rolling sharpe legend in the bottom left corner, and the rolling drawdown legend in the bottom right corner.Sharpe ratios can be tailored to use compounding returns by setting
compound_metrics=True
or simple, arithmetic returns withcompound_metrics=False
(default).If passing a strategy with zero initial cash you may wish to pass a representative AUM via the
aum
keyword. This is expected in units of the strategy currency and if passed, the strategy history series is considered relative to this constant AUM level. E.g. Returns =(history[t+1] - history[t]) / aum
.Use
adjust_benchmark_by_aum=True
to consider the benchmark history series (if provided) relative to the constant AUM level (default is False).Use
profit_metrics_only
to ignore metrics that are calculated using the percentage returns. If left asNone
this is automatically set by looking for negative values in the valuation history.-
property stats_df
DataFrame of metrics.
-
add_view(view) deprecated
Add a view to the customised report.
- Parameters:
view – Input view.
-
add_views(views)
Add a list of views to the customised report.
- Parameters:
views – List of views.
-
arrange_views(views)
Set the views for the customised report.
- Parameters:
views – List of views.
-
default_views()
Return the default views available.
-
interactive_report()
Generate the full suite of plots and display in
ipywidgets
to allow user browsing and parameter choices.Note
The method must be called from a Jupyter Lab or Notebook session in order to display the widgets.
-
report()
Generate a performance report.
-
rolling_stat(stat_name, use_returns=True)
Retrieve a rolling statistic.
- Parameters:
stat_name – Statistic identifier.
- Returns:
pandas DataFrame.
-
stats_display()
Display the formatted summary statistics.
-
stats_display_ccy()
Display the formatted summary statistics.
-
views()
Return the list of views for the customised report.