This commit is contained in:
dosang.yoon
2022-07-08 15:25:03 +09:00
parent bcf8af614f
commit 3d1f73c087
5 changed files with 31 additions and 198 deletions

View File

@@ -1,9 +1,4 @@
import pandas as pd
import datetime
from plotly import tools, subplots
import plotly.offline as offline
import plotly.graph_objs as go
import plotly.io as po
from stockpredictor.analysis.Common import Common
@@ -18,28 +13,6 @@ class IchimokuCloud:
self.common = Common()
return
def draw(self, stock):
item_name = stock["NAME"]
item_code = stock["CODE"]
df = pd.DataFrame(stock["PRICE"])
leadingSpan1 = go.Scatter(x=df.DATE, y=df['leadingSpan1'], name="선행스팬1", line_color='#8B4513')
leadingSpan2 = go.Scatter(x=df.DATE, y=df['leadingSpan2'], name="선행스팬2", line_color='#4169E1')
candle = go.Candlestick(x=df.DATE, open=df.open, high=df.high, low=df.low, close=df.close, increasing_line_color= 'red', decreasing_line_color= 'blue')
data = [leadingSpan1, leadingSpan2, candle]
layout = go.Layout(title='{} MACD 그래프'.format(item_name))
fig = subplots.make_subplots(rows=1, cols=1, shared_xaxes=True)
for trace in data:
fig.append_trace(trace, 1,1)
fig = go.Figure(data=data, layout=layout)
path = "/Users/dsyoon/workspace/StockPredictor/resources/analysis/html"
po.write_html(fig, file=path + "/ichimokuCloud_" + item_code+'.html', auto_open=False)
return fig
# c=9, b=26, l=52
def apply(self, df, c=9, b=26, l=52):
# 입력받은 값이 dataframe이라는 것을 정의해줌