mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
remove dry_run_db and replace it with db_url in config
This commit is contained in:
parent
8583e89550
commit
58a6f21705
|
@ -95,20 +95,23 @@ class Arguments(object):
|
|||
)
|
||||
self.parser.add_argument(
|
||||
'--dynamic-whitelist',
|
||||
help='dynamically generate and update whitelist \
|
||||
based on 24h BaseVolume (Default 20 currencies)', # noqa
|
||||
help='dynamically generate and update whitelist'
|
||||
' based on 24h BaseVolume (default: %(default)s)',
|
||||
dest='dynamic_whitelist',
|
||||
const=constants.DYNAMIC_WHITELIST,
|
||||
default=constants.DYNAMIC_WHITELIST,
|
||||
type=int,
|
||||
metavar='INT',
|
||||
nargs='?',
|
||||
)
|
||||
self.parser.add_argument(
|
||||
'--dry-run-db',
|
||||
help='Force dry run to use a local DB "tradesv3.dry_run.sqlite" \
|
||||
instead of memory DB. Work only if dry_run is enabled.',
|
||||
action='store_true',
|
||||
dest='dry_run_db',
|
||||
'--db-url',
|
||||
help='Override trades database URL, this is useful if dry_run is enabled'
|
||||
' or in custom deployments (default: %(default)s)',
|
||||
dest='db_url',
|
||||
default=constants.DEFAULT_DB_URL,
|
||||
type=str,
|
||||
metavar='PATH',
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
|
@ -277,13 +280,6 @@ class Arguments(object):
|
|||
default=None
|
||||
)
|
||||
|
||||
self.parser.add_argument(
|
||||
'-db', '--db-url',
|
||||
help='Show trades stored in database.',
|
||||
dest='db_url',
|
||||
default=None
|
||||
)
|
||||
|
||||
def testdata_dl_options(self) -> None:
|
||||
"""
|
||||
Parses given arguments for testdata download
|
||||
|
|
|
@ -97,16 +97,21 @@ class Configuration(object):
|
|||
'(not applicable with Backtesting and Hyperopt)'
|
||||
)
|
||||
|
||||
# Add dry_run_db if found and the bot in dry run
|
||||
if self.args.dry_run_db and config.get('dry_run', False):
|
||||
config.update({'dry_run_db': True})
|
||||
logger.info('Parameter --dry-run-db detected ...')
|
||||
if self.args.db_url and config.get('db_url', None):
|
||||
config.update({'db_url': self.args.db_url})
|
||||
logger.info('Parameter --db-url detected ...')
|
||||
|
||||
if config.get('dry_run_db', False):
|
||||
if config.get('dry_run', False):
|
||||
logger.info('Dry_run will use the DB file: "tradesv3.dry_run.sqlite"')
|
||||
else:
|
||||
logger.info('Dry run is disabled. (--dry_run_db ignored)')
|
||||
if config.get('dry_run', False):
|
||||
logger.info('Dry run is enabled')
|
||||
if config.get('db_url') in [None, constants.DEFAULT_DB_URL]:
|
||||
# Default to in-memory db for dry_run if not specified
|
||||
config['db_url'] = 'sqlite://'
|
||||
else:
|
||||
if not config.get('db_url', None):
|
||||
config['db_url'] = constants.DEFAULT_DB_URL
|
||||
logger.info('Dry run is disabled')
|
||||
|
||||
logger.info('Using DB: "{}"'.format(config['db_url']))
|
||||
|
||||
# Check if the exchange set by the user is supported
|
||||
self.check_exchange(config)
|
||||
|
|
|
@ -9,6 +9,7 @@ TICKER_INTERVAL = 5 # min
|
|||
HYPEROPT_EPOCH = 100 # epochs
|
||||
RETRY_TIMEOUT = 30 # sec
|
||||
DEFAULT_STRATEGY = 'DefaultStrategy'
|
||||
DEFAULT_DB_URL = 'sqlite:///tradesv3.sqlite'
|
||||
|
||||
TICKER_INTERVAL_MINUTES = {
|
||||
'1m': 1,
|
||||
|
@ -83,6 +84,7 @@ CONF_SCHEMA = {
|
|||
},
|
||||
'required': ['enabled', 'token', 'chat_id']
|
||||
},
|
||||
'db_url': {'type': 'string'},
|
||||
'initial_state': {'type': 'string', 'enum': ['running', 'stopped']},
|
||||
'internals': {
|
||||
'type': 'object',
|
||||
|
|
Loading…
Reference in New Issue
Block a user