Merge branch 'develop' of freqtrade into feature/reload-conf

This commit is contained in:
gcarq 2018-06-09 04:30:23 +02:00
commit 61da7f63b2
6 changed files with 11 additions and 17 deletions

View File

@ -248,7 +248,7 @@ class Arguments(object):
:return: Start and End range period :return: Start and End range period
""" """
if text is None: if text is None:
return TimeRange() return TimeRange(None, None, 0, 0)
syntax = [(r'^-(\d{8})$', (None, 'date')), syntax = [(r'^-(\d{8})$', (None, 'date')),
(r'^(\d{8})-$', ('date', None)), (r'^(\d{8})-$', ('date', None)),
(r'^(\d{8})-(\d{8})$', ('date', 'date')), (r'^(\d{8})-(\d{8})$', ('date', 'date')),

View File

@ -61,11 +61,9 @@ class Configuration(object):
with open(path) as file: with open(path) as file:
conf = json.load(file) conf = json.load(file)
except FileNotFoundError: except FileNotFoundError:
logger.critical( raise OperationalException(
'Config file "%s" not found. Please create your config file', 'Config file "{}" not found!'
path ' Please create a config file or check whether it exists.'.format(path))
)
exit(0)
if 'internals' not in conf: if 'internals' not in conf:
conf['internals'] = {} conf['internals'] = {}

View File

@ -277,7 +277,7 @@ def get_ticker(pair: str, refresh: Optional[bool] = True) -> dict:
'bid': float(data['bid']), 'bid': float(data['bid']),
'ask': float(data['ask']), 'ask': float(data['ask']),
} }
except KeyError as e: except KeyError:
logger.debug("Could not cache ticker data for %s", pair) logger.debug("Could not cache ticker data for %s", pair)
return data return data
except (ccxt.NetworkError, ccxt.ExchangeError) as e: except (ccxt.NetworkError, ccxt.ExchangeError) as e:

View File

@ -85,7 +85,7 @@ def load_data(datadir: str,
ticker_interval: str, ticker_interval: str,
pairs: Optional[List[str]] = None, pairs: Optional[List[str]] = None,
refresh_pairs: Optional[bool] = False, refresh_pairs: Optional[bool] = False,
timerange: TimeRange = TimeRange()) -> Dict[str, List]: timerange: TimeRange = TimeRange(None, None, 0, 0)) -> Dict[str, List]:
""" """
Loads ticker history data for the given parameters Loads ticker history data for the given parameters
:return: dict :return: dict
@ -125,7 +125,7 @@ def make_testdata_path(datadir: str) -> str:
def download_pairs(datadir, pairs: List[str], def download_pairs(datadir, pairs: List[str],
ticker_interval: str, ticker_interval: str,
timerange: TimeRange = TimeRange()) -> bool: timerange: TimeRange = TimeRange(None, None, 0, 0)) -> bool:
"""For each pairs passed in parameters, download the ticker intervals""" """For each pairs passed in parameters, download the ticker intervals"""
for pair in pairs: for pair in pairs:
try: try:

View File

@ -85,7 +85,7 @@ def test_load_config_max_open_trades_zero(default_conf, mocker, caplog) -> None:
assert log_has('Validating configuration ...', caplog.record_tuples) assert log_has('Validating configuration ...', caplog.record_tuples)
def test_load_config_file_exception(mocker, caplog) -> None: def test_load_config_file_exception(mocker) -> None:
""" """
Test Configuration._load_config_file() method Test Configuration._load_config_file() method
""" """
@ -95,12 +95,8 @@ def test_load_config_file_exception(mocker, caplog) -> None:
) )
configuration = Configuration(Namespace()) configuration = Configuration(Namespace())
with pytest.raises(SystemExit): with pytest.raises(OperationalException, match=r'.*Config file "somefile" not found!*'):
configuration._load_config_file('somefile') configuration._load_config_file('somefile')
assert log_has(
'Config file "somefile" not found. Please create your config file',
caplog.record_tuples
)
def test_load_config(default_conf, mocker) -> None: def test_load_config(default_conf, mocker) -> None:

View File

@ -93,7 +93,7 @@ def plot_profit(args: Namespace) -> None:
'Impossible to load the strategy. Please check the file "user_data/strategies/%s.py"', 'Impossible to load the strategy. Please check the file "user_data/strategies/%s.py"',
config.get('strategy') config.get('strategy')
) )
exit(0) exit(1)
# Load the profits results # Load the profits results
try: try:
@ -104,7 +104,7 @@ def plot_profit(args: Namespace) -> None:
logger.critical( logger.critical(
'File "backtest-result.json" not found. This script require backtesting ' 'File "backtest-result.json" not found. This script require backtesting '
'results to run.\nPlease run a backtesting with the parameter --export.') 'results to run.\nPlease run a backtesting with the parameter --export.')
exit(0) exit(1)
# Take pairs from the cli otherwise switch to the pair in the config file # Take pairs from the cli otherwise switch to the pair in the config file
if args.pair: if args.pair: