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:
row2, trade_entry, next_date = ret
lock_pair_until = next_date
trade_entry = trade_entry + ( next_date,)
trades.append(trade_entry)
if record:
# Note, need to be json.dump friendly
# 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)
if record and record.find('trades') >= 0:
logger.info('Dumping backtest results')
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)
def start(self) -> None:

View File

@ -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',

View File

@ -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,