From de61104d2a279c86d86ec3e5f5de9544c0c98a87 Mon Sep 17 00:00:00 2001 From: OrYarimi Date: Tue, 15 Feb 2022 09:41:17 +0200 Subject: [PATCH] adding benchmark name to html report --- quantstats/report.html | 1 + quantstats/reports.py | 1 + 2 files changed, 2 insertions(+) diff --git a/quantstats/report.html b/quantstats/report.html index 8c4870e0..78adf973 100644 --- a/quantstats/report.html +++ b/quantstats/report.html @@ -20,6 +20,7 @@

{{title}}
{{date_range}}

+

{{benchmark_title}}

Generated by QuantStats (v. {{v}})


diff --git a/quantstats/reports.py b/quantstats/reports.py index 7d29e317..377652dc 100644 --- a/quantstats/reports.py +++ b/quantstats/reports.py @@ -72,6 +72,7 @@ def html(returns, benchmark=None, rf=0., grayscale=False, # prepare timeseries returns = _utils._prepare_returns(returns) if benchmark is not None: + tpl = tpl.replace('{{benchmark_title}}', f"Benchmark is {benchmark}") benchmark = _utils._prepare_benchmark(benchmark, returns.index, rf) if match_dates is True: returns, benchmark = _match_dates(returns, benchmark)