Merge pull request #131 from gcarq/feature/backtesting-max-open-trades

implement trade count lock for backtesting
This commit is contained in:
Janne Sinivirta
2017-11-23 16:16:43 +02:00
committed by GitHub
5 changed files with 48 additions and 10 deletions

View File

@@ -146,6 +146,12 @@ def build_subcommands(parser: argparse.ArgumentParser) -> None:
type=int,
metavar='INT',
)
backtest.add_argument(
'--limit-max-trades',
help='uses max_open_trades from config to simulate real world limitations',
action='store_true',
dest='limit_max_trades',
)
def start_backtesting(args) -> None:
@@ -161,6 +167,7 @@ def start_backtesting(args) -> None:
'BACKTEST_LIVE': 'true' if args.live else '',
'BACKTEST_CONFIG': args.config,
'BACKTEST_TICKER_INTERVAL': str(args.ticker_interval),
'BACKTEST_LIMIT_MAX_TRADES': 'true' if args.limit_max_trades else '',
})
path = os.path.join(os.path.dirname(__file__), 'tests', 'test_backtesting.py')
pytest.main(['-s', path])