Merge branch 'master' into parabolic-sar

This commit is contained in:
Janne Sinivirta 2017-09-04 12:07:13 +03:00
commit cf309f1987

View File

@ -43,6 +43,9 @@ def get_ticker_dataframe(pair: str) -> DataFrame:
} for t in sorted(data['result'], key=lambda k: k['T']) if arrow.get(t['T']) > minimum_date]
dataframe = DataFrame(json_normalize(data))
dataframe['close_30_ema'] = ta.EMA(dataframe, timeperiod=30)
dataframe['close_90_ema'] = ta.EMA(dataframe, timeperiod=90)
dataframe['sar'] = ta.SAR(dataframe, 0.02, 0.2)
# calculate StochRSI
@ -117,9 +120,8 @@ def plot_dataframe(dataframe: DataFrame, pair: str) -> None:
fig, (ax1, ax2, ax3) = plt.subplots(3, sharex=True)
fig.suptitle(pair, fontsize=14, fontweight='bold')
ax1.plot(dataframe.index.values, dataframe['close'], label='close')
# ax1.plot(dataframe.index.values, dataframe['close_30_ema'], label='EMA(60)')
# ax1.plot(dataframe.index.values, dataframe['close_90_ema'], label='EMA(120)')
ax1.plot(dataframe.index.values, dataframe['sar'], 'rx', label='SAR')
ax1.plot(dataframe.index.values, dataframe['close_30_ema'], label='EMA(30)')
ax1.plot(dataframe.index.values, dataframe['close_90_ema'], label='EMA(90)')
# ax1.plot(dataframe.index.values, dataframe['sell'], 'ro', label='sell')
ax1.plot(dataframe.index.values, dataframe['buy'], 'bo', label='buy')
ax1.legend()