私は定期的に私に興味のある株と各株の関連するグラフを作成したいと思います。複数のデータフレームからPDFへの複数のプロット
現時点では、テクニカルインジケータ(価格、移動平均、指数移動平均など)ごとに1つのデータフレームがあり、各データフレームからそれぞれの時系列の関連情報をプロットしたいと考えています。
は今まで、私がボケを使用していると私は私が望むものをプロットすることができていますが、個別に各ティッカー...のために
私が持っているコードはこれです:
# Import dataframes from import_data.py
prices = pd.read_pickle('prices.pkl')
date = prices.index
# price 20, 50, 80 MA
ma20 = pd.rolling_mean(prices, window=20)
ma50 = pd.rolling_mean(prices, window=50)
ma80 = pd.rolling_mean(prices, window=80)
# price with 20EMA+Bollinger Bands - 20MA
ema20 = pd.ewma(prices, span=20)
bbandsup = pd.ewma(prices, span=20) + 2 * pd.ewmstd(prices, span=20)
bbandslo = pd.ewma(prices, span=20) - 2 * pd.ewmstd(prices, span=20)
plot = figure(title="Price Chart and Technical Indicators", x_axis_label='Date', y_axis_label='Price')
plot.line(date, prices['SPY'], legend='Price', line_width=2)
plot.line(date, ema20['SPY'], legend='EMA-20', line_width=2, line_color="red")
plot.line(date, ma20['SPY'], legend='EA-20', line_width=2, line_color="green")
plot.line(date, bbandsup['SPY'], legend='Bollinger', line_width=2, line_color="black", line_dash="4 4")
plot.line(date, bbandslo['SPY'], legend='Bollinger', line_width=2, line_color="black", line_dash="4 4")
show(plot)
価格のデータフレームを持っています索引としての日付の構造、列ヘッダーはティッカー文字列です。たとえば、最初の列ヘッダーはSPY、2番目はAAPLなどです。
複数のプロットの獣を攻撃する前に、すべてをpdfに印刷したいと考えています。
ありがとうございます!