Update app.py
Browse files
app.py
CHANGED
@@ -175,9 +175,9 @@ if ticker_user!="":
|
|
175 |
interval=interval,
|
176 |
)
|
177 |
|
178 |
-
st.title("Analysis Summary")
|
179 |
-
st.dataframe(analysis_summary.summary)
|
180 |
-
query = f"{ticker_user} stock"
|
181 |
|
182 |
details = {
|
183 |
"symbol": ticker_user,
|
@@ -185,20 +185,47 @@ if ticker_user!="":
|
|
185 |
"screener": "india",
|
186 |
"interval": interval,
|
187 |
}
|
188 |
-
st.title("Details")
|
189 |
-
st.dataframe(details)
|
190 |
|
191 |
-
st.title("Oscillator Analysis")
|
192 |
-
st.dataframe(analysis_summary.oscillators)
|
193 |
|
194 |
-
st.title("Moving Averages")
|
195 |
-
st.dataframe(analysis_summary.moving_averages)
|
196 |
|
197 |
-
st.title("Summary")
|
198 |
-
st.dataframe(analysis_summary.summary)
|
199 |
|
200 |
-
st.title("Indicators")
|
201 |
-
st.dataframe(analysis_summary.indicators)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
|
203 |
url = "https://api.chart-img.com/v2/tradingview/advanced-chart"
|
204 |
api_key = "l0iUFRSeqC9z7nDPTd1hnafPh2RrdcEy6rl6tNqV"
|
@@ -243,9 +270,86 @@ if ticker_user!="":
|
|
243 |
# message = llm_vis.invoke([hmessage])
|
244 |
|
245 |
# st.write(message.content)
|
246 |
-
st.write(res["output_text"])
|
247 |
-
|
248 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
else:
|
250 |
st.warning(f"Failed to retrieve image. Status code: {response.status_code}")
|
251 |
st.warning("Response:", response.text)
|
|
|
175 |
interval=interval,
|
176 |
)
|
177 |
|
178 |
+
# st.title("Analysis Summary")
|
179 |
+
# st.dataframe(analysis_summary.summary)
|
180 |
+
# query = f"{ticker_user} stock"
|
181 |
|
182 |
details = {
|
183 |
"symbol": ticker_user,
|
|
|
185 |
"screener": "india",
|
186 |
"interval": interval,
|
187 |
}
|
188 |
+
# st.title("Details")
|
189 |
+
# st.dataframe(details)
|
190 |
|
191 |
+
# st.title("Oscillator Analysis")
|
192 |
+
# st.dataframe(analysis_summary.oscillators)
|
193 |
|
194 |
+
# st.title("Moving Averages")
|
195 |
+
# st.dataframe(analysis_summary.moving_averages)
|
196 |
|
197 |
+
# st.title("Summary")
|
198 |
+
# st.dataframe(analysis_summary.summary)
|
199 |
|
200 |
+
# st.title("Indicators")
|
201 |
+
# st.dataframe(analysis_summary.indicators)
|
202 |
+
|
203 |
+
# Page Title
|
204 |
+
st.title(f"π TradingView Analysis: {ticker_user} ({details['Exchange']})")
|
205 |
+
|
206 |
+
# --- Row 1: Details + Summary ---
|
207 |
+
col1, col2 = st.columns([1, 3])
|
208 |
+
with col1:
|
209 |
+
st.subheader("βΉοΈ Details")
|
210 |
+
st.table(details) # Using st.table for a concise key-value look
|
211 |
+
|
212 |
+
with col2:
|
213 |
+
st.subheader("π Summary")
|
214 |
+
st.dataframe(analysis_summary.summary, use_container_width=True)
|
215 |
+
|
216 |
+
# --- Row 2: Oscillators + Moving Averages ---
|
217 |
+
col3, col4 = st.columns(2)
|
218 |
+
with col3:
|
219 |
+
st.subheader("βοΈ Oscillator Analysis")
|
220 |
+
st.dataframe(analysis_summary.oscillators, use_container_width=True)
|
221 |
+
|
222 |
+
with col4:
|
223 |
+
st.subheader("π Moving Averages")
|
224 |
+
st.dataframe(analysis_summary.moving_averages, use_container_width=True)
|
225 |
+
|
226 |
+
# --- Row 3: Indicators ---
|
227 |
+
st.subheader("π Indicators")
|
228 |
+
st.dataframe(analysis_summary.indicators, use_container_width=True)
|
229 |
|
230 |
url = "https://api.chart-img.com/v2/tradingview/advanced-chart"
|
231 |
api_key = "l0iUFRSeqC9z7nDPTd1hnafPh2RrdcEy6rl6tNqV"
|
|
|
270 |
# message = llm_vis.invoke([hmessage])
|
271 |
|
272 |
# st.write(message.content)
|
273 |
+
# st.write(res["output_text"])
|
274 |
+
data = res["output_text"]
|
275 |
+
# Header Info
|
276 |
+
st.markdown(f"### {data['stock_summary']['company_name']} ({data['stock_summary']['ticker']}) | {data['stock_summary']['exchange']}")
|
277 |
+
st.markdown(f"**Description**: {data['stock_summary']['description']}")
|
278 |
+
|
279 |
+
# === Row 1: Price and Market Cap ===
|
280 |
+
row1 = st.columns(3)
|
281 |
+
row1[0].metric("π° Current Price", data["stock_summary"]["current_price"])
|
282 |
+
row1[1].metric("π’ Market Cap", data["stock_summary"]["market_cap"])
|
283 |
+
row1[2].metric("β Rating", data["overall_rating"]["rating"])
|
284 |
+
|
285 |
+
# === Row 2: Historical Performance ===
|
286 |
+
st.subheader("π Historical Performance")
|
287 |
+
perf_cols = st.columns(len(data["stock_summary"]["historical_performance"]))
|
288 |
+
for i, (k, v) in enumerate(data["stock_summary"]["historical_performance"].items()):
|
289 |
+
perf_cols[i].metric(k.replace("_", " ").title(), v)
|
290 |
+
|
291 |
+
# === Row 3: Fundamentals ===
|
292 |
+
st.subheader("π Company Fundamentals")
|
293 |
+
row3 = st.columns(4)
|
294 |
+
metrics = data["evaluation_parameters"]["company_fundamentals"]["key_metrics"]
|
295 |
+
row3[0].metric("P/E Ratio", metrics["pe_ratio"])
|
296 |
+
row3[1].metric("EPS YoY", metrics["eps_growth_yoy"])
|
297 |
+
row3[2].metric("Revenue YoY", metrics["revenue_growth_yoy"])
|
298 |
+
row3[3].metric("Dividend Yield", metrics["dividend_yield"])
|
299 |
+
|
300 |
+
row3b = st.columns(4)
|
301 |
+
row3b[0].metric("Net Income YoY", metrics["net_income_growth_yoy"])
|
302 |
+
row3b[1].metric("Volume", metrics["volume"])
|
303 |
+
row3b[2].metric("Return on Capital", metrics["return_on_capital"])
|
304 |
+
row3b[3].metric("Balance Sheet", metrics["balance_sheet"])
|
305 |
+
|
306 |
+
st.info(data["evaluation_parameters"]["company_fundamentals"]["assessment"])
|
307 |
+
|
308 |
+
# === Row 4: Trends and Technicals ===
|
309 |
+
st.subheader("π Trends & Technical Analysis")
|
310 |
+
row4 = st.columns(3)
|
311 |
+
row4[0].markdown(f"**Historical Trends:** {data['evaluation_parameters']['current_and_future_price_trends']['historical_trends']}")
|
312 |
+
row4[1].markdown(f"**Current Trends:** {data['evaluation_parameters']['current_and_future_price_trends']['current_trends']}")
|
313 |
+
row4[2].markdown(f"**Technical Indicators:** {data['evaluation_parameters']['current_and_future_price_trends']['technical_indicators']}")
|
314 |
+
|
315 |
+
st.success(data["evaluation_parameters"]["current_and_future_price_trends"]["assessment"])
|
316 |
+
st.caption(f"π Notes: {data['evaluation_parameters']['current_and_future_price_trends']['technical_analysis_notes']}")
|
317 |
+
|
318 |
+
# === Row 5: Sentiment ===
|
319 |
+
st.subheader("π° News & Sentiment")
|
320 |
+
sentiment_cols = st.columns(2)
|
321 |
+
with sentiment_cols[0]:
|
322 |
+
st.success("π Positive Sentiment")
|
323 |
+
for s in data["evaluation_parameters"]["news_and_sentiment"]["positive_sentiment"]:
|
324 |
+
st.write(f"β
{s}")
|
325 |
+
with sentiment_cols[1]:
|
326 |
+
st.error("π Negative Sentiment")
|
327 |
+
for s in data["evaluation_parameters"]["news_and_sentiment"]["negative_sentiment"]:
|
328 |
+
st.write(f"β {s}")
|
329 |
+
st.info(data["evaluation_parameters"]["news_and_sentiment"]["assessment"])
|
330 |
+
|
331 |
+
# === Row 6: Red Flags ===
|
332 |
+
st.subheader("π© Red Flags")
|
333 |
+
red_flag_cols = st.columns(3)
|
334 |
+
for i, flag in enumerate(data["evaluation_parameters"]["red_flags"]):
|
335 |
+
red_flag_cols[i].warning(f"**{flag['flag']}**\n{flag['details']}")
|
336 |
+
|
337 |
+
# === Row 7: Investment Advice ===
|
338 |
+
st.subheader("π‘ Investment Advice")
|
339 |
+
advice_cols = st.columns(3)
|
340 |
+
advice = data["investment_advice"]
|
341 |
+
advice_cols[0].markdown(f"**Next 1 Week**\n{advice['next_1_weeks_outlook']}")
|
342 |
+
advice_cols[1].markdown(f"**Next 5 Weeks**\n{advice['next_5_weeks_outlook']}")
|
343 |
+
advice_cols[2].markdown(f"**Next 10 Weeks**\n{advice['next_10_weeks_outlook']}")
|
344 |
+
|
345 |
+
action_cols = st.columns(3)
|
346 |
+
action_cols[0].success(f"**Buy:** {advice['price_action_suggestions']['buy']}")
|
347 |
+
action_cols[1].info(f"**Hold:** {advice['price_action_suggestions']['hold']}")
|
348 |
+
action_cols[2].error(f"**Sell:** {advice['price_action_suggestions']['sell']}")
|
349 |
+
|
350 |
+
# === Footer ===
|
351 |
+
st.markdown("---")
|
352 |
+
st.caption("Generated by AI-powered financial analysis dashboard.")
|
353 |
else:
|
354 |
st.warning(f"Failed to retrieve image. Status code: {response.status_code}")
|
355 |
st.warning("Response:", response.text)
|