Skip to content

Commit

Permalink
Merge pull request #257 from rjra2611/feature-implement-extra-config-…
Browse files Browse the repository at this point in the history
…option

Implement extra config option
  • Loading branch information
Martin-Molinero authored Dec 26, 2022
2 parents 5b41980 + 9fda2ab commit 1b99b6f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lean/commands/backtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


from pathlib import Path
from typing import List, Optional
from typing import List, Optional, Tuple
from click import command, option, argument, Choice

from lean.click import LeanCommand, PathParameter
Expand Down Expand Up @@ -285,6 +285,10 @@ def _select_organization() -> QCMinimalOrganization:
type=str,
multiple=True,
hidden=True)
@option("--extra-config",
type=(str, str),
multiple=True,
hidden=True)
def backtest(project: Path,
output: Optional[Path],
detach: bool,
Expand All @@ -297,7 +301,8 @@ def backtest(project: Path,
python_venv: Optional[str],
update: bool,
backtest_name: str,
addon_module: Optional[List[str]]) -> None:
addon_module: Optional[List[str]],
extra_config: Optional[Tuple[str, str]]) -> None:
"""Backtest a project locally using Docker.
\b
Expand Down Expand Up @@ -373,6 +378,10 @@ def backtest(project: Path,
if backtest_name is not None and backtest_name != "":
lean_config["backtest-name"] = backtest_name

# Set extra config
for key, value in extra_config:
lean_config[key] = value

if python_venv is not None and python_venv != "":
lean_config["python-venv"] = f'{"/" if python_venv[0] != "/" else ""}{python_venv}'

Expand Down

0 comments on commit 1b99b6f

Please sign in to comment.