Improve formatting of plotting.py

This commit is contained in:
Matthias 2019-06-30 09:47:07 +02:00
parent 0d5e94b147
commit 348513c151

View File

@ -84,7 +84,7 @@ def add_indicators(fig, row, indicators: List[str], data: pd.DataFrame) -> tools
def plot_trades(fig, trades: pd.DataFrame): def plot_trades(fig, trades: pd.DataFrame):
""" """
Plot trades to "fig" Add trades to "fig"
""" """
# Trades can be empty # Trades can be empty
if trades is not None and len(trades) > 0: if trades is not None and len(trades) > 0:
@ -124,13 +124,9 @@ def plot_trades(fig, trades: pd.DataFrame):
return fig return fig
def generate_candlestick_graph( def generate_candlestick_graph(pair: str, data: pd.DataFrame, trades: pd.DataFrame = None,
pair: str,
data: pd.DataFrame,
trades: pd.DataFrame = None,
indicators1: List[str] = [], indicators1: List[str] = [],
indicators2: List[str] = [], indicators2: List[str] = [],) -> go.Figure:
) -> go.Figure:
""" """
Generate the graph from the data generated by Backtesting or from DB Generate the graph from the data generated by Backtesting or from DB
Volume will always be ploted in row2, so Row 1 and 3 are to our disposal for custom indicators Volume will always be ploted in row2, so Row 1 and 3 are to our disposal for custom indicators
@ -243,6 +239,9 @@ def generate_candlestick_graph(
def generate_plot_filename(pair, ticker_interval) -> str: def generate_plot_filename(pair, ticker_interval) -> str:
"""
Generate filenames per pair/ticker_interval to be used for storing plots
"""
pair_name = pair.replace("/", "_") pair_name = pair.replace("/", "_")
file_name = 'freqtrade-plot-' + pair_name + '-' + ticker_interval + '.html' file_name = 'freqtrade-plot-' + pair_name + '-' + ticker_interval + '.html'