More lint fixes (#198)

* autopep fixes

* remove unused imports

* fix plot_dataframe.py lint warnings

* make pep8 error fails the build

* two more line breakings

* matplotlib.use() must be called before pyplot import
This commit is contained in:
Janne Sinivirta
2017-12-18 18:36:00 +02:00
committed by Michael Egger
parent 1a556198b2
commit c8fb6c4661
9 changed files with 26 additions and 27 deletions

View File

@@ -13,7 +13,8 @@ from freqtrade.analyze import populate_indicators, parse_ticker_dataframe
logger = logging.getLogger(__name__)
def load_data(pairs: List[str], ticker_interval: int = 5, refresh_pairs: Optional[bool] = False) -> Dict[str, List]:
def load_data(pairs: List[str], ticker_interval: int = 5,
refresh_pairs: Optional[bool] = False) -> Dict[str, List]:
"""
Loads ticker history data for the given parameters
:param ticker_interval: ticker interval in minutes
@@ -61,10 +62,10 @@ def download_pairs(pairs: List[str]) -> bool:
"""For each pairs passed in parameters, download 1 and 5 ticker intervals"""
for pair in pairs:
try:
for interval in [1,5]:
for interval in [1, 5]:
download_backtesting_testdata(pair=pair, interval=interval)
except BaseException:
logger.info('Impossible to download the pair: "{pair}", Interval: {interval} min'.format(
logger.info('Failed to download the pair: "{pair}", Interval: {interval} min'.format(
pair=pair,
interval=interval,
))
@@ -103,7 +104,7 @@ def download_backtesting_testdata(pair: str, interval: int = 5) -> bool:
logger.debug("Current Start: None")
logger.debug("Current End: None")
new_data = get_ticker_history(pair = pair, tick_interval = int(interval))
new_data = get_ticker_history(pair=pair, tick_interval=int(interval))
for row in new_data:
if row not in data:
data.append(row)

View File

@@ -140,7 +140,8 @@ def start(args):
data[pair] = exchange.get_ticker_history(pair, args.ticker_interval)
else:
logger.info('Using local backtesting data (using whitelist in given config) ...')
data = load_data(pairs=pairs, ticker_interval=args.ticker_interval, refresh_pairs=args.refresh_pairs)
data = load_data(pairs=pairs, ticker_interval=args.ticker_interval,
refresh_pairs=args.refresh_pairs)
logger.info('Using stake_currency: %s ...', config['stake_currency'])
logger.info('Using stake_amount: %s ...', config['stake_amount'])

View File

@@ -150,7 +150,7 @@ def optimizer(params):
'total_tries': TOTAL_TRIES,
'result': result,
'results': results
}
}
# logger.info('{:5d}/{}: {}'.format(_CURRENT_TRIES, TOTAL_TRIES, result))
log_results(result_data)
@@ -169,7 +169,7 @@ def format_results(results: DataFrame):
results.profit.mean() * 100.0,
results.profit.sum(),
results.duration.mean() * 5,
)
)
def buy_strategy_generator(params):
@@ -232,7 +232,8 @@ def start(args):
logger.info('Using config: %s ...', args.config)
config = load_config(args.config)
pairs = config['exchange']['pair_whitelist']
PROCESSED = optimize.preprocess(optimize.load_data(pairs=pairs, ticker_interval=args.ticker_interval))
PROCESSED = optimize.preprocess(optimize.load_data(
pairs=pairs, ticker_interval=args.ticker_interval))
if args.mongodb:
logger.info('Using mongodb ...')