Use add_profit in script
This commit is contained in:
parent
5a11ffcad8
commit
0b517584aa
@ -7,7 +7,7 @@ import pandas as pd
|
||||
from freqtrade.arguments import Arguments
|
||||
from freqtrade.exchange import Exchange
|
||||
from freqtrade.data import history
|
||||
from freqtrade.data.btanalysis import load_trades, create_cum_profit
|
||||
from freqtrade.data.btanalysis import load_trades
|
||||
from freqtrade.resolvers import ExchangeResolver, StrategyResolver
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -5,13 +5,13 @@ from unittest.mock import MagicMock
|
||||
import plotly.graph_objs as go
|
||||
from plotly import tools
|
||||
|
||||
from freqtrade.arguments import TimeRange, Arguments
|
||||
from freqtrade.arguments import Arguments, TimeRange
|
||||
from freqtrade.data import history
|
||||
from freqtrade.data.btanalysis import load_backtest_data, create_cum_profit
|
||||
from freqtrade.plot.plotting import (generate_candlestick_graph,
|
||||
store_plot_file, add_profit,
|
||||
generate_plot_filename, add_indicators,
|
||||
plot_trades)
|
||||
from freqtrade.data.btanalysis import create_cum_profit, load_backtest_data
|
||||
from freqtrade.plot.plotting import (add_indicators, add_profit,
|
||||
generate_candlestick_graph,
|
||||
generate_plot_filename, plot_trades,
|
||||
store_plot_file)
|
||||
from freqtrade.strategy.default_strategy import DefaultStrategy
|
||||
from freqtrade.tests.conftest import log_has, log_has_re
|
||||
|
||||
|
@ -8,14 +8,13 @@ import logging
|
||||
import sys
|
||||
from typing import Any, Dict, List
|
||||
|
||||
import pandas as pd
|
||||
import plotly.graph_objs as go
|
||||
from plotly import tools
|
||||
|
||||
from freqtrade.arguments import ARGS_PLOT_PROFIT, Arguments
|
||||
from freqtrade.data.btanalysis import create_cum_profit, combine_tickers_with_mean
|
||||
from freqtrade.optimize import setup_configuration
|
||||
from freqtrade.plot.plotting import FTPlots, store_plot_file
|
||||
from freqtrade.plot.plotting import FTPlots, store_plot_file, add_profit
|
||||
from freqtrade.state import RunMode
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -48,27 +47,16 @@ def plot_profit(config: Dict[str, Any]) -> None:
|
||||
name='Avg close price',
|
||||
)
|
||||
|
||||
profit = go.Scattergl(
|
||||
x=df_comb.index,
|
||||
y=df_comb['cum_profit'],
|
||||
name='Profit',
|
||||
)
|
||||
|
||||
fig = tools.make_subplots(rows=3, cols=1, shared_xaxes=True, row_width=[1, 1, 1])
|
||||
|
||||
fig.append_trace(avgclose, 1, 1)
|
||||
fig.append_trace(profit, 2, 1)
|
||||
fig = add_profit(fig, 2, df_comb, 'cum_profit', 'Profit')
|
||||
|
||||
for pair in plot.pairs:
|
||||
profit_col = f'cum_profit_{pair}'
|
||||
df_comb = create_cum_profit(df_comb, trades[trades['pair'] == pair], profit_col)
|
||||
|
||||
pair_profit = go.Scattergl(
|
||||
x=df_comb.index,
|
||||
y=df_comb[profit_col],
|
||||
name=f"Profit {pair}",
|
||||
)
|
||||
fig.append_trace(pair_profit, 3, 1)
|
||||
fig = add_profit(fig, 3, df_comb, profit_col, f"Profit {pair}")
|
||||
|
||||
store_plot_file(fig, filename='freqtrade-profit-plot.html', auto_open=True)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user