In backtesting, ensure we don't buy the same pair again before selling (#139)

* in backtesting, ensure we don't buy before we sell

* no overlapping trades only if max_open_trades > 0

* --limit-max-trades now --realistic-simulation
This commit is contained in:
Mathieu Favréaux
2017-11-24 20:09:44 +00:00
committed by Michael Egger
parent cfbfe90aa0
commit 371ee1e457
3 changed files with 15 additions and 8 deletions

View File

@@ -109,7 +109,7 @@ def test_start_backtesting(mocker):
live=True,
loglevel=20,
ticker_interval=1,
limit_max_trades=True,
realistic_simulation=True,
)
start_backtesting(args)
assert env_mock == {
@@ -117,7 +117,7 @@ def test_start_backtesting(mocker):
'BACKTEST_LIVE': 'true',
'BACKTEST_CONFIG': 'config.json',
'BACKTEST_TICKER_INTERVAL': '1',
'BACKTEST_LIMIT_MAX_TRADES': 'true',
'BACKTEST_REALISTIC_SIMULATION': 'true',
}
assert pytest_mock.call_count == 1