stable/freqtrade/commands/plot_commands.py

37 lines
1.1 KiB
Python
Raw Normal View History

from typing import Any, Dict
from freqtrade.configuration import setup_utils_configuration
from freqtrade.exceptions import OperationalException
from freqtrade.state import RunMode
2020-02-02 04:00:40 +00:00
def validate_plot_args(args: Dict[str, Any]) -> None:
if not args.get('datadir') and not args.get('config'):
2019-09-03 05:05:48 +00:00
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:
"""
2019-08-22 14:51:00 +00:00
Entrypoint for dataframe plotting
"""
# Import here to avoid errors if plot-dependencies are not installed.
2019-09-05 20:00:16 +00:00
from freqtrade.plot.plotting import load_and_plot_trades
2019-09-03 05:05:48 +00:00
validate_plot_args(args)
2019-08-31 13:14:57 +00:00
config = setup_utils_configuration(args, RunMode.PLOT)
2019-09-05 20:00:16 +00:00
load_and_plot_trades(config)
2019-08-22 14:51:00 +00:00
def start_plot_profit(args: Dict[str, Any]) -> None:
2019-08-22 14:51:00 +00:00
"""
Entrypoint for plot_profit
"""
# Import here to avoid errors if plot-dependencies are not installed.
from freqtrade.plot.plotting import plot_profit
2019-09-03 05:05:48 +00:00
validate_plot_args(args)
2019-08-31 13:14:57 +00:00
config = setup_utils_configuration(args, RunMode.PLOT)
2019-08-22 14:51:00 +00:00
plot_profit(config)