Add init
Browse files- README.md +7 -6
- app.py +35 -0
- requirements.txt +7 -0
README.md
CHANGED
@@ -1,13 +1,14 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: streamlit
|
7 |
-
sdk_version: 1.
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
11 |
---
|
12 |
|
13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces
|
|
|
|
1 |
---
|
2 |
+
title: trader
|
3 |
+
emoji: ⚡
|
4 |
+
colorFrom: purple
|
5 |
+
colorTo: yellow
|
6 |
sdk: streamlit
|
7 |
+
sdk_version: 1.2.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
11 |
---
|
12 |
|
13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces#reference
|
14 |
+
|
app.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
import streamlit as st
|
3 |
+
import vnquant.data as dt
|
4 |
+
import seaborn as sns
|
5 |
+
import matplotlib.pyplot as plt
|
6 |
+
import plotly.express as px
|
7 |
+
import plotly.graph_objects as go
|
8 |
+
import statsmodels.api as sm
|
9 |
+
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]
|
17 |
+
m = Prophet()
|
18 |
+
pdf = pd.DataFrame()
|
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,
|
26 |
+
y=pdf.y,
|
27 |
+
name = f"{symbol}_true"
|
28 |
+
))
|
29 |
+
fig.add_trace(go.Scatter(x= forecast.ds,
|
30 |
+
y=forecast.yhat,
|
31 |
+
name = f"{symbol}_pred"
|
32 |
+
))
|
33 |
+
return fig
|
34 |
+
fig = prophet_ts(symbol='FPT')
|
35 |
+
st.plotly_chart(fig, use_container_width=True)
|
requirements.txt
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
scikit-learn
|
2 |
+
seaborn
|
3 |
+
plotly
|
4 |
+
statsmodels
|
5 |
+
prophet
|
6 |
+
"git+https://github.com/phamdinhkhanh/vnquant.git@master"
|
7 |
+
|