Move plot_utils to plot_commands

This commit is contained in:
Matthias
2020-01-26 13:20:34 +01:00
parent 70a0346b0a
commit b254bdfea3
4 changed files with 4 additions and 3 deletions

View File

@@ -6,5 +6,6 @@ from freqtrade.commands.hyperopt_commands import (start_hyperopt_list, # noqa:
from freqtrade.commands.list_commands import (start_list_exchanges, # noqa: F401
start_list_markets, start_list_strategies,
start_list_timeframes)
from freqtrade.commands.plot_commands import start_plot_dataframe, start_plot_profit # noqa: F401
from freqtrade.commands.trade_commands import start_trading # noqa: F401
from freqtrade.commands.utils import setup_utils_configuration, start_test_pairlist # noqa: F401

View File

@@ -0,0 +1,36 @@
from typing import Any, Dict
from freqtrade.exceptions import OperationalException
from freqtrade.state import RunMode
from freqtrade.commands.utils import setup_utils_configuration
def validate_plot_args(args: Dict[str, Any]):
if not args.get('datadir') and not args.get('config'):
raise OperationalException(
"You need to specify either `--datadir` or `--config` "
"for plot-profit and plot-dataframe.")
def start_plot_dataframe(args: Dict[str, Any]) -> None:
"""
Entrypoint for dataframe plotting
"""
# Import here to avoid errors if plot-dependencies are not installed.
from freqtrade.plot.plotting import load_and_plot_trades
validate_plot_args(args)
config = setup_utils_configuration(args, RunMode.PLOT)
load_and_plot_trades(config)
def start_plot_profit(args: Dict[str, Any]) -> None:
"""
Entrypoint for plot_profit
"""
# Import here to avoid errors if plot-dependencies are not installed.
from freqtrade.plot.plotting import plot_profit
validate_plot_args(args)
config = setup_utils_configuration(args, RunMode.PLOT)
plot_profit(config)