imported investment_signal function and called it on line 62 to get signal and the reason
Browse files
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 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|