sanyog16 commited on
Commit
3bc8917
·
verified ·
1 Parent(s): 9f0ffd8

imported investment_signal function and called it on line 62 to get signal and the reason

Browse files
Files changed (1) hide show
  1. app.py +17 -6
app.py CHANGED
@@ -5,6 +5,7 @@ from data_loader import load_data
5
  from indicators import calculate_indicators
6
  from ai_insights import get_ai_insight
7
  from portfolio_optimiser import optimize_portfolio
 
8
  import os
9
 
10
  # Streamlit UI
@@ -58,12 +59,22 @@ def calculate_and_return_everything(data):
58
  lower_bb = float(last_row['Lower_BB'])
59
  upper_bb = float(last_row['Upper_BB'])
60
 
61
- st.write(f"Moving Average Value: {ma}")
62
- st.write(f"Closing Price: {close_price}")
63
- st.write(f"Lower Bollinger Band: {lower_bb}")
64
- st.write(f"Upper Bollinger Band: {upper_bb}")
65
- st.write(f"RSI Value: {rsi}")
66
- st.write(f"MACD Value: {macd}")
 
 
 
 
 
 
 
 
 
 
67
 
68
 
69
  return indicator_data
 
5
  from indicators import calculate_indicators
6
  from ai_insights import get_ai_insight
7
  from portfolio_optimiser import optimize_portfolio
8
+ from investment_signal import get_investment_signal
9
  import os
10
 
11
  # Streamlit UI
 
59
  lower_bb = float(last_row['Lower_BB'])
60
  upper_bb = float(last_row['Upper_BB'])
61
 
62
+ signal, reason = get_investment_signal(
63
+ ma=ma,
64
+ close_price=close_price,
65
+ rsi=rsi,
66
+ macd=macd,
67
+ lower_band=lower_bb,
68
+ upper_band=upper_bb
69
+ )
70
+
71
+ st.subheader("Investment Signal")
72
+ if signal == "Buy":
73
+ st.success(f"**Recommendation: {signal}** — {reason}")
74
+ elif signal == "Sell":
75
+ st.error(f"**Recommendation: {signal}** — {reason}")
76
+ else:
77
+ st.warning(f"**Recommendation: {signal}** — {reason}")
78
 
79
 
80
  return indicator_data