From cf044d166edc68ba427d8c3b86f13ebb252a490b Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 9 Jun 2020 08:14:18 +0200 Subject: [PATCH] Tests should use new Datetime format too --- freqtrade/optimize/optimize_reports.py | 4 ++-- tests/optimize/test_backtesting.py | 28 +++++++++++++------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/freqtrade/optimize/optimize_reports.py b/freqtrade/optimize/optimize_reports.py index 6efda2956..1e2d41e32 100644 --- a/freqtrade/optimize/optimize_reports.py +++ b/freqtrade/optimize/optimize_reports.py @@ -250,9 +250,9 @@ def generate_backtest_stats(config: Dict, btdata: Dict[str, DataFrame], strat_stats.update({ 'max_drawdown': 0.0, 'drawdown_start': datetime.min, - 'drawdown_start_ts': datetime.min.timestamp(), + 'drawdown_start_ts': datetime(1970, 1, 1).timestamp(), 'drawdown_end': datetime.min, - 'drawdown_end_ts': datetime.min.timestamp(), + 'drawdown_end_ts': datetime(1970, 1, 1).timestamp(), }) strategy_results = generate_strategy_metrics(stake_currency=stake_currency, diff --git a/tests/optimize/test_backtesting.py b/tests/optimize/test_backtesting.py index 67da38648..853780b82 100644 --- a/tests/optimize/test_backtesting.py +++ b/tests/optimize/test_backtesting.py @@ -349,8 +349,8 @@ def test_backtesting_start(default_conf, mocker, testdatadir, caplog) -> None: exists = [ 'Using stake_currency: BTC ...', 'Using stake_amount: 0.001 ...', - 'Backtesting with data from 2017-11-14T21:17:00+00:00 ' - 'up to 2017-11-14T22:59:00+00:00 (0 days)..' + 'Backtesting with data from 2017-11-14 21:17:00 ' + 'up to 2017-11-14 22:59:00 (0 days)..' ] for line in exists: assert log_has(line, caplog) @@ -672,10 +672,10 @@ def test_backtest_start_timerange(default_conf, mocker, caplog, testdatadir): f'Using data directory: {testdatadir} ...', 'Using stake_currency: BTC ...', 'Using stake_amount: 0.001 ...', - 'Loading data from 2017-11-14T20:57:00+00:00 ' - 'up to 2017-11-14T22:58:00+00:00 (0 days)..', - 'Backtesting with data from 2017-11-14T21:17:00+00:00 ' - 'up to 2017-11-14T22:58:00+00:00 (0 days)..', + 'Loading data from 2017-11-14 20:57:00 ' + 'up to 2017-11-14 22:58:00 (0 days)..', + 'Backtesting with data from 2017-11-14 21:17:00 ' + 'up to 2017-11-14 22:58:00 (0 days)..', 'Parameter --enable-position-stacking detected ...' ] @@ -735,10 +735,10 @@ def test_backtest_start_multi_strat(default_conf, mocker, caplog, testdatadir): f'Using data directory: {testdatadir} ...', 'Using stake_currency: BTC ...', 'Using stake_amount: 0.001 ...', - 'Loading data from 2017-11-14T20:57:00+00:00 ' - 'up to 2017-11-14T22:58:00+00:00 (0 days)..', - 'Backtesting with data from 2017-11-14T21:17:00+00:00 ' - 'up to 2017-11-14T22:58:00+00:00 (0 days)..', + 'Loading data from 2017-11-14 20:57:00 ' + 'up to 2017-11-14 22:58:00 (0 days)..', + 'Backtesting with data from 2017-11-14 21:17:00 ' + 'up to 2017-11-14 22:58:00 (0 days)..', 'Parameter --enable-position-stacking detected ...', 'Running backtesting for Strategy DefaultStrategy', 'Running backtesting for Strategy TestStrategyLegacy', @@ -818,10 +818,10 @@ def test_backtest_start_multi_strat_nomock(default_conf, mocker, caplog, testdat f'Using data directory: {testdatadir} ...', 'Using stake_currency: BTC ...', 'Using stake_amount: 0.001 ...', - 'Loading data from 2017-11-14T20:57:00+00:00 ' - 'up to 2017-11-14T22:58:00+00:00 (0 days)..', - 'Backtesting with data from 2017-11-14T21:17:00+00:00 ' - 'up to 2017-11-14T22:58:00+00:00 (0 days)..', + 'Loading data from 2017-11-14 20:57:00 ' + 'up to 2017-11-14 22:58:00 (0 days)..', + 'Backtesting with data from 2017-11-14 21:17:00 ' + 'up to 2017-11-14 22:58:00 (0 days)..', 'Parameter --enable-position-stacking detected ...', 'Running backtesting for Strategy DefaultStrategy', 'Running backtesting for Strategy TestStrategyLegacy',