Skip to content

Commit

Permalink
Merge pull request #411 from Lumiwealth/parameters-section-in-quanstats-
Browse files Browse the repository at this point in the history
added parameters to quanstats
  • Loading branch information
davidlatte authored Mar 31, 2024
2 parents 9e826ad + 254e11b commit dfe6e45
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions lumibot/strategies/_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,13 @@ def tearsheet(
if self._strategy_returns_df is None:
self.logger.warning("Cannot create a tearsheet because the strategy returns are missing")
else:
# Get the strategy parameters
strategy_parameters = self.parameters

# Remove pandas_data from the strategy parameters if it exists
if "pandas_data" in strategy_parameters:
del strategy_parameters["pandas_data"]

strat_name = self._name if self._name is not None else "Strategy"
create_tearsheet(
self._strategy_returns_df,
Expand All @@ -696,6 +703,7 @@ def tearsheet(
self._benchmark_asset,
show_tearsheet,
risk_free_rate=self.risk_free_rate,
strategy_parameters=strategy_parameters,
)

@classmethod
Expand Down
2 changes: 2 additions & 0 deletions lumibot/tools/indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ def create_tearsheet(
benchmark_asset, # This is causing a circular import: Asset,
show_tearsheet: bool,
risk_free_rate: float,
strategy_parameters: dict = None,
):
# If show tearsheet is False, then we don't want to open the tearsheet in the browser
if not show_tearsheet:
Expand Down Expand Up @@ -717,6 +718,7 @@ def create_tearsheet(
output=tearsheet_file,
download_filename=tearsheet_file, # Consider if you need a different name for clarity
rf=risk_free_rate,
parameters=strategy_parameters,
)

if show_tearsheet:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="lumibot",
version="3.2.15",
version="3.3.0",
author="Robert Grzesik",
author_email="[email protected]",
description="Backtesting and Trading Library, Made by Lumiwealth",
Expand Down Expand Up @@ -37,7 +37,7 @@
"pytest",
"scipy==1.10.1", # Newer versions of scipy are currently causing issues
"ipython", # required for quantstats, but not in their dependency list for some reason
"quantstats-lumi>=0.1.11",
"quantstats-lumi>=0.2.0",
"python-dotenv", # Secret Storage
"ccxt==4.2.85",
"termcolor",
Expand Down

0 comments on commit dfe6e45

Please sign in to comment.