2019-08-22 14:02:03 +00:00
|
|
|
from argparse import Namespace
|
2019-09-03 05:05:48 +00:00
|
|
|
from freqtrade import OperationalException
|
2019-08-22 14:02:03 +00:00
|
|
|
from freqtrade.state import RunMode
|
|
|
|
from freqtrade.utils import setup_utils_configuration
|
|
|
|
|
|
|
|
|
2019-09-03 05:05:48 +00:00
|
|
|
def validate_plot_args(args: Namespace):
|
|
|
|
args_tmp = vars(args)
|
|
|
|
if not args_tmp.get('datadir') and not args_tmp.get('config'):
|
|
|
|
raise OperationalException(
|
|
|
|
"You need to specify either `--datadir` or `--config` "
|
|
|
|
"for plot-profit and plot-dataframe.")
|
|
|
|
|
|
|
|
|
2019-08-22 14:02:03 +00:00
|
|
|
def start_plot_dataframe(args: Namespace) -> None:
|
|
|
|
"""
|
2019-08-22 14:51:00 +00:00
|
|
|
Entrypoint for dataframe plotting
|
2019-08-22 14:02:03 +00:00
|
|
|
"""
|
|
|
|
# Import here to avoid errors if plot-dependencies are not installed.
|
|
|
|
from freqtrade.plot.plotting import analyse_and_plot_pairs
|
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:02:03 +00:00
|
|
|
|
|
|
|
analyse_and_plot_pairs(config)
|
2019-08-22 14:51:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
def start_plot_profit(args: Namespace) -> None:
|
|
|
|
"""
|
|
|
|
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)
|