fixed error checking
This commit is contained in:
parent
a82b87fcae
commit
021791e2c8
@ -128,9 +128,9 @@ def load_pair_history(pair: str,
|
||||
drop_incomplete=drop_incomplete)
|
||||
else:
|
||||
logger.warning(
|
||||
f'No history data for pair: "{pair}", interval: {ticker_interval}. '
|
||||
'Use --refresh-pairs-cached option or `freqtrade download-data` '
|
||||
'script to download the data'
|
||||
f'No history data for pair: "{pair}", interval: {ticker_interval}, in {datadir}. '
|
||||
'Provide the correct path to datadir in config.json, or download data with '
|
||||
'--refresh-pairs-cached option or `freqtrade download-data`. '
|
||||
)
|
||||
return None
|
||||
|
||||
|
@ -3,7 +3,6 @@ Various tool function for Freqtrade and scripts
|
||||
"""
|
||||
import gzip
|
||||
import logging
|
||||
from os import chdir
|
||||
import re
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
@ -115,23 +114,3 @@ def deep_merge_dicts(source, destination):
|
||||
destination[key] = value
|
||||
|
||||
return destination
|
||||
|
||||
|
||||
def find_project_root(path=None):
|
||||
"""Locates root directory of the project.
|
||||
Root is defined by existence of "LICENSE" and the dir 'freqtrade'.
|
||||
:param path: pathlib.Path object, or string pointing to project root directory.
|
||||
:return: path to project root directory
|
||||
"""
|
||||
if path is None:
|
||||
path = Path(__file__).parent
|
||||
i = 0
|
||||
try:
|
||||
chdir(path)
|
||||
assert Path('LICENSE').is_file() and Path('freqtrade').exists()
|
||||
except AssertionError:
|
||||
while i < 5 and not (Path(path, 'LICENSE').is_file() and Path(path, 'freqtrade').exists()):
|
||||
path = Path(path).parent
|
||||
i += 1
|
||||
logger.info(f'project_root is {path}')
|
||||
return path
|
||||
|
@ -3,7 +3,7 @@ from pathlib import Path
|
||||
from typing import Any, Dict, List
|
||||
|
||||
import pandas as pd
|
||||
|
||||
from freqtrade import OperationalException
|
||||
from freqtrade.configuration import TimeRange
|
||||
from freqtrade.data import history
|
||||
from freqtrade.data.btanalysis import (combine_tickers_with_mean,
|
||||
@ -33,24 +33,29 @@ def init_plotscript(config):
|
||||
pairs = config["pairs"]
|
||||
else:
|
||||
pairs = config["exchange"]["pair_whitelist"]
|
||||
assert pairs is not None, ('No pairs available in config.')
|
||||
if pairs is None:
|
||||
raise OperationalException('No pairs available in config.')
|
||||
|
||||
# Set timerange to use
|
||||
timerange = TimeRange.parse_timerange(config.get("timerange"))
|
||||
if timerange is None:
|
||||
raise OperationalException('Could not parse timerange in config.')
|
||||
|
||||
tickers = history.load_data(
|
||||
datadir=Path(config.get("datadir"), config.get("exchange").get("name")),
|
||||
datadir=Path(str(config.get("datadir"))),
|
||||
pairs=pairs,
|
||||
ticker_interval=config.get('ticker_interval', '5m'),
|
||||
timerange=timerange,
|
||||
)
|
||||
assert tickers is not None, ('No ticker data available as specified in config.')
|
||||
if tickers is None:
|
||||
raise OperationalException('No ticker data available as specified in config.')
|
||||
|
||||
trades = load_trades(config['trade_source'],
|
||||
db_url=config.get('db_url'),
|
||||
exportfilename=config.get('exportfilename'),
|
||||
)
|
||||
assert trades is not None, ('No trades available as specified in config.')
|
||||
if trades is None:
|
||||
raise OperationalException('No trades available as specified in config.')
|
||||
|
||||
return {"tickers": tickers,
|
||||
"trades": trades,
|
||||
@ -342,9 +347,9 @@ def load_and_plot_trades(config: Dict[str, Any]):
|
||||
|
||||
plot_elements = init_plotscript(config)
|
||||
trades = plot_elements['trades']
|
||||
if trades is None:
|
||||
raise ValueError('No trades to analyze')
|
||||
else:
|
||||
# if trades is None:
|
||||
# # raise ValueError('No trades to analyze')
|
||||
# else:
|
||||
pair_counter = 0
|
||||
for pair, data in plot_elements["tickers"].items():
|
||||
pair_counter += 1
|
||||
|
Loading…
Reference in New Issue
Block a user