added support to defined custom clipping

This commit is contained in:
Gert Wohlgemuth 2018-05-06 17:32:24 -07:00
parent d2aca6fab2
commit f420994006
2 changed files with 26 additions and 6 deletions

View File

@ -291,7 +291,16 @@ class Arguments(object):
default=None,
nargs='+',
type=str
)
self.parser.add_argument(
'--plot-dataframe-marker',
help='Renders the specified dataframes as markers',
dest='plotdataframemarker',
default=None,
nargs='+',
type=str
)
self.parser.add_argument(
@ -302,5 +311,12 @@ class Arguments(object):
)
self.parser.add_argument(
'--plot-max-ticks',
help='specify an upper limit of how many ticks we can display',
dest='plotticks',
default=750,
type=int
)

View File

@ -39,9 +39,10 @@ def plot_dataframes(data, fig, args):
:return:
"""
for x in args.plotdataframe:
chart = go.Scattergl(x=data['date'], y=data[x], name=x)
fig.append_trace(chart, 1, 1)
if args.plotdataframe:
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):
@ -114,6 +115,9 @@ def plot_stop_loss_trade(df_sell, fig, analyze, args):
if args.stoplossdisplay is False:
return
if 'associated_buy_price' not in df_sell:
return
stoploss = analyze.strategy.stoploss
for index, x in df_sell.iterrows():
@ -231,9 +235,9 @@ def plot_analyzed_dataframe(args: Namespace) -> None:
dataframe = analyze.populate_buy_trend(dataframe)
dataframe = analyze.populate_sell_trend(dataframe)
if len(dataframe.index) > 750:
logger.warning('Ticker contained more than 750 candles, clipping.')
data = dataframe.tail(750)
if len(dataframe.index) > args.plotticks:
logger.warning('Ticker contained more than {} candles, clipping.'.format(args.plotticks))
data = dataframe.tail(args.plotticks)
candles = go.Candlestick(
x=data.date,