use print for backtest results to avoid odd newline-handling

This commit is contained in:
Matthias 2018-07-29 19:41:39 +02:00
parent c648e2acfc
commit 76fbb89a03

View File

@ -396,46 +396,21 @@ class Backtesting(object):
self._store_backtest_result(self.config['exportfilename'], results, self._store_backtest_result(self.config['exportfilename'], results,
strategy if len(self.strategylist) > 1 else None) strategy if len(self.strategylist) > 1 else None)
logger.info("\nResult for strategy %s", strategy) print(f"Result for strategy {strategy}")
logger.info( print(' BACKTESTING REPORT '.center(119, '='))
'\n' + print(self._generate_text_table(data, results))
' BACKTESTING REPORT '.center(119, '=') +
'\n%s',
self._generate_text_table(
data,
results
)
)
# logger.info(
# results[['sell_reason']].groupby('sell_reason').count()
# )
logger.info( print(' SELL REASON STATS '.center(119, '='))
'\n' + print(self._generate_text_table_sell_reason(data, results))
' SELL REASON STATS '.center(119, '=') +
'\n%s \n',
self._generate_text_table_sell_reason(data, results)
)
logger.info(
'\n' +
' LEFT OPEN TRADES REPORT '.center(119, '=') +
'\n%s',
self._generate_text_table(
data,
results.loc[results.open_at_end]
)
)
print(' LEFT OPEN TRADES REPORT '.center(119, '='))
print(self._generate_text_table(data, results.loc[results.open_at_end]))
print()
if len(all_results) > 1: if len(all_results) > 1:
# Print Strategy summary table # Print Strategy summary table
logger.info( print(' Strategy Summary '.center(119, '='))
'\n' + print(self._generate_text_table_strategy(all_results))
' Strategy Summary '.center(119, '=') + print('\nFor more details, please look at the detail tables above')
'\n%s\n\nFor more details, please look at the detail tables above',
self._generate_text_table_strategy(all_results)
)
def setup_configuration(args: Namespace) -> Dict[str, Any]: def setup_configuration(args: Namespace) -> Dict[str, Any]: