import pandas as pd import streamlit as st import vnquant.data as dt import seaborn as sns import matplotlib.pyplot as plt import plotly.express as px import plotly.graph_objects as go import statsmodels.api as sm from statsmodels.tsa.arima.model import ARIMA from prophet import Prophet def prophet_ts(symbol, periods = 10): loader = dt.DataLoader(symbol, '2020-01-01','2022-06-01') data = loader.download() data.columns = [col[0] for col in data.columns] m = Prophet() pdf = pd.DataFrame() pdf['ds'] = data.index pdf['y'] = data.close.values m.fit(pdf) future = m.make_future_dataframe(periods=periods) forecast = m.predict(future) fig = go.Figure() fig.add_trace(go.Scatter(x= pdf.ds, y=pdf.y, name = f"{symbol}_true" )) fig.add_trace(go.Scatter(x= forecast.ds, y=forecast.yhat, name = f"{symbol}_pred" )) return fig st.title("Trading in Vietnam") sb = st.text_input('Symbol', 'FPT') periods = st.slider('How old are you?', 1, 365, 28) fig = prophet_ts(symbol=sb, periods = periods) st.plotly_chart(fig, use_container_width=True)