use list comprehension to build list

This commit is contained in:
xmatthias 2018-06-13 19:53:12 +02:00
parent e600be4f56
commit c0289ad844

View File

@ -114,14 +114,11 @@ class Backtesting(object):
def _store_backtest_result(self, recordfilename: Optional[str], results: DataFrame) -> None: def _store_backtest_result(self, recordfilename: Optional[str], results: DataFrame) -> None:
records = [] records = [(trade_entry.pair, trade_entry.profit_percent,
print(results) trade_entry.open_time.timestamp(),
for index, trade_entry in results.iterrows(): trade_entry.close_time.timestamp(),
pass trade_entry.open_index - 1, trade_entry.trade_duration)
records.append((trade_entry.pair, trade_entry.profit_percent, for index, trade_entry in results.iterrows()]
trade_entry.open_time.timestamp(),
trade_entry.close_time.timestamp(),
trade_entry.open_index - 1, trade_entry.trade_duration))
if records: if records:
logger.info('Dumping backtest results to %s', recordfilename) logger.info('Dumping backtest results to %s', recordfilename)