nautilus_trader icon indicating copy to clipboard operation
nautilus_trader copied to clipboard

Format error outputs for BacktestNode exceptions

Open kbs-code opened this issue 1 year ago • 1 comments

Feature Request

Code reference: https://github.com/nautechsystems/nautilus_trader/blob/master/nautilus_trader/backtest/node.py

I was trying to run a high-level backtest and saw some output in the terminal. Most of it was formatted fine except for one block of text. Node.py is printing my configs unformatted when I misconfigured something in my backtest. This makes it harder to read error output and debug my backtests. This seems to be coming from lines 129-142 of Node.py:

         for config in self._configs:
            try:
                result = self._run(
                    run_config_id=config.id,
                    engine_config=config.engine,
                    venue_configs=config.venues,
                    data_configs=config.data,
                    batch_size_bytes=config.batch_size_bytes,
                )
                results.append(result)
            except Exception as e:
                # Broad catch all prevents a single backtest run from halting
                # the execution of the other backtests (such as a zero balance exception).
                print(f"Error running {config}: {e}")

I tried formatting the output on my end using various try/except statements, but none improved it.
backtest_error_output

kbs-code avatar Dec 03 '23 12:12 kbs-code

Thanks for the feedback and taking the time to post the issue @kbs-code :pray:

cjdsellers avatar Dec 03 '23 20:12 cjdsellers