eagle0504 commited on
Commit
9ae6397
1 Parent(s): 2a2cb1e

qa omitted

Browse files
Files changed (1) hide show
  1. utils/ui_helper.py +8 -17
utils/ui_helper.py CHANGED
@@ -47,18 +47,6 @@ def main_algo_trader():
47
  # Process inputs
48
  tickers_list = [ticker.strip() for ticker in tickers.split(",")]
49
 
50
- # Question-answering
51
- user_question = st.sidebar.text_input(
52
- "Enter your question:",
53
- f"Tell me about Microsoft as a financial advisor",
54
- )
55
- with st.sidebar:
56
- with st.spinner("Running langchain agent with GPT3..."):
57
- final_ans = run_langchain_agent_(
58
- question=str(user_question)
59
- )
60
- st.markdown(final_ans)
61
-
62
  # Run analysis on button click
63
  if st.button("Run Analysis"):
64
  with st.spinner("Downloading data and calculating returns..."):
@@ -182,11 +170,14 @@ def main_algo_trader():
182
  with col1:
183
  # Checkpoint: ask user whether they want portfolio weights
184
  if csv:
185
- recent_selected_stocks = df["portfolio_history"][-1]
186
- recent_selected_stocks = ", ".join(recent_selected_stocks)
187
- st.success(
188
- f"The algorithm suggests to hold the following stocks for the current month (equally weighted): {recent_selected_stocks}"
189
- )
 
 
 
190
 
191
  with col2:
192
  # Download
 
47
  # Process inputs
48
  tickers_list = [ticker.strip() for ticker in tickers.split(",")]
49
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  # Run analysis on button click
51
  if st.button("Run Analysis"):
52
  with st.spinner("Downloading data and calculating returns..."):
 
170
  with col1:
171
  # Checkpoint: ask user whether they want portfolio weights
172
  if csv:
173
+ try:
174
+ recent_selected_stocks = df["portfolio_history"][-1]
175
+ recent_selected_stocks = ", ".join(recent_selected_stocks)
176
+ st.success(
177
+ f"The algorithm suggests to hold the following stocks for the current month (equally weighted): {recent_selected_stocks}"
178
+ )
179
+ except:
180
+ st.warning("Oops! No data found due during API calls. Please refresh the screen and rerun the simulation.")
181
 
182
  with col2:
183
  # Download