function name change

This commit is contained in:
Jonathan Raviotta 2019-09-03 23:38:41 -04:00
parent 2ee89c4ef3
commit 8250ce8da0

View File

@ -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,7 +342,9 @@ 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 pair_counter = 0
for pair, data in plot_elements["tickers"].items(): for pair, data in plot_elements["tickers"].items():
pair_counter += 1 pair_counter += 1
@ -348,6 +353,7 @@ def analyse_and_plot_pairs(config: Dict[str, Any]):
tickers[pair] = data tickers[pair] = data
dataframe = strategy.analyze_ticker(tickers[pair], {'pair': pair}) dataframe = strategy.analyze_ticker(tickers[pair], {'pair': pair})
logger.debug(f'pair: {pair}')
trades_pair = trades.loc[trades['pair'] == pair] trades_pair = trades.loc[trades['pair'] == pair]
trades_pair = extract_trades_of_period(dataframe, trades_pair) trades_pair = extract_trades_of_period(dataframe, trades_pair)