Improve output if a strategy wasn't found in the backtest result

This commit is contained in:
Matthias
2023-12-19 06:30:40 +01:00
parent 0333abcbdc
commit c9a018cf0e

View File

@@ -326,7 +326,10 @@ def load_backtest_data(filename: Union[Path, str], strategy: Optional[str] = Non
"Please specify a strategy.")
if strategy not in data['strategy']:
raise ValueError(f"Strategy {strategy} not available in the backtest result.")
raise ValueError(
f"Strategy {strategy} not available in the backtest result. "
f"Available strategies are '{','.join(data['strategy'].keys())}'"
)
data = data['strategy'][strategy]['trades']
df = pd.DataFrame(data)