Fix wrong backtest duration

identified in #1038
This commit is contained in:
Matthias
2018-07-18 09:06:12 +02:00
committed by GitHub
parent 5b3fa3c635
commit 08237abe20

View File

@@ -159,7 +159,7 @@ class Backtesting(object):
profit_abs=trade.calc_profit(rate=sell_row.open), profit_abs=trade.calc_profit(rate=sell_row.open),
open_time=buy_row.date, open_time=buy_row.date,
close_time=sell_row.date, close_time=sell_row.date,
trade_duration=(sell_row.date - buy_row.date).seconds // 60, trade_duration=(sell_row.date - buy_row.date).total_seconds() // 60,
open_index=buy_row.Index, open_index=buy_row.Index,
close_index=sell_row.Index, close_index=sell_row.Index,
open_at_end=False, open_at_end=False,
@@ -174,7 +174,7 @@ class Backtesting(object):
profit_abs=trade.calc_profit(rate=sell_row.open), profit_abs=trade.calc_profit(rate=sell_row.open),
open_time=buy_row.date, open_time=buy_row.date,
close_time=sell_row.date, close_time=sell_row.date,
trade_duration=(sell_row.date - buy_row.date).seconds // 60, trade_duration=(sell_row.date - buy_row.date)..total_seconds() // 60,
open_index=buy_row.Index, open_index=buy_row.Index,
close_index=sell_row.Index, close_index=sell_row.Index,
open_at_end=True, open_at_end=True,