Make plot_dataframe.py flake8 compliant

This commit is contained in:
Gerald Lonlas 2018-01-22 21:12:48 -08:00
parent 00f1c57279
commit fcb29c6da5

View File

@ -1,32 +1,33 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import sys import sys
import matplotlib # Install PYQT5 manually if you want to test this helper function
matplotlib.use("Qt5Agg")
import matplotlib.pyplot as plt
import talib.abstract as ta import talib.abstract as ta
import freqtrade.vendor.qtpylib.indicators as qtpylib import freqtrade.vendor.qtpylib.indicators as qtpylib
from pandas import DataFrame from pandas import DataFrame
from freqtrade import exchange, analyze from freqtrade import exchange, analyze
from freqtrade.misc import common_args_parser from freqtrade.misc import common_args_parser
from freqtrade.strategy.strategy import Strategy from freqtrade.strategy.strategy import Strategy
import matplotlib.pyplot as plt
import matplotlib # Install PYQT5 manually if you want to test this helper function
matplotlib.use("Qt5Agg")
def plot_parse_args(args): def plot_parse_args(args):
parser = common_args_parser(description='Graph utility') parser = common_args_parser(description='Graph utility')
parser.add_argument( parser.add_argument(
'-p', '--pair', '-p', '--pair',
help = 'What currency pair', help='What currency pair',
dest = 'pair', dest='pair',
default = 'BTC_ETH', default='BTC_ETH',
type = str, type=str,
) )
parser.add_argument( parser.add_argument(
'-i', '--interval', '-i', '--interval',
help = 'what interval to use', help='what interval to use',
dest = 'interval', dest='interval',
default = 5, default=5,
type = int, type=int,
) )
return parser.parse_args(args) return parser.parse_args(args)
@ -43,7 +44,7 @@ def plot_analyzed_dataframe(args) -> None:
# Init Bittrex to use public API # Init Bittrex to use public API
exchange._API = exchange.Bittrex({'key': '', 'secret': ''}) exchange._API = exchange.Bittrex({'key': '', 'secret': ''})
ticker = exchange.get_ticker_history(args.pair,args.interval) ticker = exchange.get_ticker_history(args.pair, args.interval)
dataframe = analyze.analyze_ticker(ticker) dataframe = analyze.analyze_ticker(ticker)
dataframe = populate_indicator(dataframe) dataframe = populate_indicator(dataframe)
@ -75,6 +76,7 @@ def plot_analyzed_dataframe(args) -> None:
plt.setp([a.get_xticklabels() for a in fig.axes[:-1]], visible=False) plt.setp([a.get_xticklabels() for a in fig.axes[:-1]], visible=False)
plt.show() plt.show()
def populate_indicator(dataframe: DataFrame) -> DataFrame: def populate_indicator(dataframe: DataFrame) -> DataFrame:
dataframe.loc[dataframe['buy'] == 1, 'buy_price'] = dataframe['close'] dataframe.loc[dataframe['buy'] == 1, 'buy_price'] = dataframe['close']