2024-10-04 04:37:49 +00:00
|
|
|
from typing import Any
|
2019-09-12 18:16:39 +00:00
|
|
|
|
2020-01-26 12:55:48 +00:00
|
|
|
from freqtrade.configuration import setup_utils_configuration
|
2021-06-08 19:20:35 +00:00
|
|
|
from freqtrade.enums import RunMode
|
2024-03-19 06:06:43 +00:00
|
|
|
from freqtrade.exceptions import ConfigurationError
|
2019-08-22 14:02:03 +00:00
|
|
|
|
|
|
|
|
2024-10-04 04:37:49 +00:00
|
|
|
def validate_plot_args(args: dict[str, Any]) -> None:
|
2024-05-12 14:27:03 +00:00
|
|
|
if not args.get("datadir") and not args.get("config"):
|
2024-03-19 06:06:43 +00:00
|
|
|
raise ConfigurationError(
|
2019-09-03 05:05:48 +00:00
|
|
|
"You need to specify either `--datadir` or `--config` "
|
2024-05-12 14:27:03 +00:00
|
|
|
"for plot-profit and plot-dataframe."
|
|
|
|
)
|
2019-09-03 05:05:48 +00:00
|
|
|
|
|
|
|
|
2024-10-04 04:37:49 +00:00
|
|
|
def start_plot_dataframe(args: dict[str, Any]) -> None:
|
2019-08-22 14:02:03 +00:00
|
|
|
"""
|
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.
|
2019-09-05 20:00:16 +00:00
|
|
|
from freqtrade.plot.plotting import load_and_plot_trades
|
2024-05-12 14:27:03 +00:00
|
|
|
|
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
|
|
|
|
2019-09-05 20:00:16 +00:00
|
|
|
load_and_plot_trades(config)
|
2019-08-22 14:51:00 +00:00
|
|
|
|
|
|
|
|
2024-10-04 04:37:49 +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
|
2024-05-12 14:27:03 +00:00
|
|
|
|
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)
|