Introduce pair_to_filename()

This commit is contained in:
hroff-1902 2020-01-04 05:07:51 +03:00 committed by Matthias
parent f82c4346b6
commit bc6a10353b
2 changed files with 13 additions and 5 deletions

View File

@ -92,6 +92,12 @@ def file_load_json(file):
return pairdata
def pair_to_filename(pair: str) -> str:
for ch in ['/', ' ', '.']:
pair = pair.replace(ch, '_')
return pair
def format_ms_time(date: int) -> str:
"""
convert MS date to readable format.

View File

@ -3,12 +3,14 @@ from pathlib import Path
from typing import Any, Dict, List
import pandas as pd
from freqtrade.configuration import TimeRange
from freqtrade.data import history
from freqtrade.data.converter import trim_dataframe
from freqtrade.data.btanalysis import (combine_tickers_with_mean,
create_cum_profit,
extract_trades_of_period, load_trades)
from freqtrade.data.converter import trim_dataframe
from freqtrade.data.history import load_data
from freqtrade.misc import pair_to_filename
from freqtrade.resolvers import StrategyResolver
logger = logging.getLogger(__name__)
@ -37,7 +39,7 @@ def init_plotscript(config):
# Set timerange to use
timerange = TimeRange.parse_timerange(config.get("timerange"))
tickers = history.load_data(
tickers = load_data(
datadir=config.get("datadir"),
pairs=pairs,
timeframe=config.get('ticker_interval', '5m'),
@ -306,8 +308,8 @@ def generate_plot_filename(pair, timeframe) -> str:
"""
Generate filenames per pair/timeframe to be used for storing plots
"""
pair_name = pair.replace("/", "_")
file_name = 'freqtrade-plot-' + pair_name + '-' + timeframe + '.html'
pair_s = pair_to_filename(pair)
file_name = 'freqtrade-plot-' + pair_s + '-' + timeframe + '.html'
logger.info('Generate plot file for %s', pair)