From d1fa530a2fb6c0b8a6cfc8a0df1c6363d7b27e8b Mon Sep 17 00:00:00 2001 From: Martin-Molinero Date: Thu, 23 Jun 2022 19:55:36 -0300 Subject: [PATCH 1/2] Remove Object Storage default limits - Remove object storage default limits if not already defined in config --- lean/components/config/lean_config_manager.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lean/components/config/lean_config_manager.py b/lean/components/config/lean_config_manager.py index 15147b8e..56a243b6 100644 --- a/lean/components/config/lean_config_manager.py +++ b/lean/components/config/lean_config_manager.py @@ -262,6 +262,12 @@ def get_complete_lean_config(self, project_config = self._project_config_manager.get_project_config(algorithm_file.parent) config["parameters"] = project_config.get("parameters", {}) + # No real limit for the object store by default + if "storage-limit-mb" not in config: + config["storage-limit-mb"] = "9999999" + if "storage-file-count" not in config: + config["storage-file-count"] = "9999999" + return config def configure_data_purchase_limit(self, lean_config: Dict[str, Any], data_purchase_limit: Optional[int]) -> None: From 28bf5d341a2c8db7432c75dcb18cef5e52542a25 Mon Sep 17 00:00:00 2001 From: Martin-Molinero Date: Fri, 24 Jun 2022 13:22:16 -0300 Subject: [PATCH 2/2] Fix live tests - After the addition of binance exchange config the live tests needed an update --- tests/commands/test_live.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/commands/test_live.py b/tests/commands/test_live.py index cfbf6ee5..68b8e870 100644 --- a/tests/commands/test_live.py +++ b/tests/commands/test_live.py @@ -78,7 +78,7 @@ def test_live_calls_lean_runner_with_correct_algorithm_file() -> None: result = CliRunner().invoke(lean, ["live", "Python Project", "--environment", "live-paper"]) traceback.print_exception(*result.exc_info) - + assert result.exit_code == 0 lean_runner.run_lean.assert_called_once_with(mock.ANY, @@ -303,6 +303,7 @@ def test_live_aborts_when_lean_config_is_missing_properties(target: str, replace "gdax-use-sandbox": "paper" }, "Binance": { + "binance-exchange-name": "binance", "binance-api-key": "123", "binance-api-secret": "456", "binance-use-testnet": "paper", @@ -364,7 +365,7 @@ def test_live_aborts_when_lean_config_is_missing_properties(target: str, replace "ftx-exchange-name": "FTX", "ftx-organization": "abc", }, - + } data_feed_required_options = { @@ -539,7 +540,7 @@ def test_live_non_interactive_calls_run_lean_when_all_options_given_with_multipl False, False) - + @pytest.mark.parametrize("brokerage", brokerage_required_options.keys() - ["Paper Trading"]) def test_live_non_interactive_falls_back_to_lean_config_for_brokerage_settings(brokerage: str) -> None: create_fake_lean_cli_directory() @@ -578,12 +579,14 @@ def test_live_non_interactive_falls_back_to_lean_config_for_brokerage_settings(b elif brokerage == "FTX": data_feed = "Binance" options.extend(["--ftx-exchange-name", "FTXUS", + "--binance-exchange-name", "binance", "--binance-api-key", "123", "--binance-api-secret", "456", "--binance-use-testnet", "live"]) else: data_feed = "Binance" - options.extend(["--binance-api-key", "123", + options.extend(["--binance-exchange-name", "binance", + "--binance-api-key", "123", "--binance-api-secret", "456", "--binance-use-testnet", "live"]) @@ -640,7 +643,9 @@ def test_live_non_interactive_falls_back_to_lean_config_for_data_feed_settings(d if data_feed == "FTX": options.extend(["--ftx-exchange-name", "FTX"]) - + elif data_feed == "Binance": + options.extend(["--binance-exchange-name", "binance"]) + result = CliRunner().invoke(lean, ["live", "Python Project", "--brokerage", "Paper Trading", "--data-feed", data_feed, @@ -695,7 +700,9 @@ def test_live_non_interactive_falls_back_to_lean_config_for_multiple_data_feed_s if data_feed1 == "FTX" or data_feed2 == "FTX": options.extend(["--ftx-exchange-name", "FTX"]) - + elif data_feed1 == "Binance" or data_feed2 == "Binance": + options.extend(["--binance-exchange-name", "binance"]) + result = CliRunner().invoke(lean, ["live", "Python Project", "--brokerage", "Paper Trading", "--data-feed", data_feed1,