tonne commited on
Commit
b6df53a
1 Parent(s): 640a635

Add title and custom symbol

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -10,7 +10,7 @@ from statsmodels.tsa.arima.model import ARIMA
10
  from prophet import Prophet
11
 
12
 
13
- def prophet_ts(symbol):
14
  loader = dt.DataLoader(symbol, '2020-01-01','2022-06-01')
15
  data = loader.download()
16
  data.columns = [col[0] for col in data.columns]
@@ -19,7 +19,7 @@ def prophet_ts(symbol):
19
  pdf['ds'] = data.index
20
  pdf['y'] = data.close.values
21
  m.fit(pdf)
22
- future = m.make_future_dataframe(periods=30)
23
  forecast = m.predict(future)
24
  fig = go.Figure()
25
  fig.add_trace(go.Scatter(x= pdf.ds,
@@ -33,5 +33,6 @@ def prophet_ts(symbol):
33
  return fig
34
  st.title("Trading in Vietnam")
35
  sb = st.text_input('Symbol', 'FPT')
36
- fig = prophet_ts(symbol=sb)
 
37
  st.plotly_chart(fig, use_container_width=True)
 
10
  from prophet import Prophet
11
 
12
 
13
+ def prophet_ts(symbol, periods = 10):
14
  loader = dt.DataLoader(symbol, '2020-01-01','2022-06-01')
15
  data = loader.download()
16
  data.columns = [col[0] for col in data.columns]
 
19
  pdf['ds'] = data.index
20
  pdf['y'] = data.close.values
21
  m.fit(pdf)
22
+ future = m.make_future_dataframe(periods=periods)
23
  forecast = m.predict(future)
24
  fig = go.Figure()
25
  fig.add_trace(go.Scatter(x= pdf.ds,
 
33
  return fig
34
  st.title("Trading in Vietnam")
35
  sb = st.text_input('Symbol', 'FPT')
36
+ periods = st.slider('How old are you?', 1, 365, 28)
37
+ fig = prophet_ts(symbol=sb, periods = periods)
38
  st.plotly_chart(fig, use_container_width=True)