This commit is contained in:
Alocaly 2018-05-14 05:04:01 +00:00 committed by GitHub
commit d3fb25c6ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4970 additions and 13 deletions

File diff suppressed because one or more lines are too long

View File

@ -196,21 +196,22 @@ class Backtesting(object):
if ret: if ret:
row2, trade_entry, next_date = ret row2, trade_entry, next_date = ret
lock_pair_until = next_date lock_pair_until = next_date
trade_entry = trade_entry + ( next_date,)
trades.append(trade_entry) trades.append(trade_entry)
if record: if record:
# Note, need to be json.dump friendly # Note, need to be json.dump friendly
# record a tuple of pair, current_profit_percent, # record a tuple of pair, current_profit_percent,
# entry-date, duration # entry-date, duration
records.append((pair, trade_entry[1], records.append((pair, trade_entry[1],
row.date.strftime('%s'), str(int(row.date.timestamp())),
row2.date.strftime('%s'), str(int(row2.date.timestamp())),
index, trade_entry[3])) index, trade_entry[3]))
# For now export inside backtest(), maybe change so that backtest() # For now export inside backtest(), maybe change so that backtest()
# returns a tuple like: (dataframe, records, logs, etc) # returns a tuple like: (dataframe, records, logs, etc)
if record and record.find('trades') >= 0: if record and record.find('trades') >= 0:
logger.info('Dumping backtest results') logger.info('Dumping backtest results')
file_dump_json('backtest-result.json', records) file_dump_json('backtest-result.json', records)
labels = ['currency', 'profit_percent', 'profit_BTC', 'duration'] labels = ['currency', 'profit_percent', 'profit_BTC', 'duration', 'sell_date']
return DataFrame.from_records(trades, columns=labels) return DataFrame.from_records(trades, columns=labels)
def start(self) -> None: def start(self) -> None:

View File

@ -27,11 +27,7 @@ from freqtrade import exchange
import freqtrade.optimize as optimize import freqtrade.optimize as optimize
<<<<<<< HEAD
logger = logging.getLogger('freqtrade')
=======
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
>>>>>>> bddf009a2b6d0e1a19cca558887ce972e99a6238
def plot_analyzed_dataframe(args: Namespace) -> None: def plot_analyzed_dataframe(args: Namespace) -> None:
@ -87,7 +83,7 @@ def plot_analyzed_dataframe(args: Namespace) -> None:
) )
df_buy = data[data['buy'] == 1] df_buy = data[data['buy'] == 1]
buys = go.Scattergl( buys = go.Scatter(
x=df_buy.date, x=df_buy.date,
y=df_buy.close, y=df_buy.close,
mode='markers', mode='markers',
@ -100,7 +96,7 @@ def plot_analyzed_dataframe(args: Namespace) -> None:
) )
) )
df_sell = data[data['sell'] == 1] df_sell = data[data['sell'] == 1]
sells = go.Scattergl( sells = go.Scatter(
x=df_sell.date, x=df_sell.date,
y=df_sell.close, y=df_sell.close,
mode='markers', mode='markers',

View File

@ -24,7 +24,7 @@ import plotly.graph_objs as go
from freqtrade.arguments import Arguments from freqtrade.arguments import Arguments
from freqtrade.configuration import Configuration from freqtrade.configuration import Configuration
from freqtrade.analyze import Analyze from freqtrade.analyze import Analyze
from freqtradeimport constants from freqtrade import constants
import freqtrade.optimize as optimize 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 # Plot the pairs average close prices, and total profit growth
# #
avgclose = go.Scattergl( avgclose = go.Scatter(
x=dates, x=dates,
y=avgclose, y=avgclose,
name='Avg close price', name='Avg close price',
) )
profit = go.Scattergl( profit = go.Scatter(
x=dates, x=dates,
y=pg, y=pg,
name='Profit', name='Profit',
@ -177,7 +177,7 @@ def plot_profit(args: Namespace) -> None:
for pair in pairs: for pair in pairs:
pg = make_profit_array(data, num_iterations, min_date, tick_interval, pair) pg = make_profit_array(data, num_iterations, min_date, tick_interval, pair)
pair_profit = go.Scattergl( pair_profit = go.Scatter(
x=dates, x=dates,
y=pg, y=pg,
name=pair, name=pair,