QuantumLearner commited on
Commit
0a91ea9
·
verified ·
1 Parent(s): 96e82e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +68 -1
app.py CHANGED
@@ -533,4 +533,71 @@ def show_cashflow_growth(symbol, period):
533
  try:
534
  fig_fin = px.line(df, x="date", y=financing_vars, title="Financing Cash Flow Growth")
535
  fig_fin.update_layout(xaxis_title="Date", yaxis_title="Growth", legend_title="Metric")
536
- st.plotly_chart(fig_fin,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
533
  try:
534
  fig_fin = px.line(df, x="date", y=financing_vars, title="Financing Cash Flow Growth")
535
  fig_fin.update_layout(xaxis_title="Date", yaxis_title="Growth", legend_title="Metric")
536
+ st.plotly_chart(fig_fin, use_container_width=True)
537
+ except Exception:
538
+ st.error("Could not plot Financing CF Growth.")
539
+ with st.expander("Interpretation"):
540
+ interp_text = interpret_growth_metrics(df, financing_vars, "Financing CF Growth")
541
+ st.markdown(interp_text)
542
+ with st.expander("DataFrame"):
543
+ cols = ["date"] + [c for c in financing_vars if c in df.columns]
544
+ st.dataframe(df[cols])
545
+
546
+ # 4. Free Cash Flow
547
+ st.subheader("4. Free Cash Flow")
548
+ fcf_vars = ["growthFreeCashFlow"]
549
+ try:
550
+ fig_fcf = px.line(df, x="date", y=fcf_vars, title="Free Cash Flow Growth")
551
+ fig_fcf.update_layout(xaxis_title="Date", yaxis_title="Growth", legend_title="Metric")
552
+ st.plotly_chart(fig_fcf, use_container_width=True)
553
+ except Exception:
554
+ st.error("Could not plot Free Cash Flow Growth.")
555
+ with st.expander("Interpretation"):
556
+ interp_text = interpret_growth_metrics(df, fcf_vars, "Free Cash Flow Growth")
557
+ st.markdown(interp_text)
558
+ with st.expander("DataFrame"):
559
+ cols = ["date"] + [c for c in fcf_vars if c in df.columns]
560
+ st.dataframe(df[cols])
561
+
562
+ # ----------------------------
563
+ # Main
564
+ # ----------------------------
565
+ st.title("Financial Growth Metrics")
566
+ st.markdown("""
567
+ This dashboard shows key financial growth metrics across balance sheet, income statement, and cash flow statement.
568
+ Use the sidebar to set inputs and click **Run Analysis**.
569
+ """)
570
+
571
+ # Sidebar Navigation
572
+ st.sidebar.header("Navigation")
573
+ page = st.sidebar.radio(
574
+ "Select Page",
575
+ ["Financial Growth", "Balance Sheet Growth", "Income Growth", "Cash Flow Growth"],
576
+ index=0
577
+ )
578
+
579
+ # Sidebar Inputs
580
+ st.sidebar.header("Inputs")
581
+ symbol = st.sidebar.text_input("Company Symbol", value="AAPL")
582
+ period = st.sidebar.selectbox("Period", options=["annual", "quarter"])
583
+ run_button = st.sidebar.button("Run")
584
+
585
+ # Logic for pages
586
+ if run_button:
587
+ if page == "Financial Growth":
588
+ show_financial_growth(symbol, period)
589
+ elif page == "Balance Sheet Growth":
590
+ show_balance_sheet_growth(symbol, period)
591
+ elif page == "Income Growth":
592
+ show_income_growth(symbol, period)
593
+ elif page == "Cash Flow Growth":
594
+ show_cashflow_growth(symbol, period)
595
+
596
+ # Hide Streamlit default style
597
+ hide_streamlit_style = """
598
+ <style>
599
+ #MainMenu {visibility: hidden;}
600
+ footer {visibility: hidden;}
601
+ </style>
602
+ """
603
+ st.markdown(hide_streamlit_style, unsafe_allow_html=True)