Improve some tests
This commit is contained in:
parent
fc3e3c468c
commit
0eb109f8f7
@ -528,8 +528,8 @@ class Arguments(object):
|
||||
)
|
||||
self.parser.add_argument(
|
||||
'--indicators1',
|
||||
help='Set indicators from your strategy you want in the first row of the graph. Separate '
|
||||
'them with a comma. E.g: ema3,ema5 (default: %(default)s)',
|
||||
help='Set indicators from your strategy you want in the first row of the graph. '
|
||||
'Separate them with a comma. E.g: ema3,ema5 (default: %(default)s)',
|
||||
type=str,
|
||||
default='sma,ema3,ema5',
|
||||
dest='indicators1',
|
||||
@ -537,8 +537,8 @@ class Arguments(object):
|
||||
|
||||
self.parser.add_argument(
|
||||
'--indicators2',
|
||||
help='Set indicators from your strategy you want in the third row of the graph. Separate '
|
||||
'them with a comma. E.g: macd,fastd,fastk (default: %(default)s)',
|
||||
help='Set indicators from your strategy you want in the third row of the graph. '
|
||||
'Separate them with a comma. E.g: macd,fastd,fastk (default: %(default)s)',
|
||||
type=str,
|
||||
default='macd,macdsignal',
|
||||
dest='indicators2',
|
||||
|
@ -5,8 +5,9 @@ from plotly import tools
|
||||
import plotly.graph_objs as go
|
||||
from copy import deepcopy
|
||||
|
||||
from freqtrade.arguments import Arguments, TimeRange
|
||||
from freqtrade.arguments import TimeRange
|
||||
from freqtrade.data import history
|
||||
from freqtrade.data.btanalysis import load_backtest_data
|
||||
from freqtrade.plot.plotting import (generate_graph, generate_plot_file,
|
||||
generate_row, plot_trades)
|
||||
from freqtrade.strategy.default_strategy import DefaultStrategy
|
||||
@ -71,8 +72,26 @@ def test_plot_trades():
|
||||
# nothing happens when no trades are available
|
||||
fig = plot_trades(fig1, None)
|
||||
assert fig == fig1
|
||||
pair = "ADA/BTC"
|
||||
filename = history.make_testdata_path(None) / "backtest-result_test.json"
|
||||
trades = load_backtest_data(filename)
|
||||
trades = trades.loc[trades['pair'] == pair]
|
||||
|
||||
# TODO: implement tests that do something
|
||||
fig = plot_trades(fig, trades)
|
||||
figure = fig1.layout.figure
|
||||
|
||||
# Check buys - color, should be in first graph, ...
|
||||
trade_buy = find_trace_in_fig_data(figure.data, "trade_buy")
|
||||
assert isinstance(trade_buy, go.Scatter)
|
||||
assert trade_buy.yaxis == 'y'
|
||||
assert len(trades) == len(trade_buy.x)
|
||||
assert trade_buy.marker.color == 'green'
|
||||
|
||||
trade_sell = find_trace_in_fig_data(figure.data, "trade_sell")
|
||||
assert isinstance(trade_sell, go.Scatter)
|
||||
assert trade_sell.yaxis == 'y'
|
||||
assert len(trades) == len(trade_sell.x)
|
||||
assert trade_sell.marker.color == 'red'
|
||||
|
||||
|
||||
def test_generate_graph_no_signals_no_trades(default_conf, mocker, caplog):
|
||||
|
@ -141,7 +141,7 @@ def analyse_and_plot_pairs(config: Dict[str, Any]):
|
||||
logger.info('End of ploting process %s plots generated', pair_counter)
|
||||
|
||||
|
||||
def plot_parse_args(args: List[str]) -> Namespace:
|
||||
def plot_parse_args(args: List[str]) -> Dict[str, Any]:
|
||||
"""
|
||||
Parse args passed to the script
|
||||
:param args: Cli arguments
|
||||
|
Loading…
Reference in New Issue
Block a user