diff --git a/freqtrade/optimize/analysis/lookahead_helpers.py b/freqtrade/optimize/analysis/lookahead_helpers.py index b3cba9ed4..730f9fd72 100644 --- a/freqtrade/optimize/analysis/lookahead_helpers.py +++ b/freqtrade/optimize/analysis/lookahead_helpers.py @@ -68,10 +68,7 @@ class LookaheadAnalysisSubFunctions: ) print_rich_table( - data, - headers, - summary="Lookahead Analysis", - table_kwargs={"caption": caption} + data, headers, summary="Lookahead Analysis", table_kwargs={"caption": caption} ) return data @@ -247,12 +244,17 @@ class LookaheadAnalysisSubFunctions: # report the results if lookaheadAnalysis_instances: caption: Union[str, None] = None - if any([ - any([ - indicator.startswith("&") - for indicator in inst.current_analysis.false_indicators - ]) for inst in lookaheadAnalysis_instances - ]): + if any( + [ + any( + [ + indicator.startswith("&") + for indicator in inst.current_analysis.false_indicators + ] + ) + for inst in lookaheadAnalysis_instances + ] + ): caption = ( "Any indicators in 'biased_indicators' which are used within " "set_freqai_targets() can be ignored." diff --git a/tests/optimize/test_lookahead_analysis.py b/tests/optimize/test_lookahead_analysis.py index dd036cdc9..67c83762a 100644 --- a/tests/optimize/test_lookahead_analysis.py +++ b/tests/optimize/test_lookahead_analysis.py @@ -154,14 +154,8 @@ def test_lookahead_helper_start(lookahead_conf, mocker) -> None: ["&indicator1", "&indicator2"], IGNORE_BIASED_INDICATORS_CAPTION, ), - ( - ["indicator1", "indicator2"], - None - ), - ( - [], - None - ), + (["indicator1", "indicator2"], None), + ([], None), ], ids=( "First of two biased indicators starts with '&'", @@ -172,10 +166,7 @@ def test_lookahead_helper_start(lookahead_conf, mocker) -> None: ), ) def test_lookahead_helper_start__caption_based_on_indicators( - indicators, - expected_caption_text, - lookahead_conf, - mocker + indicators, expected_caption_text, lookahead_conf, mocker ): """Test that the table caption is only populated if a biased_indicator starts with '&'.""" @@ -196,9 +187,7 @@ def test_lookahead_helper_start__caption_based_on_indicators( LookaheadAnalysisSubFunctions.start(lookahead_conf) text_table_mock.assert_called_once_with( - lookahead_conf, - [lookahead_analysis], - caption=expected_caption_text + lookahead_conf, [lookahead_analysis], caption=expected_caption_text ) @@ -300,7 +289,7 @@ def test_lookahead_helper_text_table_lookahead_analysis_instances__caption( { "name": "strategy_test_v3_with_lookahead_bias", "location": Path(lookahead_conf["strategy_path"], f"{lookahead_conf['strategy']}.py"), - } + }, ) kwargs = {} if caption is not False: