function name change
This commit is contained in:
parent
2ee89c4ef3
commit
8250ce8da0
@ -33,21 +33,24 @@ def init_plotscript(config):
|
|||||||
pairs = config["pairs"]
|
pairs = config["pairs"]
|
||||||
else:
|
else:
|
||||||
pairs = config["exchange"]["pair_whitelist"]
|
pairs = config["exchange"]["pair_whitelist"]
|
||||||
|
assert pairs is not None, ('No pairs available in config.')
|
||||||
|
|
||||||
# Set timerange to use
|
# Set timerange to use
|
||||||
timerange = TimeRange.parse_timerange(config.get("timerange"))
|
timerange = TimeRange.parse_timerange(config.get("timerange"))
|
||||||
|
|
||||||
tickers = history.load_data(
|
tickers = history.load_data(
|
||||||
datadir=Path(str(config.get("datadir"))),
|
datadir=Path(config.get("datadir"), config.get("exchange").get("name")),
|
||||||
pairs=pairs,
|
pairs=pairs,
|
||||||
ticker_interval=config.get('ticker_interval', '5m'),
|
ticker_interval=config.get('ticker_interval', '5m'),
|
||||||
timerange=timerange,
|
timerange=timerange,
|
||||||
)
|
)
|
||||||
|
assert tickers is not None, ('No ticker data available as specified in config.')
|
||||||
|
|
||||||
trades = load_trades(config['trade_source'],
|
trades = load_trades(config['trade_source'],
|
||||||
db_url=config.get('db_url'),
|
db_url=config.get('db_url'),
|
||||||
exportfilename=config.get('exportfilename'),
|
exportfilename=config.get('exportfilename'),
|
||||||
)
|
)
|
||||||
|
assert trades is not None, ('No trades available as specified in config.')
|
||||||
|
|
||||||
return {"tickers": tickers,
|
return {"tickers": tickers,
|
||||||
"trades": trades,
|
"trades": trades,
|
||||||
@ -324,7 +327,7 @@ def store_plot_file(fig, filename: str, directory: Path, auto_open: bool = False
|
|||||||
logger.info(f"Stored plot as {_filename}")
|
logger.info(f"Stored plot as {_filename}")
|
||||||
|
|
||||||
|
|
||||||
def analyse_and_plot_pairs(config: Dict[str, Any]):
|
def load_and_plot_trades(config: Dict[str, Any]):
|
||||||
"""
|
"""
|
||||||
From configuration provided
|
From configuration provided
|
||||||
- Initializes plot-script
|
- Initializes plot-script
|
||||||
@ -339,31 +342,34 @@ def analyse_and_plot_pairs(config: Dict[str, Any]):
|
|||||||
|
|
||||||
plot_elements = init_plotscript(config)
|
plot_elements = init_plotscript(config)
|
||||||
trades = plot_elements['trades']
|
trades = plot_elements['trades']
|
||||||
|
if trades is None:
|
||||||
|
raise ValueError('No trades to analyze')
|
||||||
|
else:
|
||||||
|
pair_counter = 0
|
||||||
|
for pair, data in plot_elements["tickers"].items():
|
||||||
|
pair_counter += 1
|
||||||
|
logger.info("analyse pair %s", pair)
|
||||||
|
tickers = {}
|
||||||
|
tickers[pair] = data
|
||||||
|
|
||||||
pair_counter = 0
|
dataframe = strategy.analyze_ticker(tickers[pair], {'pair': pair})
|
||||||
for pair, data in plot_elements["tickers"].items():
|
logger.debug(f'pair: {pair}')
|
||||||
pair_counter += 1
|
|
||||||
logger.info("analyse pair %s", pair)
|
|
||||||
tickers = {}
|
|
||||||
tickers[pair] = data
|
|
||||||
|
|
||||||
dataframe = strategy.analyze_ticker(tickers[pair], {'pair': pair})
|
trades_pair = trades.loc[trades['pair'] == pair]
|
||||||
|
trades_pair = extract_trades_of_period(dataframe, trades_pair)
|
||||||
|
|
||||||
trades_pair = trades.loc[trades['pair'] == pair]
|
fig = generate_candlestick_graph(
|
||||||
trades_pair = extract_trades_of_period(dataframe, trades_pair)
|
pair=pair,
|
||||||
|
data=dataframe,
|
||||||
|
trades=trades_pair,
|
||||||
|
indicators1=config["indicators1"],
|
||||||
|
indicators2=config["indicators2"],
|
||||||
|
)
|
||||||
|
|
||||||
fig = generate_candlestick_graph(
|
store_plot_file(fig, filename=generate_plot_filename(pair, config['ticker_interval']),
|
||||||
pair=pair,
|
directory=config['user_data_dir'] / "plot")
|
||||||
data=dataframe,
|
|
||||||
trades=trades_pair,
|
|
||||||
indicators1=config["indicators1"],
|
|
||||||
indicators2=config["indicators2"],
|
|
||||||
)
|
|
||||||
|
|
||||||
store_plot_file(fig, filename=generate_plot_filename(pair, config['ticker_interval']),
|
logger.info('End of plotting process. %s plots generated', pair_counter)
|
||||||
directory=config['user_data_dir'] / "plot")
|
|
||||||
|
|
||||||
logger.info('End of plotting process. %s plots generated', pair_counter)
|
|
||||||
|
|
||||||
|
|
||||||
def plot_profit(config: Dict[str, Any]) -> None:
|
def plot_profit(config: Dict[str, Any]) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user