added support to plot any given dataframe column

This commit is contained in:
Gert Wohlgemuth 2018-05-06 16:36:04 -07:00
parent 31e5d4d095
commit d2aca6fab2
2 changed files with 31 additions and 4 deletions

View File

@ -260,8 +260,7 @@ class Arguments(object):
'--stop-loss',
help='Renders stop/loss informations in the main chart',
dest='stoplossdisplay',
default=False,
type=bool
action='store_true'
)
self.parser.add_argument(
@ -285,13 +284,23 @@ class Arguments(object):
default=None
)
self.parser.add_argument(
'--plot-dataframe',
help='Renders the specified dataframes',
dest='plotdataframe',
default=None,
nargs='+',
type=str
)
self.parser.add_argument(
'--plot-volume',
help='plots the volume as a subchart',
dest='plotvolume',
default=False,
type=bool
action='store_true'
)

View File

@ -30,6 +30,20 @@ from freqtrade.configuration import Configuration
logger = logging.getLogger(__name__)
def plot_dataframes(data, fig, args):
"""
plots additional dataframes in the main plot
:param data:
:param fig:
:param args:
:return:
"""
for x in args.plotdataframe:
chart = go.Scattergl(x=data['date'], y=data[x], name=x)
fig.append_trace(chart, 1, 1)
def plot_volume_dataframe(data, fig, args, plotnumber):
"""
adds the plotting of the volume
@ -42,6 +56,7 @@ def plot_volume_dataframe(data, fig, args, plotnumber):
volume = go.Bar(x=data['date'], y=data['volume'], name='Volume')
fig.append_trace(volume, plotnumber, 1)
def plot_macd_dataframe(data, fig, args, plotnumber):
"""
adds the plotting of the MACD if specified
@ -316,6 +331,9 @@ def plot_analyzed_dataframe(args: Namespace) -> None:
# append stop loss/profit
plot_stop_loss_trade(df_sell, fig, analyze, args)
# plot other dataframes
plot_dataframes(data, fig, args)
fig['layout'].update(title=args.pair)
fig['layout']['yaxis1'].update(title='Price')