Yilin98 commited on
Commit
f3586f7
·
1 Parent(s): 84dfcbc

some fixes

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. data_loader_functions.py +12 -0
app.py CHANGED
@@ -33,7 +33,7 @@ with left_column:
33
  st.subheader("Vader-based Sentiment Analysis")
34
 
35
  with st.spinner("Connecting with Hopsworks..."):
36
- df = sentiment_analysis(option_name, datetime(2023, 1, 5))
37
  df_copy = df.copy()
38
  df_copy = df_copy.set_index('publish_date')
39
  st.table(df_copy.drop(['body_text', 'text_w_puncts', 'text_tokenized', 'text_w_stopwords', 'text_lemmatized', 'text_stemmed', 'text_processed', 'predicted_class'], axis=1))
@@ -45,7 +45,7 @@ with right_column:
45
  st.subheader("Today's Stock Price")
46
 
47
  with st.spinner('Loading stock data from YahooFinance...'):
48
- stock_df = get_stock_price(option_ticker, datetime(2023, 1, 5), datetime(2023, 1, 6))
49
  st.table(stock_df)
50
 
51
  st.subheader("LSTM-based stock price prediction model")
 
33
  st.subheader("Vader-based Sentiment Analysis")
34
 
35
  with st.spinner("Connecting with Hopsworks..."):
36
+ df = sentiment_analysis(option_name, datetime.today())
37
  df_copy = df.copy()
38
  df_copy = df_copy.set_index('publish_date')
39
  st.table(df_copy.drop(['body_text', 'text_w_puncts', 'text_tokenized', 'text_w_stopwords', 'text_lemmatized', 'text_stemmed', 'text_processed', 'predicted_class'], axis=1))
 
45
  st.subheader("Today's Stock Price")
46
 
47
  with st.spinner('Loading stock data from YahooFinance...'):
48
+ stock_df = get_stock_price(option_ticker, datetime.today(), (datetime.today() + timedelta(days=1)))
49
  st.table(stock_df)
50
 
51
  st.subheader("LSTM-based stock price prediction model")
data_loader_functions.py CHANGED
@@ -68,6 +68,18 @@ def get_news_from_hopsworks():
68
  query = news_fg.select_all()
69
  return query.read()
70
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  ## Formalize the date column
72
  def remove_parentheses(s):
73
  if '(' in s:
 
68
  query = news_fg.select_all()
69
  return query.read()
70
 
71
+ ## Fetch history prediction plot
72
+ def get_history_plot_from_hopsworks(ticker):
73
+ project = hopsworks.login()
74
+ dataset_api = project.get_dataset_api()
75
+ if ticker == 'AAPL':
76
+ dataset_api.download("Resources/images/apple_stock_prediction.png", overwrite=True)
77
+ elif ticker == 'AMZN':
78
+ dataset_api.download("Resources/images/amazon_stock_prediction.png", overwrite=True)
79
+ else:
80
+ dataset_api.download("Resources/images/meta_stock_prediction.png", overwrite=True)
81
+ return
82
+
83
  ## Formalize the date column
84
  def remove_parentheses(s):
85
  if '(' in s: