Refactor init_plotscript a bit (strategy is not needed for plot_profit)
This commit is contained in:
parent
9f29ad77bd
commit
395414ccde
@ -35,9 +35,10 @@ ARGS_CREATE_USERDIR = ["user_data_dir"]
|
||||
ARGS_DOWNLOAD_DATA = ["pairs", "pairs_file", "days", "exchange", "timeframes", "erase"]
|
||||
|
||||
ARGS_PLOT_DATAFRAME = ["pairs", "indicators1", "indicators2", "plot_limit", "db_url",
|
||||
"trade_source", "export", "exportfilename", "timerange"]
|
||||
"trade_source", "export", "exportfilename", "timerange", "ticker_interval"]
|
||||
|
||||
ARGS_PLOT_PROFIT = ["pairs", "timerange", "export", "exportfilename", "db_url", "trade_source"]
|
||||
ARGS_PLOT_PROFIT = ["pairs", "timerange", "export", "exportfilename", "db_url",
|
||||
"trade_source", "ticker_interval"]
|
||||
|
||||
NO_CONF_REQURIED = ["start_download_data"]
|
||||
|
||||
|
@ -26,10 +26,9 @@ except ImportError:
|
||||
def init_plotscript(config):
|
||||
"""
|
||||
Initialize objects needed for plotting
|
||||
:return: Dict with tickers, trades, pairs and strategy
|
||||
:return: Dict with tickers, trades and pairs
|
||||
"""
|
||||
|
||||
strategy = StrategyResolver(config).strategy
|
||||
if "pairs" in config:
|
||||
pairs = config["pairs"]
|
||||
else:
|
||||
@ -41,7 +40,7 @@ def init_plotscript(config):
|
||||
tickers = history.load_data(
|
||||
datadir=Path(str(config.get("datadir"))),
|
||||
pairs=pairs,
|
||||
ticker_interval=config['ticker_interval'],
|
||||
ticker_interval=config.get('ticker_interval', '5m'),
|
||||
timerange=timerange,
|
||||
)
|
||||
|
||||
@ -49,10 +48,10 @@ def init_plotscript(config):
|
||||
db_url=config.get('db_url'),
|
||||
exportfilename=config.get('exportfilename'),
|
||||
)
|
||||
|
||||
return {"tickers": tickers,
|
||||
"trades": trades,
|
||||
"pairs": pairs,
|
||||
"strategy": strategy,
|
||||
}
|
||||
|
||||
|
||||
@ -329,9 +328,10 @@ def analyse_and_plot_pairs(config: Dict[str, Any]):
|
||||
- Generate plot files
|
||||
:return: None
|
||||
"""
|
||||
strategy = StrategyResolver(config).strategy
|
||||
|
||||
plot_elements = init_plotscript(config)
|
||||
trades = plot_elements['trades']
|
||||
strategy = plot_elements["strategy"]
|
||||
|
||||
pair_counter = 0
|
||||
for pair, data in plot_elements["tickers"].items():
|
||||
@ -367,7 +367,10 @@ def plot_profit(config: Dict[str, Any]) -> None:
|
||||
in helping out to find a good algorithm.
|
||||
"""
|
||||
plot_elements = init_plotscript(config)
|
||||
trades = plot_elements['trades']
|
||||
trades = load_trades(config['trade_source'],
|
||||
db_url=config.get('db_url'),
|
||||
exportfilename=config.get('exportfilename'),
|
||||
)
|
||||
# Filter trades to relevant pairs
|
||||
trades = trades[trades['pair'].isin(plot_elements["pairs"])]
|
||||
|
||||
|
@ -51,7 +51,6 @@ def test_init_plotscript(default_conf, mocker):
|
||||
assert "tickers" in ret
|
||||
assert "trades" in ret
|
||||
assert "pairs" in ret
|
||||
assert "strategy" in ret
|
||||
|
||||
default_conf['pairs'] = ["POWR/BTC", "XLM/BTC"]
|
||||
ret = init_plotscript(default_conf)
|
||||
|
Loading…
Reference in New Issue
Block a user