cleanup plot scripts

This commit is contained in:
Janne Sinivirta 2018-02-08 13:32:34 +02:00
parent aa7aeb046e
commit 6f80aff3e2
2 changed files with 15 additions and 35 deletions

View File

@ -2,24 +2,15 @@
import sys import sys
import logging import logging
import argparse
import os
from pandas import DataFrame
import talib.abstract as ta
import plotly
from plotly import tools from plotly import tools
from plotly.offline import plot from plotly.offline import plot
import plotly.graph_objs as go import plotly.graph_objs as go
import freqtrade.vendor.qtpylib.indicators as qtpylib
from freqtrade import exchange, analyze from freqtrade import exchange, analyze
from freqtrade.misc import common_args_parser
from freqtrade.strategy.strategy import Strategy from freqtrade.strategy.strategy import Strategy
import freqtrade.misc as misc import freqtrade.misc as misc
import freqtrade.optimize as optimize import freqtrade.optimize as optimize
import freqtrade.analyze as analyze
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -61,18 +52,17 @@ def plot_analyzed_dataframe(args) -> None:
dataframe = dataframes[pair] dataframe = dataframes[pair]
dataframe = analyze.populate_buy_trend(dataframe) dataframe = analyze.populate_buy_trend(dataframe)
dataframe = analyze.populate_sell_trend(dataframe) dataframe = analyze.populate_sell_trend(dataframe)
dates = misc.datesarray_to_datetimearray(dataframe['date'])
if (len(dataframe.index) > 750): if (len(dataframe.index) > 750):
logger.warn('Ticker contained more than 750 candles, clipping.') logger.warn('Ticker contained more than 750 candles, clipping.')
df = dataframe.tail(750) df = dataframe.tail(750)
candles = go.Candlestick(x=df.date, candles = go.Candlestick(x=df.date,
open=df.open, open=df.open,
high=df.high, high=df.high,
low=df.low, low=df.low,
close=df.close, close=df.close,
name='Price') name='Price')
df_buy = df[df['buy'] == 1] df_buy = df[df['buy'] == 1]
buys = go.Scattergl( buys = go.Scattergl(
@ -116,28 +106,20 @@ def plot_analyzed_dataframe(args) -> None:
y=df.bb_upperband, y=df.bb_upperband,
name='BB upper', name='BB upper',
fill="tonexty", fill="tonexty",
fillcolor="rgba(0,176,246,0.2)", fillcolor="rgba(0,176,246,0.2)",
line={'color': "transparent"}, line={'color': "transparent"},
) )
macd = go.Scattergl(x=df['date'], y=df['macd'], name='MACD')
macdsignal = go.Scattergl(x=df['date'], y=df['macdsignal'], name='MACD signal')
volume = go.Bar(x=df['date'], y=df['volume'], name='Volume')
macd = go.Scattergl( fig = tools.make_subplots(
x=df['date'], rows=3,
y=df['macd'], cols=1,
name='MACD' shared_xaxes=True,
row_width=[1, 1, 4],
vertical_spacing=0.0001,
) )
macdsignal = go.Scattergl(
x=df['date'],
y=df['macdsignal'],
name='MACD signal'
)
volume = go.Bar(
x=df['date'],
y=df['volume'],
name='Volume'
)
fig = tools.make_subplots(rows=3, cols=1, shared_xaxes=True, row_width=[1, 1, 4],vertical_spacing=0.0001)
fig.append_trace(candles, 1, 1) fig.append_trace(candles, 1, 1)
fig.append_trace(bb_lower, 1, 1) fig.append_trace(bb_lower, 1, 1)

View File

@ -4,14 +4,12 @@ import sys
import json import json
import numpy as np import numpy as np
import plotly
from plotly import tools from plotly import tools
from plotly.offline import plot from plotly.offline import plot
import plotly.graph_objs as go import plotly.graph_objs as go
import freqtrade.optimize as optimize import freqtrade.optimize as optimize
import freqtrade.misc as misc import freqtrade.misc as misc
import freqtrade.exchange as exchange
from freqtrade.strategy.strategy import Strategy from freqtrade.strategy.strategy import Strategy