Skip to content

Commit

Permalink
fix: missed data-provider-live error
Browse files Browse the repository at this point in the history
PR: #416
  • Loading branch information
Romazes committed Feb 14, 2024
1 parent d1034be commit fb77cf1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lean/commands/live/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _get_configurable_modules_from_environment(lean_config: Dict[str, Any], envi
environment = lean_config["environments"][environment_name]
for key in ["live-mode-brokerage", "data-queue-handler"]:
if key not in environment:
raise MoreInfoError(f"The '{environment_name}' environment does not specify a {key}",
raise MoreInfoError(f"The '{environment_name}' environment does not specify a {'data-provider-live' if key == 'data-queue-handler' else key}",
"https://www.lean.io/docs/v2/lean-cli/live-trading/algorithm-control")

brokerage = environment["live-mode-brokerage"]
Expand Down Expand Up @@ -343,7 +343,7 @@ def deploy(project: Path,
lean_environment = lean_config["environments"][environment_name]
for key in ["live-mode-brokerage", "data-queue-handler"]:
if key not in lean_environment:
raise MoreInfoError(f"The '{environment_name}' environment does not specify a {key}",
raise MoreInfoError(f"The '{environment_name}' environment does not specify a {'data-provider-live' if key == 'data-queue-handler' else key}",
"https://www.lean.io/docs/v2/lean-cli/live-trading/algorithm-control")

brokerage = lean_environment["live-mode-brokerage"]
Expand Down
19 changes: 19 additions & 0 deletions tests/commands/live/test_local_live_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,22 @@ def test_local_live_update_order_fails_without_order_id() -> None:
result = CliRunner().invoke(lean, ["live", "update-order", "Python Project"])

assert result.exit_code != 0

def test_local() -> None:
create_fake_lean_cli_directory()

project_config_manager = mock.MagicMock()
project_config_manager.get_latest_live_directory.return_value = "mock_live_dir"
container.project_config_manager = project_config_manager

output_config_manager = mock.Mock()
container.output_config_manager = output_config_manager

docker_manager = mock.MagicMock()
docker_manager.read_from_file.return_value = {"success": True}
container.docker_manager = docker_manager

result = CliRunner().invoke(lean, ["live", "add-security", "Python Project",
*symbol_options])

assert result.exit_code == 0

0 comments on commit fb77cf1

Please sign in to comment.