From d046b7dd36cdda7936c917e6069c0a029179c56b Mon Sep 17 00:00:00 2001 From: NewLaptopMSI_Manu Date: Sun, 13 May 2018 13:11:30 +0200 Subject: [PATCH] Fix Plot dataframe and plot profit --- freqtrade/optimize/backtesting.py | 4 ++-- scripts/plot_dataframe.py | 8 ++------ scripts/plot_profit.py | 8 ++++---- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 376730d0f..3e6dba847 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -202,8 +202,8 @@ class Backtesting(object): # record a tuple of pair, current_profit_percent, # entry-date, duration records.append((pair, trade_entry[1], - row.date.strftime('%s'), - row2.date.strftime('%s'), + str(int(row.date.timestamp())), + str(int(row2.date.timestamp())), index, trade_entry[3])) # For now export inside backtest(), maybe change so that backtest() # returns a tuple like: (dataframe, records, logs, etc) diff --git a/scripts/plot_dataframe.py b/scripts/plot_dataframe.py index 5e533a030..a1d54a389 100755 --- a/scripts/plot_dataframe.py +++ b/scripts/plot_dataframe.py @@ -27,11 +27,7 @@ from freqtrade import exchange import freqtrade.optimize as optimize -<<<<<<< HEAD -logger = logging.getLogger('freqtrade') -======= logger = logging.getLogger(__name__) ->>>>>>> bddf009a2b6d0e1a19cca558887ce972e99a6238 def plot_analyzed_dataframe(args: Namespace) -> None: @@ -87,7 +83,7 @@ def plot_analyzed_dataframe(args: Namespace) -> None: ) df_buy = data[data['buy'] == 1] - buys = go.Scattergl( + buys = go.Scatter( x=df_buy.date, y=df_buy.close, mode='markers', @@ -100,7 +96,7 @@ def plot_analyzed_dataframe(args: Namespace) -> None: ) ) df_sell = data[data['sell'] == 1] - sells = go.Scattergl( + sells = go.Scatter( x=df_sell.date, y=df_sell.close, mode='markers', diff --git a/scripts/plot_profit.py b/scripts/plot_profit.py index c1e1d068f..0bf805bfe 100755 --- a/scripts/plot_profit.py +++ b/scripts/plot_profit.py @@ -24,7 +24,7 @@ import plotly.graph_objs as go from freqtrade.arguments import Arguments from freqtrade.configuration import Configuration from freqtrade.analyze import Analyze -from freqtradeimport constants +from freqtrade import constants import freqtrade.optimize as optimize @@ -158,13 +158,13 @@ def plot_profit(args: Namespace) -> None: # Plot the pairs average close prices, and total profit growth # - avgclose = go.Scattergl( + avgclose = go.Scatter( x=dates, y=avgclose, name='Avg close price', ) - profit = go.Scattergl( + profit = go.Scatter( x=dates, y=pg, name='Profit', @@ -177,7 +177,7 @@ def plot_profit(args: Namespace) -> None: for pair in pairs: pg = make_profit_array(data, num_iterations, min_date, tick_interval, pair) - pair_profit = go.Scattergl( + pair_profit = go.Scatter( x=dates, y=pg, name=pair,