combine shared backtest/hyperopt flags

This commit is contained in:
Janne Sinivirta 2018-02-15 15:23:49 +02:00
parent f64c8cc9ce
commit ec8bf82695

View File

@ -207,13 +207,7 @@ def scripts_options(parser: argparse.ArgumentParser) -> None:
)
def backtesting_options(parser: argparse.ArgumentParser) -> None:
parser.add_argument(
'-l', '--live',
action='store_true',
dest='live',
help='using live data',
)
def optimizer_shared_options(parser: argparse.ArgumentParser) -> None:
parser.add_argument(
'-i', '--ticker-interval',
help='specify ticker interval in minutes (1, 5, 30, 60, 1440)',
@ -227,6 +221,22 @@ def backtesting_options(parser: argparse.ArgumentParser) -> None:
action='store_true',
dest='realistic_simulation',
)
parser.add_argument(
'--timerange',
help='Specify what timerange of data to use.',
default=None,
type=str,
dest='timerange',
)
def backtesting_options(parser: argparse.ArgumentParser) -> None:
parser.add_argument(
'-l', '--live',
action='store_true',
dest='live',
help='using live data',
)
parser.add_argument(
'-r', '--refresh-pairs-cached',
help='refresh the pairs files in tests/testdata with the latest data from Bittrex. \
@ -242,13 +252,6 @@ def backtesting_options(parser: argparse.ArgumentParser) -> None:
default=None,
dest='export',
)
parser.add_argument(
'--timerange',
help='Specify what timerange of data to use.',
default=None,
type=str,
dest='timerange',
)
def hyperopt_options(parser: argparse.ArgumentParser) -> None:
@ -266,20 +269,6 @@ def hyperopt_options(parser: argparse.ArgumentParser) -> None:
dest='mongodb',
action='store_true',
)
parser.add_argument(
'-i', '--ticker-interval',
help='specify ticker interval in minutes (1, 5, 30, 60, 1440)',
dest='ticker_interval',
type=int,
metavar='INT',
)
parser.add_argument(
'--timerange',
help='Specify what timerange of data to use.',
default=None,
type=str,
dest='timerange',
)
parser.add_argument(
'-s', '--spaces',
help='Specify which parameters to hyperopt. Space separate list. \
@ -330,11 +319,13 @@ def build_subcommands(parser: argparse.ArgumentParser) -> None:
# Add backtesting subcommand
backtesting_cmd = subparsers.add_parser('backtesting', help='backtesting module')
backtesting_cmd.set_defaults(func=backtesting.start)
optimizer_shared_options(backtesting_cmd)
backtesting_options(backtesting_cmd)
# Add hyperopt subcommand
hyperopt_cmd = subparsers.add_parser('hyperopt', help='hyperopt module')
hyperopt_cmd.set_defaults(func=hyperopt.start)
optimizer_shared_options(hyperopt_cmd)
hyperopt_options(hyperopt_cmd)