Remove generate_dataframe from plot_dataframe script

This commit is contained in:
Matthias 2019-08-04 10:26:04 +02:00
parent e4380b533b
commit c5ccf44750

View File

@ -16,8 +16,6 @@ import logging
import sys import sys
from typing import Any, Dict, List from typing import Any, Dict, List
import pandas as pd
from freqtrade.configuration import Arguments from freqtrade.configuration import Arguments
from freqtrade.configuration.arguments import ARGS_PLOT_DATAFRAME from freqtrade.configuration.arguments import ARGS_PLOT_DATAFRAME
from freqtrade.data.btanalysis import extract_trades_of_period from freqtrade.data.btanalysis import extract_trades_of_period
@ -30,20 +28,6 @@ from freqtrade.state import RunMode
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
def generate_dataframe(strategy, tickers, pair) -> pd.DataFrame:
"""
Get tickers then Populate strategy indicators and signals, then return the full dataframe
:return: the DataFrame of a pair
"""
dataframes = strategy.tickerdata_to_dataframe(tickers)
dataframe = dataframes[pair]
dataframe = strategy.advise_buy(dataframe, {'pair': pair})
dataframe = strategy.advise_sell(dataframe, {'pair': pair})
return dataframe
def analyse_and_plot_pairs(config: Dict[str, Any]): def analyse_and_plot_pairs(config: Dict[str, Any]):
""" """
From arguments provided in cli: From arguments provided in cli:
@ -57,6 +41,7 @@ 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']
strategy = plot_elements["strategy"]
pair_counter = 0 pair_counter = 0
for pair, data in plot_elements["tickers"].items(): for pair, data in plot_elements["tickers"].items():
@ -64,7 +49,8 @@ def analyse_and_plot_pairs(config: Dict[str, Any]):
logger.info("analyse pair %s", pair) logger.info("analyse pair %s", pair)
tickers = {} tickers = {}
tickers[pair] = data tickers[pair] = data
dataframe = generate_dataframe(plot_elements["strategy"], tickers, pair)
dataframe = strategy.analyze_ticker(tickers[pair], {'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)